23.12.2009, 14:30
much easier way with just one command:
pawn Код:
new elevator; // the is to create the elevator object.
new elevstatus; // checks if the elevator is up or down
//time to create the object, under OnGameModeInit() or OnFilterScriptInit()
elevator = CreateObject(ID, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ); // X, Y & Z is the location of the gate, height etc rX, rY, rZ is the rotation
//now lets create the command.
if (strcmp("/elevator", cmdtext, true) == 0)
{
if(elevstatus == 0)
{
MoveObject(elevator, X-COORDS, Y-COORDS, Z-COORDS, SPEED); // Put your cords in here normally the speed is >1 and 10< but put what you want oh and where says elevator put what is in your new
SendClientMessage(playerid, COLOR_RED, "You are now going up, Please Wait."); // You dont alwas have to put this in, delete if wanted.
elevstatus = 1; // changes the variable to 1 to allow the elevator back down
}
else if(elevstatus != 0)
{
MoveObject(elevator, X-COORDS, Y-COORDS, Z-COORDS, SPEED); // Same deal as before
SendClientMessage(playerid, COLOR_RED, "The Elevator is now comming, Please Wait."); // Same deal as before
elevstatus = 0; // this lowers the elevator and then changes it back to 0 so it can go up.
}
return 1;
}