Quote:
Originally Posted by ehha
Bump! 
So i made no mistakes? Nothing to improve? Just tell me and I'll move along 
|
rewrote for you
PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "name flood"
#define VERSION "0.1"
#define AUTHOR "camper"
#define ID_FLOOD (taskid - TASK_FLOOD)
//#pragma semicolon 1 useless :(
enum (+= 100)
{
TASK_FLOOD
}
new ct[33], nft;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
nft = register_cvar("amx_name_flood_time", "20");
}
public client_putinserver(id)
{
set_task(nft, "decrease_flood", id+TASK_FLOOD)
ct[id] = 0;
}
public decrease_flood(taskid)
{
if (ct[ID_FLOOD] > 0)
ct[ID_FLOOD] -= 1
set_task(nft, "decrease_flood", ID_FLOOD+TASK_FLOOD)
}
public client_disconnect(id)
{
remove_task(id+TASK_FLOOD)
}
public client_infochanged(id)
{
new newname[32], oldname[32];
get_user_info(id, "name", newname,31);
get_user_name(id, oldname, 31);
if(equal(newname, oldname))
return PLUGIN_HANDLED;
ct[id]++
switch (ct[id])
{
case 3:
{
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:
{
server_cmd("kick #%d ^"%s^"", get_user_userid(id), "Kicked due to name change flood.");
return PLUGIN_HANDLED
}
}
return PLUGIN_HANDLED
}
look at the changes, how simple is now, and how better (using tasks for decreasing flood count, and removing them.)