i maked this plugin and i have an problem :
When i switch team appear that message like when i kill an enemy trough wall
Rest of all plugin works (when i kill an enemy trough wall appear message correct)
Please if somebody can fix
Code :
Code:
#include <amxmodx>
#include <fakemeta>
#include <xs>
new const PLUGIN[] = "Wall Shot"
new const VERSION[] = "0.1"
new const AUTHOR[] = "SAMURAI"
new mWallKills[33]
new cvartipe
new cvarduration
new mlist[2][]=
{
"%s killed %s trough wall !",
"%s killed %s with him Wallhack :)"
}
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("DeathMsg", "deathMSG", "a")
cvartipe = register_cvar("wallshot_showtype","1")
cvarduration = register_cvar("wallshot_hudtime","5.0") // time in seconds
}
public deathMSG()
{
new iAttacker = read_data(1)
new iVictim = read_data(2)
new kname[32], vname[32]
get_user_name(iVictim,kname,31)
get_user_name(iAttacker,vname,31)
new bool:qVisible = fm_is_ent_visible(iAttacker, iVictim)
if (!qVisible)
{
mWallKills[iAttacker]++
switch (get_pcvar_num(cvartipe))
{
case 1:
{
set_hudmessage(0, 0, 255, 0.28, 0.26, 0, 6.0, get_pcvar_float(cvarduration))
show_hudmessage(0,(mlist[random_num(0,1)]),vname,kname)
}
case 2:
{
client_print(0,print_chat,(mlist[random_num(0,1)]),vname,kname)
}
case 3:
{
client_print(0,print_center,(mlist[random_num(0,1)]),vname,kname)
}
}
}
}
stock bool:fm_is_ent_visible(index, entity) {
new Float:origin[3], Float:view_ofs[3], Float:eyespos[3]
pev(index, pev_origin, origin)
pev(index, pev_view_ofs, view_ofs)
xs_vec_add(origin, view_ofs, eyespos)
new Float:entpos[3]
pev(entity, pev_origin, entpos)
engfunc(EngFunc_TraceLine, eyespos, entpos, 0, index)
switch (pev(entity, pev_solid)) {
case SOLID_BBOX..SOLID_BSP: return global_get(glb_trace_ent) == entity
}
new Float:fraction
global_get(glb_trace_fraction, fraction)
if (fraction == 1.0)
return true
return false
}