Leveling system only working for 1 person, and bad.
#1

Hello, i tried to make my own leveling system, but it is kinda bugged. It doesn't work for everyplayer when more than one is online, and sometimes it takes less than 60 seconds to pass 1 minute..

Here is the code:

pawn Код:
Under OnPlayerConnect i have:

SetTimer("PlayingTime", 60000, true);

Than the function is:

forward PlayingTime(playerid);
public PlayingTime(playerid)
{
    new Name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Name, sizeof(Name));
    PlayerInfo[playerid][PlayingMinutes]++;
    if(PlayerInfo[playerid][PlayingMinutes] >= 60)
    {
        PlayerInfo[playerid][PlayingHours]++;
        PlayerInfo[playerid][RespectPoints]++;
        PlayerInfo[playerid][PlayingMinutes] = 0;
        format(file, sizeof(file), "RRP/users/%s.ini", Name);
        if(fexist(file))
        {
            dini_IntSet(file, "PlayingHours", PlayerInfo[playerid][PlayingHours]);
            dini_IntSet(file, "RespectPoints", PlayerInfo[playerid][RespectPoints]);
            dini_IntSet(file, "PlayingMinutes", PlayerInfo[playerid][PlayingMinutes]);
        }
        return 1;
    }
    format(file, sizeof(file), "RRP/users/%s.ini", Name);
    if(fexist(file))
    {
        dini_IntSet(file, "PlayingMinutes", PlayerInfo[playerid][PlayingMinutes]);
    }
    return 1;
}
Thanks. I am really bad with timers.. :S
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)