DaaNN Posted December 10, 2021 Share Posted December 10, 2021 Hello everyone, sorry for my basic English. Basically I am trying to "start" a vehicle, checking if the user belongs to "Basurero" and the vehicle is the ID 408 (garbage truck). addCommandHandler("motor", function(player) if not notIsGuest(player) then local veh = player:getOccupiedVehicle() local seat = player:getOccupiedVehicleSeat() if veh and seat == 0 then if getElementData(player, "Roleplay:trabajo") == "Basurero" && getVehicleID(id_vehicle) == 408 then local gas = getElementData(veh, "Fuel") or 0 if gas >= 1 then if not player:getData("EnGasolinera") then if veh:getHealth() >= 300 then if veh:getData('Motor') == 'apagado' then MensajeRol(player, " esta encendiendo el motor del vehículo") setTimer(function(player, veh) veh:setEngineState(true) veh:setData('Motor','encendido',false) veh:setFrozen(false) end, 2000, 1, player, veh) for i,v in ipairs(getPlayersOverArea(player,13)) do v:triggerEvent('SonidoEncenderVeh',v,'auto') end else MensajeRol(player, " apago el motor del vehículo") setTimer(function(player, veh) veh:setEngineState(false) -- veh:setFrozen(true) veh:setData('Motor','apagado') end, 200, 1, player, veh) end end end end end end end end) The problem is that if I run it that way, trying to "turn it on" shows me: ( bad argument @ "getVehicleID" [expected element at argument 1 got nil] ). PS: I tried to change it to getElementModel, and so on and it keeps giving the same problem, any solution? Thanks. I tried to seek help in the Spanish forums but I see that they are very inactive and I have tried several options and I cannot find a solution, sorry for the inconvenience. Link to comment
The_GTA Posted December 10, 2021 Share Posted December 10, 2021 (edited) Hello DaaNN, you have posted in the Spanish forums just 8 hours ago. Next time try waiting a little longer before double-posting, okay? To answer your question, the variable "id_vehicle" does not appear to be defined in your script. Try using getElementModel(veh) instead. Edited December 10, 2021 by The_GTA Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now