Help :S OOC FLOOD :S - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help :S OOC FLOOD :S (
/showthread.php?tid=145677)
Help :S OOC FLOOD :S -
qwqwqw - 03.05.2010
I need that player wait 2 seconds between ooc messages I made that but it only says Please try again later 2 seconds later! ant I cant write text again :S
Код:
//----------------------------------[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) && (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){SetTimer("OOCFLOOD", FLOOD, 0);AFLOOD = 0;}
}
return 1;
}
it is my OOC can you help me?
Re: Help :S OOC FLOOD :S -
Peep - 03.05.2010
i think you should use timer
Re: Help :S OOC FLOOD :S -
pierhs - 03.05.2010
First the Global Variable:
Now this one to OnPlayerConnect:
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;
}
Now just the public function for the OOCFLOOD
pawn Код:
forward OOCFLOOD(playerid);
public OOCFLOOD(playerid)
{
AFLOOD[playerid] = 1;
}