26.12.2014, 16:46
https://sampwiki.blast.hk/wiki/GetTickCount
Example:
Otherwise, you can use unix timestamps which are probably better in this situation, as GetTickCount can cause issues if the server is up for longer than 24 hours. To use unix timestamps, just replace 'GetTickCount()' with 'gettime()'.
https://sampwiki.blast.hk/wiki/Gettime
Example:
pawn Код:
new ReactionStart; //At the top of your script
//When reaction test starts...
ReactionStart = GetTickCount(); //Gets the current time in milliseconds of the server uptime
//When a player gets the correct answer...
new string[100], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name)); //Store the player's name
format(string, sizeof(string), "%s(%d) guessed the answer to the reaction test in %d milliseconds.", name, playerid, (GetTickCount() - ReactionStart));
//GetTickCount() - ReactionStart will get the difference between the start of the reaction test, and the answer being guessed.
SendClientMessageToAll(-1, string);
https://sampwiki.blast.hk/wiki/Gettime