SA-MP Forums Archive
Clock 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)
+--- Thread: Clock problem (/showthread.php?tid=376664)



Clock problem - AwP_sTyLE - 11.09.2012

Hi!Im editing a roleplay gamemode and i have a problem.
The clock of the server.It's position its in the right corner from the up side.
The problem is that the hour that it shows it's not correct.
The real hour is 19(for exemple) and it show's 21-22.
I want to change the hour to the correct one but i don't know how.
I searched my script but i didn't found anything .


Re: Clock problem - Audiophr3ak - 11.09.2012

How the hell you think people help you without your code posted? LOL


Re: Clock problem - clarencecuzz - 11.09.2012

If you're using a Gamemode, use OnGameModeInit(), otherwise use OnFilterScriptInit()
This is your first code:
pawn Код:
public OnGameModeInit() //Or OnFilterScriptInit() if you're using a filterscript.
{
    SetTimer("RenewTime", 1000, true);
    return 1;
}
Place this at the bottom of your script. (Preferably)
pawn Код:
forward RenewTime();
public RenewTime()
{
    new hour, minute, second;
    gettime(hour, minute, second);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            SetPlayerTime(i, hour, minute);
        }
    }
    return 1;
}
I'm assuming this is what you're looking for, but I can't be too sure, because you haven't explained very well.


Re: Clock problem - AwP_sTyLE - 11.09.2012

Quote:
Originally Posted by clarencecuzz
Посмотреть сообщение
If you're using a Gamemode, use OnGameModeInit(), otherwise use OnFilterScriptInit()
This is your first code:
pawn Код:
public OnGameModeInit() //Or OnFilterScriptInit() if you're using a filterscript.
{
    SetTimer("RenewTime", 1000, true);
    return 1;
}
Place this at the bottom of your script. (Preferably)
pawn Код:
forward RenewTime();
public RenewTime()
{
    new hour, minute, second;
    gettime(hour, minute, second);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            SetPlayerTime(i, hour, minute);
        }
    }
    return 1;
}
I'm assuming this is what you're looking for, but I can't be too sure, because you haven't explained very well.
It worked !Thank you very much!


Re: Clock problem - AwP_sTyLE - 11.09.2012

Sorry for duble post but there is another problem ).
The server is hosted.
When i enter the server that i open in my pc(the server that is not hosted,i open it just to see if the changes that i make in the gm are working),the hour is correct.
When i'm entering the hosted server it's not correct.
I mention that i uploaded the gm from my pc to the host.
I think there's something to write in the script for the operation system because the host is on linux and i have windows.


Re: Clock problem - clarencecuzz - 11.09.2012

SA-MP's gettime function will get the time that is hosted from the server, which means it will be retrieving the time in from the hosting services timezone/setting. Example: Volt-Host is at 6:00pm, where you might be at 4:00am, so the gettime function will react differently.


Re: Clock problem - AwP_sTyLE - 11.09.2012

Ok.If that's the problem i'l talk to the host administrator to see if he can change the time ...
If he can't can u tell me how to delete the clock?


Re: Clock problem - clarencecuzz - 11.09.2012

pawn Код:
public OnPlayerConnect(playerid)
{
    TogglePlayerClock(playerid, 0);
    return 1;
}



Re: Clock problem - AwP_sTyLE - 11.09.2012

doesn't exist...


Re: Clock problem - clarencecuzz - 11.09.2012

Are you sure you have a_samp included? 0_o

If you do, what errors are you getting?