SA-MP Forums Archive
Please i need time scoring-1h=>1 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: Please i need time scoring-1h=>1 score (/showthread.php?tid=145321)



Please i need time scoring-1h=>1 score - Elmin - 01.05.2010

If someone know the code for time played in server.
Something like this:
Player should get one score for one hour playing

please help thanks...


Re: Please i need time scoring-1h=>1 score - Gamer007 - 01.05.2010

pawn Код:
new OnlineTimer[MAX_PLAYERS];
enum pinfo
{
    MinutesPlayed,
    HoursPlayed
}
new PInfo[MAX_PLAYERS][pinfo];

onplayerconnect:

OnlineTimer[playerid] = SetTimerEx("OnlineTimeUpdate", 60000, 1, "i", playerid);


forward OnlineTimeUpdate(playerid);
public OnlineTimeUpdate(playerid)
{
PInfo[playerid][MinutesPlayed] ++;
if(PInfo[playerid][MinutesPlayed] == 60)
{
PInfo[playerid][HoursPlayed] ++;
GivePlayerScore(playerid,GetPlayerScore(playerid)+1);
PInfo[playerid][MinutesPlayed] = 0;
}
}



Re: Please i need time scoring-1h=>1 score - geerdinho8 - 01.05.2010

https://sampwiki.blast.hk/wiki/SetTimer


Re: Please i need time scoring-1h=>1 score - Backwardsman97 - 01.05.2010

I bet you could make a time played system without timers. Maybe you just stored what time it was when they joined and then added that to the current time when they left.


Re: Please i need time scoring-1h=>1 score - [DRD]Rodney - 01.05.2010

Then it wouldnt update unless ur leaving every hour


Re: Please i need time scoring-1h=>1 score - Elmin - 01.05.2010

Thanks u are the best
i got one error on GivePlayerScore, but i just replaced it with SetPlayerScore and now is without errors..
thanks. :P



Re: Please i need time scoring-1h=>1 score - dcmd_crash - 01.05.2010

Why don't you just do:

Under OnPlayerConnect
pawn Код:
SetPlayerScore(playerid, 0)
Then, create a function:

pawn Код:
forward AddToScore(playerid);
public AddToScore(playerid)
{
  SetPlayerScore(playerid, GetPlayerScore(playerid)+1);
  return 1
}
and set it on a timer when the player joins in OnPlayerConnect:
pawn Код:
SetTimerEx("AddToScore", 60000, 1, "i", playerid);
Simples?

EDIT: Had a typo, it's good now.


Re: Please i need time scoring-1h=>1 score - geerdinho8 - 01.05.2010

Dont confuse him, it works now..


Re: Please i need time scoring-1h=>1 score - Elmin - 01.05.2010

yee u right thats more simple
but thanks i will try all


Re: Please i need time scoring-1h=>1 score - dcmd_crash - 01.05.2010

Quote:
Originally Posted by Lamano
Dont confuse him, it works now..
It's not confusing .. it's simple(er)

Better off with a simple and less resource using option than the one with variables he doesn't need.