SA-MP Forums Archive
How to. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to. (/showthread.php?tid=65079)



How to. - JoeDaDude - 09.02.2009

Instead of stairs for my interior im using elevators.
How do i make it so if the lift is moving, And someone says,
/elevator 1st - To make it goto the 1st flooor,
So how do i make it so if someone says that command while the lift is moving,
The lift will continue moving but send the person the following message:
The lift is currently moving please wait.
So when someone says the command while its not moving, It will move,
But if its already moving, It wont, Like real elevators, I know this is possible,
I can remember seeing it somewhere


Re: How to. - SpiderPork - 09.02.2009

pawn Код:
// Defines
new LiftMoving;
new Lift;

// OnGameModeInit

Lift = CreateObject(blah, blah...);
LiftMoving == 0;

// OnPlayerCommandText

// The MoveObject and the whole command goes here.
if(LiftMoving == 1)
{
    SendClientMessage(playerid, COLOR_RED, "The lift is currently moving, please wait.");
}
else if(LiftMoving == 0)
{
    MoveObject(lift, coords, speed);
    LiftMoving == 1;
}

// OnObjectMoved

if(objectid = Lift)
{
    LiftMoving == 0;
    return 1;
}



Re: How to. - Donny_k - 09.02.2009

Quote:
Originally Posted by JoeDaDude
Instead of stairs for my interior im using elevators.
How do i make it so if the lift is moving, And someone says,
/elevator 1st - To make it goto the 1st flooor,
Use an array with the zcoords, cell zero being the ground floor and ascending upwards from this is each floors height:

pawn Код:
new
  Float:gElevatorFloors[ FLOORS_AMOUNT_HERE ] = { 3.0, 13.0, 23.0, 33.0, 43.0 /*and so on*/ };


//in the command (DCMD format)
MoveObject( ..................., gElevatorFloors[ strval( params ) ]..................... );
Something like that would work along with a few checks, IsNumeric, current floor (playerZ) etc.