Help me with GetTickCount()
#1

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

use GetTickCount like this:

pawn Код:
format(string, sizeof(string), "You lasted %f seconds to appear after the death!", floatdiv(GetTickCount() - Ref, 1000));
Reply
#3

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

np
Reply
#5

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

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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)