03.05.2010, 13:43
pawn Код:
#define FLOOD 2000
pawn Код:
new AFLOOD[MAX_PLAYERS];
pawn Код:
AFLOOD[playerid] = 0;
pawn Код:
//----------------------------------[ooc]-----------------------------------------------
if(strcmp(cmd, "/ooc", true) == 0 || strcmp(cmd, "/o", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "You havent logged in yet !");
return 1;
}
if ((noooc) && PlayerInfo[playerid][pAdmin] < 1)
{
SendClientMessage(playerid, COLOR_GRAD2, "OOC Is Disabled By Admin!");
return 1;
}
if(PlayerInfo[playerid][pMuted] == 1)
{
SendClientMessage(playerid, TEAM_CYAN_COLOR, " You Are Muted!");
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_GRAD2, "USAGE: (/o)oc [ooc chat]");
return 1;
}
if (AFLOOD[playerid] == 1 && (PlayerInfo[playerid][pAdmin] < 1))
{
format(string, sizeof(string), "Please try again later %d seconds Later!", (FLOOD/10000));
SendClientMessage(playerid, COLOR_YELLOW, string);
return 1;
}
format(string, sizeof(string), "[OOC] %s: %s " , sendername, result);
OOCOff(COLOR_OOC,string);
printf("%s", string);
if (PlayerInfo[playerid][pAdmin] < 1){AFLOOD[playerid] = 1; SetTimerEx("OOCFLOOD", FLOOD, 0, "i", playerid);}
}
return 1;
}
pawn Код:
forward OOCFLOOD(playerid);
public OOCFLOOD(playerid)
{
AFLOOD[playerid] = 1;
}