04.05.2018, 11:20
PHP код:
new spamming[MAX_PLAYERS][2];
new tick;
new kickplayer[MAX_PLAYERS];
GetTickCount2()
{
new count = GetTickCount();
return count < 0 ? count +- tick : count - tick;
}
PlayerName(playerid)
{
new name[25];
GetPlayerName(playerid, name, sizeof(name));
return name;
}
public OnPlayerText(playerid, text[])
{
new count = GetTickCount2();
new string[270];
if (count-spamming[playerid][1] < 1000) {
spamming[playerid][0] ++;
if (spamming[playerid][0] == 3) {
SendClientMessage(playerid, -1, "[Server]: Please dont spam in server.");
}
if (spamming[playerid][0] == 5) {
spamming[playerid][0] = 0;
SendClientMessage(playerid, -1, "~ You have been kicked reason sapmming.");
kickplayer[playerid] = SetTimerEx("KickOrBan", 50, 0, "dd", playerid, 1);
format(string, 128, "~ %s has been kicked reason spamming.", PlayerName(playerid));
SendClientMessageToAll(-1, string);
printf("[kicked] %s has been kicked reason spamming.", PlayerName(playerid));
return 0;
}
}
else
{
spamming[playerid][0] = 1;
}
spamming[playerid][1] = count;
return 1;
}
forward KickOrBan(playerid, kickorban);
public KickOrBan(playerid, kickorban)
{
switch (kickorban)
{
case 1: Kick(playerid);
case 2: {
Ban(playerid);
}
}
KillTimer(kickplayer[playerid]);
kickplayer[playerid] = 0;
}
rep+ if i helped you.