[B] //Timers
gettime(ghour, gminute, gsecond);
FixHour(ghour);
ghour = shifthour;
if(!realtime)
{
if(wtime >= 7 && wtime <= 20)
{
wtime = 21;
}
SetWorldTime(wtime);[/B]
[B] if (realtime)
{
new tmphour;
new tmpminute;
new tmpsecond;
gettime(tmphour, tmpminute, tmpsecond);
FixHour(tmphour);
tmphour = shifthour;
if(tmphour >= 7 && tmphour <= 20)
{
tmphour = 21;
}
SetWorldTime(tmphour);
}[/B]
[B]public SyncTime()
{
new string[64];
new tmphour;
new tmpminute;
new tmpsecond;
gettime(tmphour, tmpminute, tmpsecond);
FixHour(tmphour);
tmphour = shifthour;
if ((tmphour > ghour) || (tmphour == 0 && ghour == 23))[/B]
[B]public FixHour(hour)
{
hour = timeshift+hour;
if (hour < 0)
{
hour = hour+24;
}
if (hour > 23)
{
hour = hour-24;
}
if(hour >= 7 && hour <= 20)
{
hour = 21;
}
shifthour = hour;
return 1;[/B]
public FixHour(hour)
{
hour = timeshift+hour;
if (hour < 0)
{
hour = hour+24;
}
if (hour > 23)
{
hour = hour-24;
}
if(hour >= 7 && hour <= 24)
shifthour = hour;
return 1;
You don't use any SetWorldTime in either of your "fixes".
|
new wtime = 15;
gettime(ghour, gminute, gsecond);
FixHour(ghour);
ghour = shifthour;
if(!realtime)
{
SetWorldTime(wtime);
}
Sorry, haven't seen.
But do you know your "FixHour" function is totaly useless ? Or at least, what it does is never used again in your code. You "fix" ghour but you use wtime with the value "21" in the SetWorldTime, use ghour instead of wtime and try to see. |
public SyncTime()
{
new string[64];
new tmphour;
new tmpminute;
new tmpsecond;
gettime(tmphour, tmpminute, tmpsecond);
FixHour(tmphour);
tmphour = shifthour;
if ((tmphour > ghour) || (tmphour == 0 && ghour == 23))
{
format(string, sizeof(string), "SERVER: The time is now %d:00 ",tmphour+1);
BroadCast(COLOR_WHITE,string);
ghour = tmphour;
if (realtime)
{
if(tmphour >= 7 && tmphour <= 20)
{
tmphour = 21;
}
SetWorldTime(tmphour);
}
//SetTimer("Paintball",120000,0);
}
}
if(hour >= 7 && hour <= 20)
{
hour = 21;
}
new
hour, min, sec
;
gettime(hour, min, sec);
SetWorldTime(hour);