Jacobob14 Posted June 4, 2014 Share Posted June 4, 2014 help I want to execute the command change the owner of the vehicle but it does not work ;( function cars( source,valor) if isPedInVehicle(source) then local username = getAccountName( getPlayerAccount (source) ) local vehicle = getPedOccupiedVehicle( source ) local id = getElementID( vehicle ) if vehicles[id] then if valor then if valor == "posicion" then local x, y, z = getElementPosition ( source ) local rx, ry, rz = getElementRotation ( source ) vehicles[id]["x"] = x vehicles[id]["y"] = y vehicles[id]["z"] = z vehicles[id]["rotX"] = rx vehicles[id]["rotY"] = ry vehicles[id]["rotZ"] = rz setVehicleRespawnPosition( vehicle, x, y, z, rx, ry, rz) elseif valor == "color" then local r1, g1, b1, r2, g2, b2, r3, g3, b3, r4, g4, b4 = getVehicleColor ( vehicle, true ) vehicles[id]["r"] = r1 vehicles[id]["g"] = g2 vehicles[id]["b"] = b1 vehicles[id]["sr"] = r2 vehicles[id]["sg"] = g2 vehicles[id]["sb"] = b2 elseif valor == "dueño" then vehicles[id]["ptype"] = user vehicles[id]["owner"] = username elseif valor == "modelo" then vehicles[id]["model"] = getElementModel(vehicle) elseif valor == "upgrades" then vehicles[id]["upgrades"] = getVehicleUpgrades(vehicle) elseif valor == "damage" then setVehicleDamageProof(vehicle, true) end end end end end addCommandHandler("car",cars) Link to comment
Mr_Moose Posted June 4, 2014 Share Posted June 4, 2014 arguments for the functions in a command handler start's on position 3, position 2 contains a string with the name of the command itself, in this case "car", try replace line 1 with this: function cars( source, cmd, valor ) 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