Playing Hour System? -
seanny - 20.10.2011
How can I make a Playing hour System where the player levels up every hour
Thanks
Re: Playing Hour System? -
grand.Theft.Otto - 20.10.2011
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;
}
Re: Playing Hour System? -
seanny - 20.10.2011
Would this work with a GF Edit?
Re: Playing Hour System? -
Stigg - 20.10.2011
Quote:
Originally Posted by seanny
Would this work with a GF Edit?
|
You could always test it
Re: Playing Hour System? -
seanny - 20.10.2011
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)
Re: Playing Hour System? -
Macluawn - 20.10.2011
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...)
Re: Playing Hour System? -
grand.Theft.Otto - 20.10.2011
Yeah, I thought that too Maclauwn :/
Re: Playing Hour System? -
seanny - 20.10.2011
Can someone make a tutorial on it?
Re: Playing Hour System? -
Macluawn - 20.10.2011
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.
Re: Playing Hour System? -
seanny - 20.10.2011
Does that system work like Player plays for 1 minute and levels up?