Payday problem. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Payday problem. (
/showthread.php?tid=156960)
Payday problem. -
oliverrud - 24.06.2010
Hey, thanks for reading. Anyways:
I'm now at the point of my script where I want to script the payday system however I just can't figure out how to make a "timer" that goes off like every 22:00, 23:00, 00:00, 01:00 By Real Life Time.
Anybody who can help me with this? I've been searching but haven't found anything that could help me.
Re: Payday problem. -
[HiC]TheKiller - 24.06.2010
If you clock is normal just get the variables from the clock. Otherwise create this timer
pawn Код:
SetTimer("1hourtimer", 1000*60*60, true);
Re: Payday problem. -
oliverrud - 24.06.2010
Quote:
Originally Posted by [HiC
TheKiller ]
If you clock is normal just get the variables from the clock. Otherwise create this timer
pawn Код:
SetTimer("1hourtimer", 1000*60*60, true);
|
Will this timer also work like for example: Server starts up at 14:20, will the 1hourtimer then set off at 15:00? (That's what I'm trying to do)
Re: Payday problem. -
Hiddos - 24.06.2010
Quote:
Originally Posted by oliverrud
Quote:
Originally Posted by [HiC
TheKiller ]
If you clock is normal just get the variables from the clock. Otherwise create this timer
pawn Код:
SetTimer("1hourtimer", 1000*60*60, true);
|
Will this timer also work like for example: Server starts up at 14:20, will the 1hourtimer then set off at 15:00? (That's what I'm trying to do)
|
Nope.
I'm unsure, but maybe you can use gettime()?
Re: Payday problem. -
oliverrud - 24.06.2010
Been thinking of that myself but I'm quite confused how to make it check it that way.
Re: Payday problem. -
Antonio [G-RP] - 24.06.2010
You can have it go directly on the hour.
Re: Payday problem. -
oliverrud - 24.06.2010
Mhm could you explain a bit more like give me some more information on how? I don't need all the code for it as I wish to learn, but I need some more help
Re: Payday problem. -
lavamike - 24.06.2010
You can do a 30 minute timer, and then gettime, if the hour is 15 (or whatever hour you want to give payday in)
however depending on when the server starts up, the minute could be anything and wouldn't be "on the dot"
maybe you would want to do a 1 minute timer, 2 minute, 5 minute etc. Your choice.
Re: Payday problem. -
oliverrud - 24.06.2010
I think I might got a idea with gettime(..) Gonna test it and if I get any errors that I can't fix then I will ask for help
Re: Payday problem. -
Despare - 25.06.2010
Here's something:
Код:
new paydaytimer;
forward PayUp();
forward PayTime();
OnGameModeInit:
Код:
paydaytimer = SetTimer("PayUp", 60000, 1);
Код:
public PayUp()
{
PayTime();
}
Код:
public PayTime()
{
new string[64];
new tmphour;
new tmpminute;
new tmpsecond;
gettime(tmphour, tmpminute, tmpsecond);
FixHour(tmphour);
tmphour = shifthour;
if ((tmphour > ghour) || (tmphour == 0 && ghour == 12))
{
format(string, sizeof(string), "SERVER: The time is now %d:00 hours",tmphour);
BroadCast(COLOR_WHITE,string);
ghour = tmphour;
PayDay();
if (realtime)
{
SetWorldTime(tmphour);
}
}
}
This is pretty much saying... If it's :00, then it gives paycheck. With a timer for 60 minutes, it will activate the paycheck time.