SA-MP Forums Archive
I need a little help - 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)
+--- Thread: I need a little help (/showthread.php?tid=362481)



I need a little help - xSkullx - 24.07.2012

Hi guys..i'm starting a new gm and i receive one error
Код:
C:\Users\ady-kryss\Desktop\Romania WonderFull Stunts\gamemodes\RwS.pwn(102) : error 017: undefined symbol "IsPlayerFlooding"
Код:
#define IsPlayerFlooding
doesn't work..

The script:
Код:
			if(IsPlayerFlooding(playerid) && !IsPlayerAdmin(playerid))
	{
		SendClientMessage(playerid, 0xFF0000FF, "* {6EF83C}You can only use commands once {F81414}every two seconds.");
	    return 1;
	}



Re: I need a little help - Jeffry - 24.07.2012

That won't work like this.

Try:

On TOP:
pawn Код:
new LastCmd[MAX_PLAYERS];
OnPlayerConnect:
pawn Код:
LastCmd[playerid] = 0;
OnPlayerCommandText:
pawn Код:
if(IsPlayerFlooding(playerid) && !IsPlayerAdmin(playerid))
{
    SendClientMessage(playerid, 0xFF0000FF, "* {6EF83C}You can only use commands once {F81414}every two seconds.");
    return 1;
}
LastCmd[playerid] = gettime();
At Bottom:

pawn Код:
stock IsPlayerFlooding(playerid)
{
    if(LastCmd[playerid] + 2 > gettime()) return 1; //Flooding: Yes
    else return 0; //Flooding: No
}
Cheers.


Re: I need a little help - FireCat - 24.07.2012

Quote:
Originally Posted by Jeffry
Посмотреть сообщение
That won't work like this.

Try:

On TOP:
pawn Код:
new LastCmd[MAX_PLAYERS];
OnPlayerConnect:
pawn Код:
LastCmd[playerid] = 0;
OnPlayerCommandText:
pawn Код:
if(IsPlayerFlooding(playerid) && !IsPlayerAdmin(playerid))
{
    SendClientMessage(playerid, 0xFF0000FF, "* {6EF83C}You can only use commands once {F81414}every two seconds.");
    return 1;
}
LastCmd[playerid] = gettime();
At Bottom:

pawn Код:
stock IsPlayerFlooding(playerid)
{
    if(LastCmd[playerid] + 2 > gettime()) return 1; //Flooding: Yes
    else return 0; //Flooding: No
}
Cheers.
gettime?
Don't you mean GetTickCount?


Re: I need a little help - Jeffry - 24.07.2012

Quote:
Originally Posted by FireCat
Посмотреть сообщение
gettime?
Don't you mean GetTickCount?
No. Read the important note: https://sampwiki.blast.hk/wiki/GetTickCount
Well, if your server won't reach 24 days, then you can also use the GetTickCount, which results in the same, just make +2 to +2000 and gettime to GetTickCount, I personally prefer gettime, it returns the current timestamp, which lasts until 2038... http://en.wikipedia.org/wiki/Year_2038_problem xD


Re: I need a little help - xSkullx - 24.07.2012

Thanks..