SA-MP Forums Archive
Problem with GettickCount - 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: Problem with GettickCount (/showthread.php?tid=430560)



Problem with GettickCount - NewbieScripter - 14.04.2013

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


AW: Problem with GettickCount - Nero_3D - 14.04.2013

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


Re: AW: Problem with GettickCount - NewbieScripter - 14.04.2013

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... ?


Re: Problem with GettickCount - Vince - 14.04.2013

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.


Re: Problem with GettickCount - NewbieScripter - 14.04.2013

i use 3 seconds


Re: Problem with GettickCount - NewbieScripter - 14.04.2013

so ?