lil question - 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: lil question (
/showthread.php?tid=243203)
lil question -
tanush - 21.03.2011
how can i make levels with time for example, 1hour game play = level 1, 5 hour game play = level 2, blah blah?
Re: lil question -
Mauzen - 22.03.2011
In short: Create a timer for every player in OnPlayerConnect that counts how long the player was online at all (You also want to save that time i guess). Every time the timer function is called, check if the onlinetime of the player is bigger than your level limit. If it is, level the player up as you like (Messages, scores, whatever)
Re: lil question -
Marricio - 22.03.2011
pawn Код:
new Level[MAX_PLAYERS];
new Hours[MAX_PLAYERS];
forward H(playerid)
public OnPlayerConnect(playerid)
{
SetTimerEx("H",60*60*1000,true,"i",playerid);
return 1;
}
public H(playerid)
{
Hours[playerid]++;
if(Hours[playerid] == 1)
{
SendClientMessage(playerid,COLOR,"You're now lvl 1!");
Level[playerid]= 1;
}
else if(Hours[playerid] == 5)
{
SendClientMessage(playerid,COLOR,"You're now lvl 2!");
Level[playerid]=2;
}
return 1;
}
Not tested
Re: lil question -
tanush - 22.03.2011
wat is 60*60*1000?? isnt it suppose to be like 600000,
Re: lil question -
tanush - 22.03.2011
Sorry for double post, how can i add minutes?
Re: lil question -
tanush - 22.03.2011
lil help please?
Re: lil question -
Tee - 22.03.2011
Quote:
Originally Posted by tanush
wat is 60*60*1000?? isnt it suppose to be like 600000,
|
Real Life that would be equal to 60x60x100 which would be equal to 3600000.
Re: lil question -
tanush - 22.03.2011
Tee can you help me with minutes pls
Re: lil question -
Tee - 22.03.2011
What help do you want?
Re: lil question -
PinkFloydLover - 22.03.2011
pawn Код:
New Minutes[MAX_PLAYERS];
New Hours[MAX_PLAYERS];
forward OnlineTimer(playerid);
SetTimerEx("OnlineTimer",60000,1,"i",playerid);
public OnlineTimer(playerid)
{
Minutes[playerid]++;
if(Minutes[playerid] == 60)
{
Hours[playerid]++;
Minutes[playerid] = 0;
}
return 1;
}
also remember to stop the timer when the player goes offline