Problem with GettickCount
#1

PASTEBIN!

http://pastebin.com/d7dksXjU

Код:
format(str, sizeof(str), ">> [Anti-Spam] Wait %d seconds before talking again.", 
GetTickCount() - GetPVarInt(playerid, "iSpamInterval") / 1000);
// This is wrong.. send me for example.. wait 9282828 seconds.. ecc
Reply
#2

The problem is your maths skill

Thats your code
pawn Код:
GetTickCount() - GetPVarInt(playerid, "iSpamInterval") / 1000
Now I will use some numbers
pawn Код:
1005000 - 1002000 / 1000
1005000 - 1002
1003998
Just use brackets
pawn Код:
(GetTickCount() - GetPVarInt(playerid, "iSpamInterval")) / 1000
Also dont use PVar, they are more difficult to use and are slower than normal arrays
PVar are only useful for dynamic arrays
Reply
#3

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
The problem is your maths skill

Thats your code
pawn Код:
GetTickCount() - GetPVarInt(playerid, "iSpamInterval") / 1000
Now I will use some numbers
pawn Код:
1005000 - 1002000 / 1000
1005000 - 1002
1003998
Just use brackets
pawn Код:
(GetTickCount() - GetPVarInt(playerid, "iSpamInterval")) / 1000
Also dont use PVar, they are more difficult to use and are slower than normal arrays
PVar are only useful for dynamic arrays
pawn Код:
(GetTickCount() - GetPVarInt(playerid, "iSpamInterval")) / 1000
why send me message with -3, -2, -1... ?
Reply
#4

If you are using larger intervals (more than a few seconds) then I recommend using gettime() instead. This returns time in seconds so you don't have to divide at all.
Reply
#5

i use 3 seconds
Reply
#6

so ?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)