Playing Hours for level up. -
RALL0 - 29.07.2013
Hey, I wonder how can I make it like that a player needs +8 hours to become level 2 and from there every time +1 hour added to the +8 for the next level. I tried something myself but it's not what I expected. So basicly to become level 2 they need 8 hours and for level 3 9[17] hours and so on.
Re: Playing Hours for level up. -
DonBonanno - 29.07.2013
Look in GM for : new levelexp = x; or levelup = x;
If you want 8 exp for levelup put :
new levelexp = 4;
If you want 6 exp for levelup put :
new levelexp = 3;
Re: Playing Hours for level up. -
RALL0 - 29.07.2013
I don't get it..
Re: Playing Hours for level up. -
MP2 - 29.07.2013
Score needed for level up: 7 + currentLevel.
Simple.
They become level 2 after 8 hours.
Level 3 after 9 hours more.
Level 4 after 10 hours more.
If you have 10 levels, it's going to take them 125 hours to level up to level 10.
Re: Playing Hours for level up. -
RALL0 - 29.07.2013
Mhm very smart, so something like this?
pawn Код:
new hoursneeded = PlayerInfo[playerid][pLevel] + 7;
if(PlayerInfo[playerid][pLevel] < hoursneeded) return SCM(playerid, COLOR_WHITE,"You need more hours");
PlayerInfo[playerid][pLevel] ++;
SetPlayerScore(playerid, PlayerInfo[playerid][pLevel];
return 1;
Re: Playing Hours for level up. -
Kitten - 29.07.2013
From what I understood try this.
pawn Код:
new sec[MAX_PLAYERS], min[MAX_PLAYERS], hour[MAX_PLAYERS], level[MAX_PLAYERS], playedtimer[MAX_PLAYERS];
forward CheckHour(playerid);
public OnPlayerConnect(playerid)
{
playedtimer[playerid] = SetTimerEx("CheckHour", 1000, 1, "i", playerid);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
KillTimer(playedtimer[playerid]);
return 1;
}
public CheckHour(playerid)
{
sec[playerid] ++;
if(sec[playerid] >= 60)
{
min[playerid] ++;
sec[playerid] = 0;
}
if(min[playerid] >= 60)
{
min[playerid] = 0;
switch(hour[playerid])
{
case 8: level[playerid] = 2;
case 9: level[playerid] = 3;
case 10: level[playerid] = 4; // And so on case 11: level[playerid] = 5; ...
}
hour[playerid] ++;
}
return 1;
}
Re: Playing Hours for level up. -
RALL0 - 29.07.2013
I got a playing hours system similar like yours but what I actually meant was to level up with playing hours.
Re: Playing Hours for level up. -
Kitten - 29.07.2013
Try something with the commands for example using from my code variables above your post. (using ZCMD)
pawn Код:
CMD:level2(playerid)
{
if(hour[playerid] >= 8) // if greater than 8 or equal to 8
{
hour[playerid] -= 8;
level[playerid] = 2;
}
else return SendClientMessage(playerid, -1, "Not enough hours.");
return 1;
}
Re: Playing Hours for level up. -
RALL0 - 29.07.2013
How can I make it all in 1 command so the system checks if the player got enough hours for level 3 and so on.
Like I mentioned, if a player is level 1 and it reaches 8 playing hours it can level up to the next level. Then they must get 9 hours so total playing hours must be 17, theb for the next level 10 hours and a total playing hours of 27 and so on.
Re: Playing Hours for level up. -
RALL0 - 29.07.2013
I solved it thanks for the help tho,

Here are the codes, working!
pawn Код:
CMD:nextlevel(playerid, params[])
{
new hoursneeded = PlayerInfo[playerid][pLevel]+7;
if(PlayerInfo[playerid][pHour] => hoursneeded)
{
PlayerInfo[playerid][pLevel] ++;
SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
}
else return SendClientMessage(playerid, COLOR_WHITE,"You need more hours to level up.");
return 1;
}