Jump to content

[HELP] /engine


opnaiC

Recommended Posts

function engine ( source, cmd) 
local account = getPlayerAccount (source) 
local theVehicle = getPedOccupiedVehicle ( source ) 
local skin = getElementModel (source) 
local iFaction = getAccountData(account, "Faction") or 0 
 if theVehicle == 431 then 
  outputChatBox ("working", root) 
     if tonumber(iFaction) == 7 then 
         if skin == 71 then 
            if getVehicleEngineState(car) == false then 
            setVehicleEngineState ( car, true ) 
            else 
            setVehicleEngineState ( car, false ) 
            end 
        end 
     end 
     else 
     outputChatBox ("wrong", root) 
 end 
end 
addCommandHandler ("engine",engine) 

Its outputting "wrong" but the vehicle id is 431

Link to comment
    function engine ( thePlayer) 
    local account = getPlayerAccount (thePlayer) 
    local theVehicle = getPedOccupiedVehicle ( thePlayer ) 
    local model = getElementModel(theVehicle) 
    local skin = getElementModel (thePlayer) 
    local iFaction = getAccountData(account, "Faction") or 0 
     if model == 431 then 
      outputChatBox ("working", thePlayer) 
         if tonumber(iFaction) == 7 then 
             if skin == 71 then 
                if getVehicleEngineState(theVehicle) == false then 
                setVehicleEngineState ( theVehicle, true ) 
                else 
                setVehicleEngineState ( theVehicle, false ) 
                end 
            end 
         end 
         else 
         outputChatBox ("wrong", thePlayer) 
     end 
    end 
     
     
    addCommandHandler ("engine",engine) 

--- Car was undefined

--- Source changed to thePlayer, (You're dropping another element over a predefined element)

--- You need to get the vehicles model

--- There's no reason for CMD if you're not going to use it.

--- If you want to output to root, just remove root, but in this case it seams you want to output to local?

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...