i am trying to make a pluging so when you kill yourself like 4 times in one round, the server kicks you. It works but im trying to make it so when a new round starts, it resets everything. That is what im having trouble with. Which event would i use for a new round? I wasn't sure so i made it call 3 differen't events.. but when a new round starts, nothing is printed on the screen like i wanted it to. Any clue?
Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <core>
new attacker
new Float:countup[32]
new Float:countupleft[32]
public plugin_init()
{
register_plugin("Anti-Death Kicker","1.0","FiVeTeN")
register_event("Damage","tally","b")
register_event("EndRound","endRound","a")
register_event("RoundStat","roundStat","a")
register_event("RndRes","roundRes","a")
}
public tally(id)
{
attacker=get_user_attacker(id)
if(is_user_alive(id)==0)
{
if(attacker>32)
{
countup[id]=countup[id]+1
if(countup[id]==2)
{
client_print(id,print_chat,"[AMXX] Careful! You have 4 suicides left.",countupleft[id]);
}
else if(countup[id]==4)
{
client_print(id,print_chat,"[AMXX] Careful! You have 3 suicides left.",countupleft[id]);
}
else if(countup[id]==6)
{
client_print(id,print_chat,"[AMXX] Careful! You have 2 suicides left.",countupleft[id]);
}
else if(countup[id]==8)
{
client_print(id,print_chat,"[AMXX] Careful! You have 1 suicides left.",countupleft[id]);
}
}
if(attacker==id)
{
countup[id]=countup[id]+1
if(countup[id]==2){
client_print(id,print_chat,"[AMXX] Careful! You have 4 suicides left.",countupleft[id]);
}else if(countup[id]==4){
client_print(id,print_chat,"[AMXX] Careful! You have 3 suicides left.",countupleft[id]);
}else if(countup[id]==6){
client_print(id,print_chat,"[AMXX] Careful! You have 2 suicides left.",countupleft[id]);
}else if(countup[id]==8){
client_print(id,print_chat,"[AMXX] Careful! You have 1 suicides left.",countupleft[id]);
}
}
if(countup[id]>9)
{
new userid = get_user_userid(id) ;
server_cmd("banid 10 #%d kick",userid);
countup[id]=0.0;
countupleft[id]=0.0;
}
}
return PLUGIN_HANDLED
}
public endRound()
{
client_print(0,print_chat,"Round Ended");
return PLUGIN_HANDLED
}
public roundStat()
{
client_print(0,print_chat,"Round Status");
return PLUGIN_HANDLED
}
public roundRes()
{
client_print(0,print_chat,"Round RES?");
return PLUGIN_HANDLED
}