Clock Synced, but need help
#1

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);
Reply
#2

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?
Reply
#3

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.
Reply
#4

Doh' I forgot that minutes were the hours. :P
Reply
#5

Quote:
Originally Posted by Baked-Banana
Doh' I forgot that minutes were the hours. :P
haha, thanks for the help bro.
Reply
#6

Np.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)