Franc[e]sco Posted April 28, 2011 Share Posted April 28, 2011 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
BinSlayer1 Posted April 28, 2011 Share Posted April 28, 2011 jacker is supposed to be nil when no one is jacking you and you are just exiting your own car, right? Well, not necessarily since the wiki doesn't explain it should contain "nil". You should try "false" as well Link to comment
Franc[e]sco Posted April 28, 2011 Author Share Posted April 28, 2011 False worked! Thank you very much! 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