Creating an elevator in 5 minutes in SAMP
- Digital display
- Call queue
- Compatibility
mdialog
,y_hooks
Include in your code and begin using the library:
#include <elevator-plus>
public OnGameModeInit()
{
// Create an elevator
CreateElevator("ls_beach_building", 287.942504, -1609.334838, 33.827411, 0.0, 0.0, 80.0);
// Create a floor
CreateElevatorFloor("ls_beach_building", 284.8362,-1611.4973,17.8593, 0.0);
CreateElevatorFloor("ls_beach_building", 284.8362,-1611.4973,32.9621, 0.0);
CreateElevatorFloor("ls_beach_building", 284.8362,-1611.4973,47.0014, 0.0);
CreateElevatorFloor("ls_beach_building", 284.8362,-1611.4973,51.5025, 0.0);
CreateElevatorFloor("ls_beach_building", 284.8362,-1611.4973,56.0036, 0.0);
CreateElevatorFloor("ls_beach_building", 284.8362,-1611.4973,60.5047, 0.0);
CreateElevatorFloor("ls_beach_building", 284.8362,-1611.4973,65.0058, 0.0);
CreateElevatorFloor("ls_beach_building", 284.8362,-1611.4973,69.5069, 0.0);
CreateElevatorFloor("ls_beach_building", 284.8362,-1611.4973,73.9923, 0.0);
CreateElevatorFloor("ls_beach_building", 284.8362,-1611.4973,78.4934, 0.0);
CreateElevatorFloor("ls_beach_building", 284.8362,-1611.4973,82.9945, 0.0);
CreateElevatorFloor("ls_beach_building", 284.8362,-1611.4973,87.4956, 0.0);
CreateElevatorFloor("ls_beach_building", 284.8362,-1611.4973,91.9967, 0.0);
CreateElevatorFloor("ls_beach_building", 284.8362,-1611.4973,96.4978, 0.0);
// Move the elevator to a floor
SetElevatorFloor("ls_beach_building", 1);
return 1;
}
Create an elevator
elevator_name[]
- Elevator nameFloat:x
- The x coordinate to create the objectFloat:y
- The y coordinate to create the objectFloat:z
- The z coordinate to create the objectFloat:rx
- The rx rotation of the objectFloat:ry
- The ry rotation of the objectFloat:rz
- The rz rotation of the object
CreateElevatorFloor(const elevator_name[], Float:x, Float:y, Float:z, Float:door_height = 0.0, const text_dialog[] = "", const text_digital_display[] = "")
Create a floor with a call button
elevator_name[]
- Elevator nameFloat:x
- The x coordinateFloat:y
- The y coordinateFloat:z
- The z coordinateFloat:door_height
- Door heighttext_dialog[]
- Name in the list of floorstext_digital_display[]
- Displays the floor number
Move the elevator to a floor
elevator_name[]
- Elevator namefloor
- Floor number
Get the elevator object id
elevator_name[]
- Elevator name&cabin_id
- Elevator cab id&doorL_id
- Left door id&doorR_id
- Right door id&digital_display_id
- Digital display idNote
- CreateObject is used
Get the ID of the floor doors object
elevator_name[]
- Elevator namefloor
- Floor number&doorL_id
- Left door id&doorR_id
- Right door idNote
- CreateDynamicObject is used
Called when moving to a floor
elevator_name[]
- Elevator nameold_floor
- Old floornew_floor
- New floor
Called when the elevator arrives
elevator_name[]
- Elevator namefloor
- Floor number
#define ELEVATOR_MAX_ELEVATOR 10
#define ELEVATOR_MAX_FLOORS 30
#define ELEVATOR_MAX_NAME_LENGTH 32
#define ELEVATOR_DOORS_SPEED 3.0 // movement speed of the doors
#define ELEVATOR_SPEED 3.0 // movement speed of the elevator
#define ELEVATOR_UPDATE_TIMER 900
#define ELEVATOR_DOOR_CLOSING_TIME 8000 // milliseconds
#define ELEVATOR_OBJECT_DISTANCE 100.0
#define ELEVATOR_ENABLE_DIGITAL_DISPLAY
#define ELEVATOR_DIALOG_ID 27303
static ELEVATOR_CABIN_TEXT[] = "{CCCCCC}~k~~SNEAK_ABOUT~";
static ELEVATOR_FLOOR_TEXT[] = "Call the elevator\n{CCCCCC}~k~~SNEAK_ABOUT~{FFFFFF}";
static ELEVATOR_FLOOR_IN_DIALOG_TEXT[] = "Floor %d";
static ELEVATOR_TEXT_COMING_TO_YOU[] = "{AFAFAF}Already coming to you";
static ELEVATOR_TEXT_ALREADY_IN_QUEUE[] = "{AFAFAF}The floor is already in the queue";
static ELEVATOR_TEXT_CALLED[] = "Elevator called";
static ELEVATOR_FLOOR_COLOR_NOW[] = "{65cd38}";