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

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:

No… i dont have error but the vehicle doesnt spawn when i click on the button

Use TriggerClientEvent(‘vehshop:spawnVehicle’, source, “model vehicle”) for spawn vehicle by client

Omggggggg dude u have read the post ? Its for spawn THE VEHICLE PERSONAL with /pv but with my MENU not spawn a vehicle specific…

Which new code to make spawn the vehicle with the menu? Me too does not work? Can you post it here?

You really should read some LUA manuals. You are subtracting first 6 symbols, and you need only 3.

RegisterNetEvent(“Event”)
AddEventHandler(“Event”)

Also you start registering event and do not finish it. Whole code is messed up.

1 Like

i want add permissin and cooldown spawn