Whoa, I didn't know you can use 'goto' in Pawn. Ethier way, don't use tasks.
Code:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "name flood"
#define VERSION "0.1"
#define AUTHOR "camper"
new ct[33]
new Float:g_LastTime[33]
new nft
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
nft = register_cvar("amx_name_flood_time", "20");
}
public client_putinserver(id)
{
ct[id]=0;
g_LastTime[id] = 0.0
}
public client_infochanged(id)
{
static sNewName[33],sOldName[33]
get_user_info(id,"name",sNewName,32)
get_user_name(id,sOldName,32);
if(equal(sNewName,sOldName))
return PLUGIN_HANDLED;
new Float:Time = get_gametime();
switch(++ct[id])
{
case 3:
{
if(Time - g_LastTime[id] <= get_pcvar_float(nft))
{
client_print(id, print_chat, "*** Nick change flood! Stop or you will be kicked! ***");
client_print(id, print_chat, "*** Nick change flood! Stop or you will be kicked! ***");
}
}
case 4:
{
if(Time - g_LastTime[id] <= get_pcvar_float(nft))
{
server_cmd("kick #%d ^"%s^"", get_user_userid(id), "Kicked due to name change flood.");
ct[id] = 0
}
}
}
g_LastTime[id] = Time
return PLUGIN_CONTINUE
}
__________________