Leveling System.
#1

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.
Reply
#2

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;
}
Reply
#3

How do I save this in the player enum info?
Reply
#4

Any help here please?
Reply
#5

show your enum

we cannot predict what your enum looks like.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)