Clock Synced, but need help - 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: Clock Synced, but need help (
/showthread.php?tid=147193)
Clock Synced, but need help -
MWF2 - 10.05.2010
My clock is now synced thanks to code i found on the forums. Now, the issue is, how can i detect if it's between 8:00 and 21:00 the bank is open, but if it's from any other time outside within 8:00 and 21:00 the bank is closed?
Here is my time code:
pawn Код:
SetTimer("ClockSync", 1000, 1);
pawn Код:
forward ClockSync();
public ClockSync()
{
Second++;
if(Second == 60)
{
Minute++;
Second = 0;
}
if(Minute >= 24) Minute = 0;
for(new i; i<GetMaxPlayers(); i++) SetPlayerTime(i, Minute, Second);
new string[64];
format(string, sizeof(string), "The time [%d] [%d]", Minute, Second);
return 1;
}
pawn Код:
TogglePlayerClock(playerid, 1);
Re: Clock Synced, but need help -
Backwardsman97 - 10.05.2010
Just do.
pawn Код:
if(Minute > 8 && Minute < 21)
{
//The bank is open
}
else
{
//The bank is closed
}
Also, why do the minutes reset after 24?
Re: Clock Synced, but need help -
MWF2 - 10.05.2010
Quote:
Originally Posted by Baked-Banana
Just do.
pawn Код:
if(Minute > 8 && Minute < 21) { //The bank is open } else { //The bank is closed }
Also, why do the minutes reset after 24?
|
Thanks Baked-Banana,
I want the minutes to end at 24 because i want it to be like IG hour. So at 24 it's like dark weather, etc.
Re: Clock Synced, but need help -
Backwardsman97 - 10.05.2010
Doh' I forgot that minutes were the hours. :P
Re: Clock Synced, but need help -
MWF2 - 10.05.2010
Quote:
Originally Posted by Baked-Banana
Doh' I forgot that minutes were the hours. :P
|
haha, thanks for the help bro.
Re: Clock Synced, but need help -
Backwardsman97 - 10.05.2010
Np.