SA-MP Forums Archive
Time change depending on height. - 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: Time change depending on height. (/showthread.php?tid=511298)



Time change depending on height. - kevin1990 - 04.05.2014

Ok, So I want the time to change only for a certain player if he goes above a certain height. Otherwise I want to stay to the servers scripted time.

How do I Achieve this?


Re: Time change depending on height. - kevin1990 - 04.05.2014

EDIT****

I want it to be.. if they are greater then a certain height the time changes for that player.. Otherwise if they are lower then the certain height.. the time changes back


Re: Time change depending on height. - Luis- - 04.05.2014

What is wrong with using the edit button?


Re: Time change depending on height. - kevin1990 - 04.05.2014

I didnt want to change it if someone was already writing a response..


Re: Time change depending on height. - Marshall32 - 04.05.2014

I don't think thats possible since the time is like gravity, for all players same. You can anyway put a textdraw over the time and just set the time that way.


Re: Time change depending on height. - Nathan_Taylor - 04.05.2014

Quote:
Originally Posted by MrEdinLaw
Посмотреть сообщение
I don't think thats possible since the time is like gravity, for all players same. You can anyway put a textdraw over the time and just set the time that way.
You can set player time, https://sampwiki.blast.hk/wiki/SetPlayerTime.
What you would have to do is run a timer that checks for users if they are above that altitude or not, and have it change accordingly, One minute and i'll write one out and edit this post.

pawn Код:
forward heighttime();
 
public heighttime()
{
    new
        Float: heightchange = 100.00, //----------------This is the height at which the time change happens
        Float: pX,
        Float: pY,
        Float: pZ;

    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        GetPlayerPos(i, pX, pY, pZ);
       
        if(pZ >= heightchange){
            SetPlayerTime(i, 24, 00);   //--------------This is the time for if they are above the height line.
        } else {
            //get server time
            new
                cHour,
                cMinute;
            gettime(cHour, cMinute);
            SetPlayerTime(i, cHour, cMinute); //------------Set's player time to server time
        }

    }
}

public OnGameModeInit()
{
    SetTimer("heighttime", 5000, true); // Set a timer of 5000 miliseconds (5 seconds)
}
I'm not at a place currently to run this and test it, let me know if there are any bugs. Also, What do you mean by "Announcement" ? Is that a command you have?


Re: Time change depending on height. - kevin1990 - 04.05.2014

Thanks nathan, I would appreciate if you wrote one out... I just made one by looking at the setplayertime.. Problem is whenever I have a announcement it changes that players time back to the server time.


Re: Time change depending on height. - Abagail - 04.05.2014

Then when theres an announcement start the process all over again.


Re: Time change depending on height. - Nathan_Taylor - 04.05.2014

Incase you didn't see yet, I updated my post above.


Re: Time change depending on height. - kevin1990 - 04.05.2014

I sent you a PM nathan