Elevator script
🚪 Vespucci Elevators System
Overview
The Vespucci Elevator System (cfx_gn_vespucci_elevator_script) allows players to use elevators seamlessly without teleportation.
The system automatically configures itself on startup and integrates perfectly with interaction frameworks.
⚙️ Setup
Start the resource:
ensure cfx_gn_vespucci_elevator_scriptThat’s it — everything is configured automatically. If you prefer teleportation-based elevators, simply do not start this resource.
🧭 Teleportation vs. Physical Elevators
Non-Teleportation (default)
Elevators move physically without teleporting the player.
Start the cfx_gn_vespucci_elevator_script resource.
Teleportation
The classic mode where players are instantly teleported between floors.
Do not start the resource; manage entitysets manually.
Please note you can disable the whole interaction by setting true to Elevator.Config.DisableInteraction in the config file of the elevator script. You will need to enable the static elevator.
How to enable static elevator?
In `cfx_gn_vespucci_pd`, you can enable the entities missing in the `Config.lua` by setting true to Config.StaticElevators.
🧩 Interaction Integration Example
You can register your own interactions with elevators by using the built-in exports from gn_elevator.
🔐 Access Control
You can restrict or allow access to be call from specific floors per player.
CanPlayerAccessFloor(elevatorId, floorIndex)
Returns whether a player has permission to go to the specified floor.
SetPlayerAccessFloor(elevatorId, floorIndex, canAccess)
Grants or removes access to a floor for the current player.
📦 Exported Functions
Below is the complete list of available exports for integration with other scripts.
OpenElevatorKeypad()
none
–
Opens the keypad UI inside an elevator.
CallElevator()
none
–
Calls the elevator to the current floor.
GetElevatorCurrentFloor(elevatorId)
string elevatorId
number floorIndex
Gets the current floor of a specific elevator.
IsInElevator(elevatorId)
string elevatorId
boolean
Returns whether the player is currently in a given elevator.
IsInAnyElevator()
none
boolean
Returns true if the player is in any elevator.
SetElevatorInteractionEnabled(enabled)
boolean enabled
–
Enables or disables all elevator interaction.
🧠 Notes
The system dynamically links to the main
cfx_gn_vespucci_elevator_scriptresource.Each elevator’s floor and model information is automatically discovered.
Interactions can be safely added or removed at runtime.
Access control allows complex logic (e.g. jobs, keycards, staff, etc.).
Last updated