[Release] [Free] Elevator Script for ESX & QBCore

Update pushed to GitHub, but requires testing. Please let me know if it works.

You can set item (string) with the name of an item, which will bypass any required jobs that are listed. If you set an item and you also add jobAndItem = true then it will require you to have a listed job AND the item listed. Config helper comments have been updated to assist.

2 Likes

Haven’t tried it out but this update will be game changing for me thank you!

When I open the floor menu the floor I aim at doesn’t get a color like in the preview and I can’t teleport.

That video preview was made by a user, not the developers, so it contains a restyled nh-context menu. That is why it will look different.

As for not teleporting, please provide us with any errors in your F8 Console when you click on the option to teleport. It works for others so not sure why it’s not working for you, but we can’t help without more information.

This is my problem I don’t get any errors.

Try removing any requirements from the config you are using.
What I mean is, make sure there are no jobs set and no item set. So it’s open to the public.
This will help us see if the buttons are being disabled for you, or if the problem is something else.
Maybe even provide us with your config file.

Config = {}

Config.UseESX = true – Use ESX Framework
Config.UseQBCore = false – Use QBCore Framework (Ignored if Config.UseESX = true)

Config.UseMythicNotify = false – Use mythic_notify (Requires mythic_notify script)

–[[
USAGE

To add an elevator, copy the table below and configure as needed:
	coords = vector3 coords of center of elevator
	heading = Direction facing out of the elevator
	level = What floor are they going to
	label = What is on that floor
	jobs = OPTIONAL: Table of job keys that are allowed to access that floor and value of minimum grade of each job
	item = OPTIONAL: Any item that is required to access that floor (bypasses job)
	jobAndItem = OPTIONAL: Must you have a required job AND item?

]]

–[[
ExampleElevator = {
{
coords = vector3(xxx, yyy, zzz), heading = 0.0, level = “Floor 2”, label = “Roof”,
jobs = {
[“police”] = 0,
[“ambulance”] = 0
},
item = “casino_pass”
},
{
coords = vector3(xxx, yyy, zzz), heading = 0.0, level = “Floor 1”, label = “Penthouse”,
jobs = {
[“police”] = 0,
[“ambulance”] = 0
},
item = “casino_pass”,
jobAndItem = true
},
{
coords = vector3(xxx, yyy, zzz), heading = 0.0, level = “Floor 0”, label = “Ground”
},
},
]]

Config.Elevators = {

VPDMainElevator = {	
	{
		coords = vector3(-1096.22, -850.763, 38.20), heading = 36.8, level = "Floor 6", label = "Roof Access",
		jobs = {}
	},
	{
		coords = vector3(-1096.22, -850.763, 34.40), heading = 36.8, level = "Floor 5", label = "Detective Bureau",
		jobs = {}
	},
	{
		coords = vector3(-1096.22, -850.763, 30.80), heading = 36.8, level = "Floor 4", label = "Operations Center",
		jobs = {}
	},
	{
		coords = vector3(-1096.22, -850.763, 27.00), heading = 36.8, level = "Floor 3", label = "Division Offices & Briefing Room",
		jobs = {}
	},
	{
		coords = vector3(-1096.22, -850.763, 23.00), heading = 36.8, level = "Floor 2", label = "Cafe",
		jobs = {}
	},
	{
		coords = vector3(-1096.22, -850.763, 19.00), heading = 36.8, level = "Floor 1", label = "Main Hall",
		jobs = {}
	},
	{
		coords = vector3(-1096.22, -850.763, 4.80), heading = 36.8, level = "Floor -1", label = "Detention Cells & Interrogation",
		jobs = {}
	},
	{
		coords = vector3(-1096.22, -850.763, 10.20), heading = 36.8, level = "Floor -2", label = "Crime Lab & Evidence Rooms",
		jobs = {}
	},
	{
		coords = vector3(-1096.22, -850.763, 13.70), heading = 36.8, level = "Floor -3", label = "Garage & Armory",
		jobs = {}
	},
},

VPDPublicElevator = {
	{
		coords = vector3(-1066.05, -833.71, 26.82318), heading = 36.1, level = "Floor 3", label = "Division Offices",
		jobs = {}
	},
	{
		coords = vector3(-1066.05, -833.71, 23.03471), heading = 36.1, level = "Floor 2", label = "UNDER RENOVATIONS",
		jobs = {}
	},
	{
		coords = vector3(-1066.05, -833.713, 18.9964), heading = 36.1, level = "Floor 1", label = "Main Hall",
		jobs = {}
	},
	{
		coords = vector3(-1066.05, -833.71, 4.88), heading = 36.1, level = "Floor -1", label = "Detention Cells & Interrogation",
		jobs = {}
	},
	{
		coords = vector3(-1066.05, -833.71, 10.27282), heading = 36.1, level = "Floor -2", label = "Crime Lab & Evidence Rooms",
		jobs = {}
	},
	{
		coords = vector3(-1066.05, -833.71, 13.69069), heading = 36.1, level = "Floor -3", label = "Garage & Armory",
		jobs = {}
	},
},

SkybarElevatorSouth = {
	{
		coords = vector3(315.49, -929.32, 52.81), heading = 176.67, level = "Skybar 5th Floor", label = "Bar Level for Skybar",
		jobs = {}
	},
	{
		coords = vector3(315.49, -929.32, 29.47), heading = 176.67, level = "Skybar Ground", label = "Street Level for Skybar",
		jobs = {}
	},
},

SkybarElevatorNorth = {
	{
		coords = vector3(309.81, -929.05, 52.81), heading = 176.67, level = "Skybar 5th Floor", label = "Bar Level for Skybar",
		jobs = {}
	},
	{
		coords = vector3(309.81, -929.05, 29.47), heading = 176.67, level = "Skybar Ground", label = "Street Level for Skybar",
		jobs = {}
	},
},

}

Presuming you are using ESX, that config looks fine.
Hopefully someone else can confirm that the latest changes on GitHub work correctly.
My servers don’t use nh-context or qtarget, so I can’t test it.

Are you using the newest version of nh-context? This script uses the new version which replaces the context of the old args.

Could this work with qb-menu instead of nh-conext?

specifically the functionality where nh-context excludes the floor you are on?

It could be converted to use qb-menu, however the disable feature will not work as is, so it would require a decent amount of effort to redesign. Definitely doable to get it working, but not a quick renaming of the event triggers. And in response to your DM to me about qb-target, I do not use that either. I will soon be writing my own targeting system for the new framework I wrote (exclusive to my community, sorry), however I can’t help you with qb-target or similar.

qb-target was based off of qtarget anyway, but the old one. qtarget has since been updated so it has more and better features now. Consider using qtarget instead.

I appreciate that. I did get qb-target working ( to my knowledge) however i cannot get the nh-context menu to appear using the targeting system. I will likely eventually just make it work with qb-menu without the added functionality if not possible.


This is the error I am receiving at launch using qb-target and nh-context

I believe this relates to receiving the table of jobs rather that a job value but I am not certain.


qb-target displays the elevator action and correct floor readout howver i cannot get it to action the nh-context menu

My bad, I was thinking of qb-menu being based off the old nh-context sorry.
So that is what I meant you should use instead, if you want better functionality.
Otherwise rewrite qb-menu to work like the new nh-context.
I got confused there :stuck_out_tongue:

qtarget and qb-target should be very similar.

That error you are getting is because the player doesn’t have a job. That’s odd.
Honestly, you’re on your own on that one. The script works as is, but converting it is something you will have to tackle. Maybe others can help you.

Sure not asking for help converting it rather as it stands in its current state with the required dependencies. The player has the police job provided in base qb core.

I am using nh-context with a defined job. Door locks work find so I know the job is set.

I appreciate your time. I was able to finally get all of the same functionality with qb-menu and qb-target including removing the current floor. Only thing I am having trouble with is allowing access with items but Im sure Ill get it eventually.

1 Like

Im actually getting this same error. Tried keeping jobs empty, tried removing it. Just isnt working for some reason when the requireditem was implemented.