Time change depending on height.
#1

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

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

What is wrong with using the edit button?
Reply
#4

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

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

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

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

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

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

I sent you a PM nathan
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)