Jump to content

Check if Player is in a Vehicle problem


Karuzo

Recommended Posts

hey guys,

so i wanted to check if a player is in a vehicle , but that doesnt work ...

here's my code :

local veh = getPedOccupiedVehicle () 
  
function Motor1(player) 
    local veh = getPedOccupiedVehicle ( player ) 
    if isPedInVehicle(player) then 
        setVehicleHandling(veh, "engineAcceleration", 60) 
    else 
        outputChatBox("Get in a Vehicle dude!", getRootElement(), 255,0,0, false) 
    end 
end 
addEvent("Motor1", true) 
addEventHandler("Motor1", getRootElement(), Motor1) 

Link to comment
  
    function Motor1(player) 
        local veh = getPedOccupiedVehicle ( player ) 
        if veh then 
            setVehicleHandling(veh, "engineAcceleration", 60) 
        else 
            outputChatBox("Get in a Vehicle dude!", getRootElement(), 255,0,0, false) 
        end 
    end 
    addEvent("Motor1", true) 
    addEventHandler("Motor1", getRootElement(), Motor1) 

Try that.

Link to comment
hey guys,

so i wanted to check if a player is in a vehicle , but that doesnt work ...

...

I just love it how people don't explain what their problem is. It looks like the event is not even triggered. If you don't get error messages or the "Get in a Vehicle dude" message, then it's not triggered because "else" would pass.

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