[HELP] set Time
#1

Hello

i have problem in Time , is all night [ Time 21:00 ] +rep for any helped me.

Pwn Code:
pawn Код:
[B] //Timers


    gettime(ghour, gminute, gsecond);
    FixHour(ghour);
    ghour = shifthour;
    if(!realtime)
    {
        if(wtime >= 7 && wtime <= 20)
        {
            wtime = 21;
        }
        SetWorldTime(wtime);[/B]
pawn Код:
[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]
pawn Код:
[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]
and when i edit this code , is changed in time 12:00[ is stoped in 12:00]
pawn Код:
[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]
this edit i did
pawn Код:
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;
Reply
#2

You don't use any SetWorldTime in either of your "fixes".
Reply
#3

Quote:
Originally Posted by S4t3K
Посмотреть сообщение
You don't use any SetWorldTime in either of your "fixes".
is have it already ''SetWorlTime''
pawn Код:
new wtime = 15;
pawn Код:
gettime(ghour, gminute, gsecond);
    FixHour(ghour);
    ghour = shifthour;
    if(!realtime)
    {

        SetWorldTime(wtime);
    }
Reply
#4

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

Quote:
Originally Posted by S4t3K
Посмотреть сообщение
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.
i did ghour , and again 21:00

another code i find
pawn Код:
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);
    }
}
Reply
#6

bump!
Reply
#7

Well it is always 21 because there are in like every piece of code you posted
pawn Код:
if(hour >= 7 && hour <= 20)
{
    hour = 21;
}
Which will change the time to 21 if it is between 6 and 21

Just throw this code away and tell us what you want to do
If you just want to set the current time use this
pawn Код:
new
    hour, min, sec
;
gettime(hour, min, sec);
SetWorldTime(hour);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)