Scripting an elevator in a carrier
#1

Hello,

I would like to have an elevator sripted in a carrier I just mapped, but could someone please give me what to state where, under which callback, and also what all co-ordinates do, I need a full explaination of that so I can do it myself next time. An example with some comments will do it. And I would like to make it with IsPlayerInRangeOfPoint, because I only want people to use the elevator when they're near or on it.

Thanks in advance.
Reply
#2

It can be made in different ways showing you an entire explanation would be very much work.
but basicly its not that hard to make.

you will need the function called 'MoveObject'
you need the exact coordinates of the object/elevator when its down and when its up
best way to do that is create the objects at the place where there suppose to go first.

if you have done that you can test it with a command; for example , you have the command 'move' and MoveObject will be called.
Try this all out and see what happens
Reply
#3

Yes, but I just need an example of how the script works. That shows me a lot, you see. Just the part what makes the command work and what makes the object move, and what causes it to be only able to use when being near it?
Reply
#4

well heres a part of the wiki wich i modified to your interests;
new obj; // Somewhere at the top of your script

Код:
new Ellevator;
public OnGameModeInit()
{
    Ellevator = CreateObject(980, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
    return 1;
}
 
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/move", true) == 0)
    {
        MoveObject(Ellevator,x,y,z,speed);// (x,y,z coordinates where you want to object to move to, and speed how fast it moves)
        return 1;
    }
    return 0;
}
the Isplayerinrangeofpoint part should look something like this;
Код:
if(IsPlayerInRangeOfPoint(playerid, 7.0, x,y,z))//7.0 is the range from the point x,y,z the coordinates of the elevator object
{
MoveObject(Ellevator,x,y,z,speed);// (x,y,z coordinates where you want to object to move to, and speed how fast it moves)
}
the isplayerinrangeofpoint could be added under a command or timer that checks the range where you are..i prefer the command.
I suggest you try this out part by part copy and pasting this would fail big time

here are some recourses;
https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint
https://sampwiki.blast.hk/wiki/MoveObject
https://sampwiki.blast.hk/wiki/OnObjectMoved

you could add moveobject under objectmoved callback so the ellevator would move any time
good luck
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)