Playing hours = level
#1

Hello there,

Anyone that knows how I can make a system that gives people levels after playing x hours?

What I want exactly is:
Player played 4 hours and now it gives him a level automaticly.
Reply
#2

If your level system is already done, maybe you could do a cmd to check if the player can levelup. If he can, you level up him. Else you don.

And everyhour, you could maybe for every player, perform the cmd that check if he can level up.

I'm not sure of what I say, but maybe you could try it.
Reply
#3

Well I don't have any server but I'm making unknown scripts to improve myself in PAWN. I heard that a timer could work each hour it will give +1 and if it reaches 5 hours it will give you a level (SetPlayerScore).

If anyone is interested in helping me it would be greatly appreciated.
Contact on Skype also available: Aarabnordin
Reply
#4

Top of your script:
Код:
forward TimerMinute(playerid);
Under OnGamemode Init:
Код:
SetTimer("TimerMinute", 60000, true);
Код:
public TimerMinute(playerid)
{
     pInfo[playerid][MinutesPlayed] += 1;
	if(pInfo[playerid][Compte-minutes] == 60)
        {
                 pInfo[playerid][HeuresPlayed] += 1;
                 pInfo[playerid][MinutesPlayed] = 0;
       } 
       if(pInfo[playerid][HoursPlayed] == 5)
       {
               // Do what you want here    
           pInfo[playerid][HoursPlayed] = 0;
       }

}
I'm not sure of this. But maybe it will help you. Adapt it for your case if it's what you want.
Reply
#5

Following method will always give one level every four hours.

pawn Код:
new pHours[MAX_PLAYERS];
new pLevel[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    SetTimer("gainExperience", 3600000, true); // Set a timer of 3.6 million miliseconds (1 hour)
    return 1;
}

forward gainExperience(playerid);
public gainExperience(playerid)
{
    if(pHours[playerid] == 4)
    {
        pLevel[playerid] += 1;
        pHours[playerid] = 0; // Reset variable
        return 1;
    }
    pHours[playerid] += 1; // Give one hour
    return 1;
}
Reply
#6

Thanks for helping, both of you are repped.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)