Hai
So, this will make it able for a player to create a vehicle by command for example /vh 445.
It works fine when i creating a vehicle, and if i try to create a new one when im inside of the vehicle it will output the text ''The vehicle is already in use..'',
and if i exit the first vehicle and creating a new vehicle the first one will get destroyed and i will get my new vehicle i created.
The problem is, when im inside of the vehicle and anyone else is using the command he will be able to use the command..
I just want the command to work for one person, i only wanna allow someone to create a vehicle when noone is in it.
Thanks in advance!
Here is my code:
function createVehicleForPlayer(thePlayer, command, model)
local x,y,z = getElementPosition(thePlayer)
local rx,ry,rz = getElementRotation(thePlayer)
local theVehicle = getPedOccupiedVehicle(thePlayer)
if not theVehicle then
if isElement(createdVehicle) then
destroyElement(createdVehicle)
end
createdVehicle = createVehicle(model, x,y,z, rx,ry,rz)
warpPedIntoVehicle (thePlayer, createdVehicle)
else
outputChatBox("The vehicle is already in use..", thePlayer, 0, 255, 0)
end
end
addCommandHandler("vh", createVehicleForPlayer)