I need a little help
#1

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;
	}
Reply
#2

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.
Reply
#3

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?
Reply
#4

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
Reply
#5

Thanks..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)