Jump to content

help vehicle system


Recommended Posts

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...