SA-MP Forums Archive
Integers calculator problem - 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: Integers calculator problem (/showthread.php?tid=578644)



Integers calculator problem - Adi007 - 21.06.2015

Hello, i have a small system which save how many seconds a player stayed online, like this:

OnPlayerConnect:
pInfo[playerid][ConnectedTime]=gettime();
Load his seconds from account in variable pInfo[playerid][TotalSecs] as integer.

//--------------------------------------------------------------------------

When save player's statistics:
new seconds = gettime() - pInfo[playerid][ConnectedTime] + pInfo[playerid][TotalSecs];
Save variable seconds in player's account as integer.

Sometimes the line above (from save statistics) is not working. It returns a number of seconds like gettime(). Is there a problem with the integers? It exceeds any limit calculation (difference/amount of numbers)?


Re: Integers calculator problem - X337 - 21.06.2015

It'll be much easier if you use NetStats_GetConnectedTime function.
https://sampwiki.blast.hk/wiki/NetStats_GetConnectedTime


Re: Integers calculator problem - Adi007 - 21.06.2015

Good, i havn't knew about this function. I'll try it. If the problem still appear, i'll reply here, thanks.


Sorry for low level english.