Jump to content

Is this a bug with onPlayerVehicleExit?


Recommended Posts

Take a look at this snippet:

addEventHandler("onPlayerVehicleExit", getRootElement(), 
    function(vehicle, seat, jacker) 
        if(seat == 0 and not starting_timeattack) then 
            if(jacker == nil) then 
                destroyElement(vehicle) 
                setElementData(source, "current_vehicle", nil) 
            else 
                local jackername = getPlayerName(jacker) 
                outputChatBox(jackername .. " tried to steal your car!", source) 
                warpPedIntoVehicle(source, vehicle) 
            end 
        end 
        if(starting_timeattack) then 
            starting_timeattack = false 
        else 
            if(getElementData(source, "isChallengingAkinaTimeAttack")) then 
                triggerEvent("quitAkinaTimeAttack", source) 
            end 
        end 
    end 
) 

jacker is supposed to be nil when no one is jacking you and you are just exiting your own car, right?

Well, when i exit my own car without anyone jacking it, it still executes the part for getting jacked, this one:

            else 
                local jackername = getPlayerName(jacker) 
                outputChatBox(jackername .. " tried to steal your car!", source) 
                warpPedIntoVehicle(source, vehicle) 
            end 

and, of course, getPlayerName throws an invalid argument error

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