/* AMX Mod X * Sticky Nades * * (c) Copyright 2005-2006 by VEN * * This file is provided as is (no warranties) * * DESCRIPTION * Plugin provide sticky effect for throwed (with +attack) grenades. * * FEATURES * - ability to make nades stick to any object (default: stick to players only) * - ability to exclude certain nade type from being sticky * * MODULES * engine * fakemeta (first feature only) * * CONFIGURATION * ANY_OBJECT - uncomment to enable first feature * Chahge other options only if you want to use second feature. * CUSTOM_NADES - uncomment to enable second feature * NADE_TYPES - number of total types of sticky nades (default: 3) * NADE_MODEL - remove certain model to exclude appropriate nade * * CVARS * amx_sticky_nades (0: OFF, 1: ON, default: 1) - disables/enables the plugin * * THANKS * lickityspliff - for initial idea */ /* *************************************************** Init **************************************************** */ #include <amxmodx> #include <engine> #define CVAR "amx_sticky_nades" //#define ANY_OBJECT //#define CUSTOM_NADES #if defined ANY_OBJECT #include <fakemeta> // do not change #define BOUNCE_SOUNDS 4 new const BOUNCE_SOUND[BOUNCE_SOUNDS][] = {"weapons/grenade_hit1.wav", "weapons/grenade_hit2.wav", "weapons/grenade_hit3.wav", "weapons/he_bounce-1.wav"} #endif #if defined CUSTOM_NADES #define NADE_TYPES 3 new const NADE_MODEL[NADE_TYPES][] = {"models/w_hegrenade.mdl", "models/w_flashbang.mdl", "models/w_smokegrenade.mdl"} #endif public plugin_init() { register_plugin("Sticky Nades", "0.1", "VEN") register_touch("grenade", "player", "touch_nade") #if defined ANY_OBJECT register_forward(FM_EmitSound, "forward_emit_sound") #endif register_cvar(CVAR, "1") } /* *************************************************** Base **************************************************** */ public touch_nade(nade, id) { if (!is_nade_bounce(nade) || !get_cvar_num(CVAR) || is_nade_excluded(nade)) return entity_set_edict(nade, EV_ENT_aiment, id) entity_set_int(nade, EV_INT_movetype, MOVETYPE_FOLLOW) entity_set_int(nade, EV_INT_sequence, 0) } #if defined ANY_OBJECT public forward_emit_sound(nade, channel, sound[]) { if (is_nade_bounce(nade)) { for (new i = 0; i < BOUNCE_SOUNDS; ++i) { if (equal(sound, BOUNCE_SOUND[i]) && !is_nade_excluded(nade)) { entity_set_int(nade, EV_INT_movetype, MOVETYPE_NONE) entity_set_int(nade, EV_INT_sequence, 0) break } } } } #endif /* ************************************************** Stocks *************************************************** */ stock bool:is_nade_bounce(nade) { return entity_get_int(nade, EV_INT_movetype) == MOVETYPE_BOUNCE } stock bool:is_nade_excluded(nade) { #if defined CUSTOM_NADES new i, model[32] for (i = 0; i < NADE_TYPES; ++i) { entity_get_string(nade, EV_SZ_model, model, 31) if (equal(model, NADE_MODEL[i])) break } if (i == NADE_TYPES) return true return false #else return nade != nade // i know what you are thinking about, i'm not insane, i use this to avoid the compile warning #endif } /* **************************************************** EOF **************************************************** */
Witamy w Nieoficjalnym polskim support'cie AMX Mod X
Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
|
Guest Message by DevFuse
Przyczepiajace sie granaty
Temat rozp. diablix, 04.02.2010 12:28
5 odpowiedzi w tym temacie
#1
Napisano 04.02.2010 12:28
Czy dalby ktos rade przerobic ten plugin zeby HE Grenade sie nie przyczepial i zadawal normalnie obrazenia (z pluginem wiecej zadaje, i sie przyczepiaja wszystkie) a chce zeby sie przyczepial tylko flash i smoke? Z gory dzięki
#2
Napisano 04.02.2010 12:48
#define NADE_TYPES 2 new const NADE_MODEL[NADE_TYPES][] = { "models/w_flashbang.mdl", "models/w_smokegrenade.mdl"}
#3
Napisano 04.02.2010 12:57
#define NADE_TYPES 2 new const NADE_MODEL[NADE_TYPES][] = { "models/w_flashbang.mdl", "models/w_smokegrenade.mdl"}
Juz to probowalem, nadal wszystkie sie przyczepialy
#4
Napisano 04.02.2010 13:03
tamten kod i usuń // przed #define CUSTOM_NADES
#5
Napisano 04.02.2010 13:06
tamten kod i usuń // przed #define CUSTOM_NADES
CUSTOM NADES #define NADE_TYPES 2 new const NADE_MODEL[NADE_TYPES][] = { "models/w_flashbang.mdl", "models/w_smokegrenade.mdl"}
tak to ma byc?
#6
Napisano 04.02.2010 13:30
#include <amxmodx> #include <engine> #define CVAR "amx_sticky_nades" //#define ANY_OBJECT #define CUSTOM_NADES #if defined ANY_OBJECT #include <fakemeta> // do not change #define BOUNCE_SOUNDS 4 new const BOUNCE_SOUND[BOUNCE_SOUNDS][] = {"weapons/grenade_hit1.wav", "weapons/grenade_hit2.wav", "weapons/grenade_hit3.wav", "weapons/he_bounce-1.wav"} #endif #if defined CUSTOM_NADES #define NADE_TYPES 2 new const NADE_MODEL[NADE_TYPES][] = {"models/w_flashbang.mdl", "models/w_smokegrenade.mdl"} #endif public plugin_init() { register_plugin("Sticky Nades", "0.1", "VEN") register_touch("grenade", "player", "touch_nade") #if defined ANY_OBJECT register_forward(FM_EmitSound, "forward_emit_sound") #endif register_cvar(CVAR, "1") }
Użytkownicy przeglądający ten temat: 0
0 użytkowników, 0 gości, 0 anonimowych