How to? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to? (
/showthread.php?tid=154040)
How to? -
ViruZZzZ_ChiLLL - 12.06.2010
I'm always confused and don't know where to start
on how to get the players total connect time :/
Re: How to? - TheInnocentOne - 12.06.2010
There's no native function for it, you must script it yourself.
The only way I can think of is to use a timer which adds +1 onto the time each second :\
Re: How to? -
(SF)Noobanatior - 12.06.2010
GetTickcount when the player connects and save it
GetTickcount when the player disconnects and save it
(disconect time) - (Connect time) = time online
then just convert ticks into seconds
pawn Код:
stock PlayerConnectTime(playerid) {
PlayerTime[playerid][tConnect] = GetTickCount();
}
stock PlayerDisconnectTime(playerid) {
PlayerTime[playerid][tDisconnect] = GetTickCount();
PlayerTime[playerid][tOnline] = floatdiv((PlayerTime[playerid][tDisconnect] - PlayerTime[playerid][tConnect]),6000);
PlayerTime[playerid][tTotal] += PlayerTime[playerid][tOnline];
}
this is how i do it
Re: How to? -
NiiRV4N4 - 12.06.2010
I have an idea, whenever a minute passes there score on the leaderboard goes up.