Total Hours On Server = Player Score - 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: Total Hours On Server = Player Score (
/showthread.php?tid=64688)
Total Hours On Server = Player Score -
stieben - 06.02.2009
I tried it in several ways, but I don't know how to get it to work
Please help me !
Re: Total Hours On Server = Player Score -
MenaceX^ - 06.02.2009
Hmhm, You can do it like the paydays system on GF.
Every our the player gets a payday. It saves onto /stats command with his currently paydays ammount.
Re: Total Hours On Server = Player Score -
stieben - 06.02.2009
okay, but how to do that?
Re: Total Hours On Server = Player Score -
1337pr0 - 06.02.2009
example:
pawn Код:
new PlayTime[MAX_PLAYERS];
public OnGameModeInit()
{
SetTimer("TimeUpdate",1000, 1);
}
public OnPlayerConnect(playerid)
{
PlayTime[playerid] = 0;
// load previous time stats somehow, not my problem :)
}
public OnPlayerDisconnect(playerid, reason)
{
// save previous time stats somehow, also not my problem :)
}
public TimeUpdate()
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
PlayTime[i]++;
if (PlayTime[i] > 3600)
SetPlayerScore(i, ((PlayTime[i] / 60) / 60));
else
SetPlayerScore(i, 0);
}
}
}
It's best to change MAX_PLAYERS to your own variable, I won't explain why, because many other people have done so before, and you can get at it by searching.
Re: Total Hours On Server = Player Score -
stieben - 06.02.2009
thanks I will try it
Re: Total Hours On Server = Player Score -
1337pr0 - 06.02.2009
just updated it, re-copy
Re: Total Hours On Server = Player Score -
stieben - 06.02.2009
ty