payday didn't work ... -
MrTinder - 03.04.2013
Hi.I have a problem with payday code now...I think i didn't have mistakes on the code but it doesn't work...Let's explain what code need to do:When the time is xx:00 who player is online to get +3 Exp.This is code:
pawn Код:
forward PayDay();
public PayDay()
{
new hh, mm, ss;
gettime( hh, mm, ss );
if(mm == 00)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
PlayerInfo[i][Exp] += 3;
}
}
return 1;
}
Re: payday didn't work ... -
L.Hudson - 03.04.2013
Did you add a
pawn Код:
SetTimer("PayDay", 60000, false);
in GameModeInit?
Re: payday didn't work ... -
MrTinder - 03.04.2013
Quote:
Originally Posted by L.Hudson
Did you add a
pawn Код:
SetTimer("PayDay", 60000, false);
in GameModeInit?
|
yes ...
Re: payday didn't work ... -
L.Hudson - 03.04.2013
pawn Код:
forward PayDay();
public PayDay()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
PlayerInfo[i][Exp] += 3;
}
return 1;
}
Try this since it will do it every 60 minutes of the player logged in time
The way you did it, you did add the timer, ok, but if the timer ends when the time isnt xx:00 it will not give a payday
Re: payday didn't work ... -
MrTinder - 03.04.2013
I wanna when it's xx:00 all players to get 3 Exp...
Edit:I fixed it
Re: payday didn't work ... -
L.Hudson - 03.04.2013
Well I tried telling a way to make it better, anyway now it's quite a proggress to make, firstly you'll have to delete the Timer of PayDay in OnGamemodeInit and create a new one called "PayTime" or whatever which will get the time every 1 second. Example:
pawn Код:
forward PayTime();
public PayTime()
{
new hh, mm, ss;
gettime(hh, mm, ss);
if(mm == 0)
{
PayDay();
}
return 1;
}
stock PayDay()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
PlayerInfo[i][Exp] += 3;
}
return 1;
}
And in OnGamemodeInit put
pawn Код:
SetTimer("PayTime", 1000, true);
Re: payday didn't work ... -
MrTinder - 03.04.2013
i fixed it
thanks for helping and rep+ for you
Re: payday didn't work ... -
HurtLocker - 03.04.2013
You can't expect your timer to be synced with the minutes change! If you want the player to receive his exp every time the server's minutes change this is what you do:
pawn Код:
public OnGameModeInit()
{
SetTimer("PayDay", 10, true);
}
forward PayDay();
public PayDay()
{
new hh, mm, ss;
gettime( hh, mm, ss );
if(mm == 00)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
PlayerInfo[i][Exp] += 3;
}
}
return 1;
}
EDIT: TOO LATE.