|
這個只能把普通玩家推開..
因經常玩awp被op檔住老被射死...想請教一下
如果改才能把op也能推開
[PHP]#include <amxmodx>
#include <engine>
#include <cstrike>
new PLUGIN[] = "Admin Push out of the way!"
new AUTHOR[] = "jsauce"
new VERSION[] = "1.2"
#define AUTOSENSE // UNCOMMENT TO USE AUTOSENSE!
#if defined AUTOSENSE
#include <amxmisc>
new bool:validmap = false
#endif
public plugin_init()
{
register_plugin(PLUGIN,VERSION,AUTHOR)
#if defined AUTOSENSE
register_cvar("amx_adminpush","0")
#else
register_cvar("amx_adminpush","1")
#endif
register_cvar("amx_adminpushlevel","10")
register_touch("player","player","admin_touched")
#if defined AUTOSENSE
new mapcfg[32],configsdir[128]
get_configsdir(configsdir,127)
format(mapcfg,31,"%s/adminpushconfig.cfg",configsdir)
if(!file_exists(mapcfg))
{
validmap = false
return PLUGIN_CONTINUE
}
else
{
new map[32],mapname[32],i=0,txtlen
get_mapname(map,31)
while(read_file(mapcfg,i++,mapname,31,txtlen))
{
if((mapname[0] == ';') || !txtlen) continue
if (equali(mapname,map))
{
validmap = true
break
}
}
}
#endif
return PLUGIN_CONTINUE
}
public is_valid_player(id)
{
if(is_valid_ent(id))
{
new szClassname[32]
entity_get_string(id,EV_SZ_classname,szClassname,31)
return (equali(szClassname,"player"))
}
return 0
}
public admin_touched ( ptr, ptd )
{
#if defined AUTOSENSE
if (validmap)
{
set_cvar_num("amx_adminpush",1)
}
#endif
if (get_cvar_num("amx_adminpush")==1)
{
if ( get_user_flags ( ptr ) & ADMIN_RESERVATION && is_valid_player ( ptd ) )
{
if(!( get_user_flags ( ptd ) & ADMIN_RESERVATION ))
{
new CsTeams:ptrTeam = cs_get_user_team(ptr)
new CsTeams:ptdTeam = cs_get_user_team(ptd)
if (ptrTeam == ptdTeam)
{
new Float:a[2][3]
entity_get_vector ( ptr, EV_VEC_origin, a[0] )
entity_get_vector ( ptd, EV_VEC_origin, a[1] )
new b, g_cvarpush = get_cvar_num("amx_adminpushlevel")
for ( b = 0;b <= 2;b++ )
{
a[1] -= a[0]
a[1] *= g_cvarpush
}
entity_set_vector ( ptd, EV_VEC_velocity, a[1] )
}
}
}
}
}
[/PHP] |
|