Обратите внимание, если вы хотите заключить сделку с этим пользователем, он заблокирован
- Ошибка
-
Плагин работает для всех. Хотя в кварах указано только для флага ADMIN_CHAT (amx_emj_adminonly "i")
- ОС
- Linux
- Версия Metamod
-
Metamod v1.21p37 2013/05/30
- Исходный код
-
/*
This plugin ONLY for amxmodx 1.8.3-dev 4xxx+
Thanks for the innovations in the code and support to worox1337 & fantom.
From DEV-CS.RU
*/
#include <amxmodx>
#include <reapi>
//Uncomment to enable define to use natives emj_set_jumps / emj_remove_jumps
#define NATIVE_ENABLE
//Uncomment to enable define for trail effect
#define TRAIL_ENABLE
#if defined TRAIL_ENABLE
#define TRAIL_LIFE 2
#define TRAIL_SIZE 2
#define TRAIL_BRIGHTNESS 150
#define TASK_TRAIL_EFFECT_REMOVE 629372
new gl_sprite_name, emj_trail_effect
new bool:g_isTrailActive[MAX_CLIENTS] = false
new Float:g_fLastCmdTime[MAX_CLIENTS]
#endif
new g_iMaxPlayers, emj_maxjumps, emj_activeFlags[27]
new jumpnum[MAX_CLIENTS] = {0}
new bool:g_isActiveJump[MAX_CLIENTS] = false
#if defined TRAIL_ENABLE
public plugin_precache()
{
gl_sprite_name = precache_model("sprites/zbeam5.spr")
}
#endif
public plugin_init()
{
register_plugin("Easy MultiJump","1.6","twistedeuphoria/jesuspunk")
new pcvar = create_cvar("amx_emj_maxjumps","1", FCVAR_NONE, "Set max player jumps.")
bind_pcvar_num(pcvar, emj_maxjumps)
#if defined TRAIL_ENABLE
pcvar = create_cvar("amx_emjtrail_effect","2",FCVAR_NONE,"Set color type of trail line")
bind_pcvar_num(pcvar, emj_trail_effect)
#endif
pcvar = create_cvar("amx_emjadmin_only", "", FCVAR_NONE, "Flag(s) required must have player for work multijump.")
hook_cvar_change(pcvar,"emjadmin_only_callback")
bind_pcvar_string(pcvar, emj_activeFlags, charsmax(emj_activeFlags))
RegisterHookChain(RG_CBasePlayer_Jump,"CBasePlayer_Jump")
RegisterHookChain(RG_CBasePlayer_SetClientUserInfoName,"CBasePlayer_SetClientUserInfoName")
g_iMaxPlayers = get_member_game(m_nMaxPlayers)
register_native("emj_set_jumps", "native_emj_set_jumps", 0)
}
#if defined NATIVE_ENABLE
public plugin_natives ( )
{
register_native("emj_set_jumps", "native_emj_set_jumps", 1)
register_native("emj_remove_jumps", "native_emj_remove_jumps", 1)
register_native("emj_isActive", "native_emj_isActive", 1)
}
public native_emj_set_jumps(id)
{
g_isActiveJump[id] = true
}
public native_emj_remove_jumps(id)
{
g_isActiveJump[id] = false
}
public native_emj_isActive(id)
{
if(g_isActiveJump[id]) return true
else return false
}
#endif
public emjadmin_only_callback(pCvar, const OldValue[], const NewValue[])
{
for(new id = 1; id <= g_iMaxPlayers; id++)
{
g_isActiveJump[id] = _isAdmin(id)
}
}
public client_putinserver(id)
{
jumpnum[id] = 0
g_isActiveJump[id] = _isAdmin(id)
}
public CBasePlayer_SetClientUserInfoName(id, infobuffer[], szNewName[])
{
g_isActiveJump[id] = _isAdmin(id)
}
public CBasePlayer_Jump(id)
{
if(!g_isActiveJump[id] || !is_user_alive(id)) return HC_CONTINUE
new obut = get_member(id,m_afButtonLast)
if(!(get_entvar(id,var_flags) & FL_ONGROUND) && !(obut & IN_JUMP) && jumpnum[id] < emj_maxjumps)
{
static Float:velocity[3]
get_entvar(id,var_velocity,velocity)
velocity[2] = random_float(265.0,285.0)
set_entvar(id,var_velocity,velocity)
jumpnum[id]++
#if defined TRAIL_ENABLE
if(!g_isTrailActive[id] && emj_trail_effect != 0)
{
static gl_color[3]
gl_color[0] = random(255)
gl_color[1] = random(255)
gl_color[2] = random(255)
if(emj_trail_effect == 2)
{
if(get_member(id,m_iTeam) == 1)
{
gl_color[0] = 255
gl_color[1] = 0
gl_color[2] = 0
}
else
{
gl_color[0] = 0
gl_color[1] = 0
gl_color[2] = 255
}
}
do_trail_effect(id,gl_color)
}
g_fLastCmdTime[id] = get_gametime ();
#endif
}
else if(get_entvar(id,var_flags) & FL_ONGROUND)
{
jumpnum[id] = 0
#if defined TRAIL_ENABLE
if(g_isTrailActive[id]) set_task(1.0,"remove_trail_effect",id+TASK_TRAIL_EFFECT_REMOVE,_,_,"a",1)
#endif
}
return HC_CONTINUE
}
#if defined TRAIL_ENABLE
public do_trail_effect(id,gl_color[3])
{
g_isTrailActive[id] = true
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(22) // TE_BEAMFOLLOW
write_short(id)
write_short(gl_sprite_name)
write_byte(TRAIL_LIFE*10)
write_byte(TRAIL_SIZE)
write_byte(gl_color[0])
write_byte(gl_color[1])
write_byte(gl_color[2])
write_byte(TRAIL_BRIGHTNESS)
message_end()
set_task(1.0,"remove_trail_effect",id+TASK_TRAIL_EFFECT_REMOVE,_,_,"a",1)
}
public remove_trail_effect(id)
{
if(!g_isTrailActive[id-TASK_TRAIL_EFFECT_REMOVE]) return PLUGIN_HANDLED
new Float:fGameTime = get_gametime()
if(fGameTime-g_fLastCmdTime[id-TASK_TRAIL_EFFECT_REMOVE] < 1.35)
{
remove_task(id+TASK_TRAIL_EFFECT_REMOVE)
set_task(1.0,"remove_trail_effect",id,_,_,"a",1)
}
else
{
g_isTrailActive[id-TASK_TRAIL_EFFECT_REMOVE] = false
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(99) // TE_KILLBEAM
write_short(id-TASK_TRAIL_EFFECT_REMOVE)
message_end()
}
return PLUGIN_CONTINUE
}
#endif
stock bool:_isAdmin(id)
{
if(is_user_bot(id)) return false
if(strlen(emj_activeFlags) == 0) return true
else
{
if(get_user_flags(id) & read_flags(emj_activeFlags)) return true
else return false
}
}
Помогите решить.