23.02.2011, 12:47
Para Nгo ficar floodando no Relato Coloque um Settime CMD:
pawn Код:
if(strcmp(cmd, "/relato", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "Voce nгo estб logado!");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_RED, "USE: /relato [TEXTO]");
return 1;
}
format(string, sizeof(string), "Relato de %s[%d]: %s", sendername, playerid, (result));
ABroadCast(0xFFFF66FF,string,1);
AntFloodRelato[playerid] = 1;
SetTimerEx("AntFloodRelato", 5000, false, "i", playerid);
SendClientMessage(playerid, 0xFFFF66FF, "Seu Relato foi enviado, aguarde 5 segundos para mandar novamente!");
}
return 1;
pawn Код:
//No Topo do GameMode
new AntFloodRelato[MAX_PLAYERS];
forward AntFloodRelato(playerid);
//No Final do GameMode
)
public AntFloodRelato(playerid)
{
if(IsPlayerConnected(playerid))
{
if(AntFloodRelato[playerid] == 1)
{
AntFloodRelato[playerid] = 0;
}
}
}