Leveling System. - 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)
+--- Thread: Leveling System. (
/showthread.php?tid=326725)
Leveling System. - Nicholas. - 18.03.2012
Hello SA:MP Community.
Today, I am making a leveling system in my script. What I want is for every hour a player spends on the server their will be appointed 1 score every hour. Also I will like it to save the time spent on server on log so when the player reconnects it continues instead of starting over. I have never done something like this before and I am needing some help please. I am using the Y_INI saving system.
Regards,
Nicholas.
Re: Leveling System. -
Tanush123 - 18.03.2012
Well i don't know how to really use y_INI, but for hours you have to do this.
On top add this
pawn Код:
new OnlineTimer[MAX_PLAYERS],Hours[MAX_PLAYERS],Minutes[MAX_PLAYERS]
Under your login function, add this
pawn Код:
OnlineTimer[playerid] = SetTimerEx("OnlineTimeUpdate", 60000, 1, "i", playerid);
Under OnPlayerDisconnect, add this
pawn Код:
KillTimer(OnlineTimer[playerid]);
Under your script add this
pawn Код:
forward OnlineTimeUpdate(playerid);
public OnlineTimeUpdate(playerid)
{
Minutes[playerid] ++;
if(Minutes[playerid] == 60)
{
Hours[playerid] ++;
Minutes[playerid] = 0;
SetPlayerScore(playerid,GetPlayerScore(playerid)+1);
}
return 1;
}
Re: Leveling System. - Nicholas. - 18.03.2012
How do I save this in the player enum info?
Re: Leveling System. - Nicholas. - 18.03.2012
Any help here please?
Re: Leveling System. -
Jonny5 - 18.03.2012
show your enum
we cannot predict what your enum looks like.