[Help] /pv (personal vehicle) execute auto with a Menu (Mysql..)

Si tu veux tu peux m’ajouter sur Skype je peux t’aider : wheezx

I make a update in my message :wink:

it’s possible to add permission level to use the menu ?

idk but i think yes for what ??

i want use a menu for only admin or specific job

ah ok but its not the good poste dude… I just need a help for fix my menu

up… nobody know the fuc**** command or function for execute a command auto ?

Right okay stop upping your post! It’s so annoying! People are not available to help on this website 24/7

Are you trying to spawn a vehicle when the button is clicked? If so you’re going about it totally wrong…

TriggerClientEvent("chatMessage", -1, "", {255, 255, 255}, "/pv")

This doe’s not trigger the command /pv it just triggers a chat message which is sent to all clients.

local eventData --[[ value ]] = AddEventHandler(eventName --[[ string ]], eventHandler --[[ function ]])

I think you should create a event that spawns vehicule inside your script and call it when clicking on your menu

I have already try this and doesnt work :slight_smile:

i go test but how use this xD

local spawn

RegisterNUICallback("vehicles", function(data, cb)

	local action = data.action
	
	if action == "spawn" then
	local eventData --[[ what the value ? :D ]] = AddEventHandler(eventName --[[ what the value ? :D ]], eventHandler --[[  what the function ? ]])
	drawNotification("~g~Votre véhicule a spawn")
	end

	cb("ok")
end)

it’s good ?? but what is the value/function pls

Maybe this will help :slight_smile:

Thx but i try to make spawn my vehicle by a menu (UI)

You might need to call a new event (there the car spawn) directly from your menu
First you have to create your event that spawn cars

It is basically the same thing as linked.

Dans l’idée c’est la même chose, il suffit juste de changer un peu le code pour l’avoir du menu ^^

SERVER.LUA

AddEventHandler("chatMessage",function(n,Msg)
	if Msg:sub(1,6) == "/pv" then
		TriggerClientEvent("Event",Msg:sub(5))
		CancelEvent()
end

VEHICLES.LUA

local spawn

RegisterNUICallback("vehicles", function(data, cb)

	local action = data.action
	local myPed = GetPlayerPed(-1)
	local vehicle = GetHashKey(vehicleName)
	
	if action == "spawn" then
    RegisterNetEvent("Event")
    AddEventHandler("Event")
	drawNotification("~g~Votre véhicule a spawn")
	end

	cb("ok")
end)

And i have this error…

Problem is, we don’t know where the error comes from

The error is in Server.lua it is the “end”

I have found the error ^^ i have miss 1 end at the end of my script :smiley:

Is it working properly now ? :slight_smile: