Integers calculator problem
#1

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)?
Reply
#2

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)