Why doesn't the respawn on my plugin work? When i die nothing happens..
PHP Code:
#include <amxmodx>
#include <fun>
#include <engine>
#include <hamsandwich>
#include <cstrike>
#include <csx>
#include <colorchat>
new g_szVictimSound[100], g_szKillerSound[100], g_szPlayersSound[100]
new g_iMaxPlayers
new const PLUGIN[ ] = "Rambo mod"
new const VERSION[ ] = "1.2"
new const AUTHOR[ ] = "FlyingHorse"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
RegisterHam(Ham_Spawn, "player", "Event_Player_Spawn", 1)
RegisterHam(Ham_Killed, "player", "Event_Ham_Killed")
register_event("DeathMsg", "eDeathMsg_HeadShot", "a", "1>0", "3=1")
}
public client_putinserver(id)
{
set_task(15.0, "advertisement", id)
}
public advertisement(id)
{
ColorChat(id, RED, "^x04[Rambo Mod]^x01 This server is using^x03 Rambo mod^x04 v%s^x01 by^x04 FlyingHorse^x01.", VERSION)
}
public plugin_precache()
{
precache_sound("fvox/blip.wav")
new szFile[64]
get_localinfo("amxx_configsdir", szFile, 63)
format(szFile, 63, "%s/headshots.ini", szFile)
new File = fopen(szFile, "rt")
if(!File)
{
pause("ad")
return
}
new Text[128], Witch[8], Sound[100]
while(!feof(File))
{
fgets(File, Text, 127)
trim( Text )
if(!Text[0] || Text[0] == ';' || (Text[0] == '/' && Text[1] == '/'))
continue
parse(Text, Witch, 7, Sound, 99)
if(!g_szVictimSound[0] && equal(Witch, "victim"))
{
copy(g_szVictimSound, 99, Sound)
precache_sound(g_szVictimSound)
}
else if(!g_szKillerSound[0] && equal(Witch, "killer"))
{
copy(g_szKillerSound, 99, Sound)
precache_sound(g_szKillerSound)
}
else if(!g_szPlayersSound[0] && equal(Witch, "players"))
{
copy(g_szPlayersSound, 99, Sound)
precache_sound(g_szPlayersSound)
}
}
fclose(File)
}
public Event_Player_Spawn(id)
{
if(is_user_alive(id))
{
set_user_maxspeed(id, 350.0)
set_task(0.1, "player_glowteam", id)
client_cmd(id,"spk ^"fvox/blip^"")
ColorChat(id, GREEN, "^x04[Rambo Mod]^x01 You Respawned!")
strip_user_weapons(id)
give_item(id, "weapon_knife")
cs_set_weapon_ammo(give_item(id, "weapon_deagle"), 20)
cs_set_weapon_ammo(give_item(id, "weapon_m249"), 200)
cs_set_weapon_ammo(give_item(id, "weapon_hegrenade"), 10)
cs_set_user_bpammo(id, CSW_DEAGLE, 100)
cs_set_user_bpammo(id, CSW_M249, 1000)
}
}
public Event_Ham_Killed(victim, attacker, shouldgib)
{
new attackername[33]
get_user_name(attacker, attackername, 32)
if(is_user_connected(victim))
ColorChat(victim, GREEN, "^x04[Rambo Mod]^x01 You got owned by^x04 %s", attackername)
ExecuteHamB(Ham_CS_RoundRespawn, victim)
}
public player_glowteam(id)
{
if(cs_get_user_team(id) == CS_TEAM_CT)
{
set_user_rendering(id, kRenderFxGlowShell, 0, 0, 255, kRenderNormal, 16)
}
else if(cs_get_user_team(id) == CS_TEAM_T)
set_user_rendering(id, kRenderFxGlowShell, 255, 0, 0, kRenderNormal, 16)
}
public plugin_cfg()
{
g_iMaxPlayers = get_maxplayers()
}
public eDeathMsg_HeadShot()
{
new iKiller = read_data(1)
if(iKiller > g_iMaxPlayers)
return
new iVictim = read_data(2)
if(iKiller == iVictim)
return
if(g_szKillerSound[0])
emit_sound(iKiller, CHAN_VOICE, g_szKillerSound, VOL_NORM, ATTN_STATIC, 0, PITCH_NORM)
if(g_szVictimSound[0])
client_cmd(iVictim, "speak %s", g_szVictimSound)
if(g_szPlayersSound[0])
{
for(new id = 1; id <= g_iMaxPlayers; id++)
{
if(!is_user_connected(id))
continue
if((g_szKillerSound[0] && id == iKiller) || (g_szVictimSound[0] && id == iVictim))
continue
client_cmd(id, "speak %s", g_szPlayersSound)
}
}
}