Help me 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: Help me with GetTickCount() (
/showthread.php?tid=281044)
Help me with GetTickCount() -
[00]Luis - 04.09.2011
Hello, I'm learning pawn, and i'm using GetTickCount(), but, i have an error D:
Error:
Код:
C:\Documents and Settings\Freeman\Escritorio\Pawn\filterscripts\Xion.pwn(27) : error 076: syntax error in the expression, or invalid function call
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
pawn Код:
new Ref;
public OnPlayerDeath(playerid, killerid, reason)
{
Ref = GetTickCount();
return 1;
}
public OnPlayerSpawn(playerid)
{
new string[70];
format(string, sizeof(string), "You lasted %f seconds to appear after the death!", floatdiv(GetTickCount - Ref, 1000));
SendClientMessage(playerid, COLOR_GREEN, string);
return 1;
}
I would appreciate any help
Regards,
Q.
Re: Help me with GetTickCount() -
BlackWolf120 - 04.09.2011
use GetTickCount like this:
pawn Код:
format(string, sizeof(string), "You lasted %f seconds to appear after the death!", floatdiv(GetTickCount() - Ref, 1000));
Respuesta: Re: Help me with GetTickCount() -
[00]Luis - 04.09.2011
Quote:
Originally Posted by BlackWolf120
use GetTickCount like this:
pawn Код:
format(string, sizeof(string), "You lasted %f seconds to appear after the death!", floatdiv(GetTickCount() - Ref, 1000));
|
It works, Thanks You!!
Regards
Q.
Re: Help me with GetTickCount() -
BlackWolf120 - 04.09.2011
np
Re: Help me with GetTickCount() -
JaTochNietDan - 04.09.2011
Why do you use floatdiv? We're dealing with integers here, not floats. Look at my example:
pawn Код:
format(string, sizeof(string), "You lasted %i seconds to appear after the death!", (GetTickCount() - Ref)/1000);
If you're dealing with integers then there's no reason you should be using float functions
Respuesta: Re: Help me with GetTickCount() -
[00]Luis - 04.09.2011
Quote:
Originally Posted by JaTochNietDan
Why do you use floatdiv? We're dealing with integers here, not floats. Look at my example:
pawn Код:
format(string, sizeof(string), "You lasted %i seconds to appear after the death!", (GetTickCount() - Ref)/1000);
If you're dealing with integers then there's no reason you should be using float functions 
|
Oh, Thanks You!