Playing Hour System?
#1

How can I make a Playing hour System where the player levels up every hour

Thanks
Reply
#2

Something like this I guess:

pawn Код:
// under OnGameModeInit

SetTimer("LevelUp",3600000,1); // 60 minutes

// bottom of script

forward LevelUp(playerid);
public LevelUp(playerid)
{
    // use your variables / playerinfo information here like if(PlayerInfo[playerid][LoggedIn] == 1) etc..
   
    SendClientMessage(playerid,-1,"You've Played For An Hour!  Received +1 Score.");
    SetPlayerScore(playerid,GetPlayerScore(playerid) +1);

    return 1;
}
Reply
#3

Would this work with a GF Edit?
Reply
#4

Quote:
Originally Posted by seanny
Посмотреть сообщение
Would this work with a GF Edit?
You could always test it
Reply
#5

Could you make a tutorial on it that will work with GF Edits since I'm still n00b to Pawno
(make one in the Tutorials Section)
Reply
#6

Quote:
Originally Posted by grand.Theft.Otto
Посмотреть сообщение
Something like this I guess:

pawn Код:
// under OnGameModeInit

SetTimer("LevelUp",3600000,1); // 60 minutes

// bottom of script

forward LevelUp(playerid);
public LevelUp(playerid)
{
    // use your variables / playerinfo information here like if(PlayerInfo[playerid][LoggedIn] == 1) etc..
   
    SendClientMessage(playerid,-1,"You've Played For An Hour!  Received +1 Score.");
    SetPlayerScore(playerid,GetPlayerScore(playerid) +1);

    return 1;
}
That wouldn't work, and wouldn't be accurate.
1) Since variable 'playerid' isn't passed, it always will be 0.
2) If a player connects at 7:59, then at 8:00 he will receive +1 played hour, although he has been playing only for 1 minute.
3) Timer will execute 1 hour later after the server has been started, so if the server was turned on at 5:45, then the timer will execute at 6:45 (7:45, 8:45...), not 6:00 (7:00, 8:00...)
Reply
#7

Yeah, I thought that too Maclauwn :/
Reply
#8

Can someone make a tutorial on it?
Reply
#9

pawn Код:
SetTimer("Time", 60000, true); //gamemodeinit.
public Time()
{
    new hour, minute, second; // variables
    gettime(hour, minute, second); // current time
    foreach(Player, i) //loops through all the players
    {
        SetPlayerTime(i, hour, minute); //set game time.
        PlayerInfo[i][pTime]++; //+1 minute
        SetPlayerScore(i, floatround(CharInfo[i][cTime] / 60, floatround_floor)); // updating score (shows in hours)
    }
    return 1;
}
I use this, but it works on minutes, not hours.
Reply
#10

Does that system work like Player plays for 1 minute and levels up?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)