26.02.2015, 15:44
(
Последний раз редактировалось sirvanec; 26.02.2015 в 18:11.
)
-----
|
if(!strcmp(cmdtext,"/home",true)) |
|
dcmd_ban(playerid,params[]) |
new CommandCount[MAX_PLAYERS], AntiCmdSpamTimer[MAX_PLAYERS];
public OnPlayerCommandText(playerid, cmdtext[])
{
CommandCount[playerid]++;
return 0;
}
public OnPlayerConnect(playerid)
{
AndCmdSpamTimer[playerid] = SetTimerEx("AntiCommandSpam", 5000, 1, "i", playerid);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
KillTimer(AntiCmdSpamTimer[playerid]);
CommandCount[playerid] = 0;
return 1;
}
forward AntiCommandSpam(playerid);
public AntiCommandSpam(playerid)
{
if(CommandCount[playerid] >= 10)
{
SendClientMessage(playerid, 0xFF0000FF, "You have been kicked from the server. Reason: Command Spam");
Kick(playerid);
}
CommandCount[playerid] = 0;
return 1;
}
new LastCommand[MAX_PLAYERS];
public OnPlayerCommandText(playerid, cmdtext[])
{
if((GetTickCount() - LastCommand[playerid]) < 334) Kick(playerid);
else LastCommand[playerid] = GetTickCount();
//your commands
return 0;
}