It is because i want to make nemesis like L4D's tank.
I think we can make nemsis's attack will be blow the human with use this plugin
Can someone editor it for nemesis's attack?
It can make Tank(L4D) more real in cs
Code:
#include <amxmodx>
#include <engine>
#include <cstrike>
new PLUGIN[] = "Admin Push out of the way!"
new AUTHOR[] = "jsauce"
new VERSION[] = "1.2"
#define ADMIN ADMIN_LEVEL_A
#define IMMUNE ADMIN_IMMUNITY
#define NON_ATTACKONLY // COMMENT THIS LINE OUT IF YOU DONT CARE!
#define IS_IN_USE // COMMENT TO DISABLE. IF ENABLED USE KEY MUST BE PRESSED.
// #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 inform_player(ptr,ptd)
{
new hudmessage[256],admin[32]
get_user_name(ptr,admin,31)
format(hudmessage,255,"Get out of the way of %s",admin)
set_hudmessage(255,255,255,0.50,0.30,0,6.0,0.1,0.1,0.2,4)
show_hudmessage(ptd,hudmessage)
}
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 && is_valid_player ( ptd ) )
{
if(!( get_user_flags ( ptd ) & IMMUNE ))
{
#if defined NON_ATTACKONLY
if(!(get_user_button(ptr)&IN_ATTACK))
#else
#endif
{
#if defined IS_IN_USE
if(get_user_button(ptr)&IN_USE && get_user_oldbutton(ptr))
#else
#endif
{
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][b] -= a[0][b]
a[1][b] *= g_cvarpush
}
entity_set_vector ( ptd, EV_VEC_velocity, a[1] )
inform_player(ptr,ptd)
}
}
}
}
}
}
}