top sniper Posted June 14, 2012 Share Posted June 14, 2012 function jajwarp(thePlayer) for _,k in ipairs (getAttachedElements(thePlayer)) do if getElementType( k ) == "player" then detachElements(k,thePlayer) warpPedIntoVehicle ( k, source,1) setElementData(thePlayer,"wasJailed",true) end end end addEventHandler ( "onVehicleEnter", getRootElement(), jajwarp) function jajwarps(thePlayer) local wasaaa = getElementData(thePlayer,"wasJailed") if wasaaa then for _,k in ipairs (getAttachedElements(thePlayer)) do if getElementType( k ) == "player" then removePedFromVehicle ( k ) attachElements ( k, thePlayer, 0, -1, 0 ) setCameraTarget(k) setPedRotation ( k, 90 ) end end end end addEventHandler ( "onPlayerVehicleExit", getRootElement(), jajwarps) Link to comment
Guest Guest4401 Posted June 14, 2012 Share Posted June 14, 2012 In onVehicleEnter, source is vehicle and first parameter is thePlayer But in onPlayerVehicle exit, source is player, and first parametre is theVehicle Here you are setting elementData of player: setElementData(thePlayer,"wasJailed",true) Here you are getting elementData of vehicle and not the player: local wasaaa = getElementData(thePlayer,"wasJailed") Replacing onPlayerVehicleExit with onVehicleExit would perhaps make your job easier. Link to comment
top sniper Posted June 14, 2012 Author Share Posted June 14, 2012 In onVehicleEnter, source is vehicle and first parameter is thePlayerBut in onPlayerVehicle exit, source is player, and first parametre is theVehicle Here you are setting elementData of player: setElementData(thePlayer,"wasJailed",true) Here you are getting elementData of vehicle and not the player: local wasaaa = getElementData(thePlayer,"wasJailed") Replacing onPlayerVehicleExit with onVehicleExit would perhaps make your job easier. so should be like this function jajwarp(thePlayer) for _,k in ipairs (getAttachedElements(thePlayer)) do if getElementType( k ) == "player" then detachElements(k,thePlayer) warpPedIntoVehicle ( k, source,1) setElementData(thePlayer,"wasJailed",true) end end end addEventHandler ( "onVehicleEnter", getRootElement(), jajwarp) function jajwarps(thePlayer) local wasaaa = getElementData(thePlayer,"wasJailed") if wasaaa then for _,k in ipairs (getAttachedElements(thePlayer)) do if getElementType( k ) == "player" then removePedFromVehicle ( k ) attachElements ( k, thePlayer, 0, -1, 0 ) setCameraTarget(k) setPedRotation ( k, 90 ) end end end end addEventHandler ( "onVehicleExit", getRootElement(), jajwarps) Link to comment
X-SHADOW Posted June 14, 2012 Share Posted June 14, 2012 In onVehicleEnter, source is vehicle and first parameter is thePlayerBut in onPlayerVehicle exit, source is player, and first parametre is theVehicle Here you are setting elementData of player: setElementData(thePlayer,"wasJailed",true) Here you are getting elementData of vehicle and not the player: local wasaaa = getElementData(thePlayer,"wasJailed") Replacing onPlayerVehicleExit with onVehicleExit would perhaps make your job easier. so should be like this function jajwarp(thePlayer) for _,k in ipairs (getAttachedElements(thePlayer)) do if getElementType( k ) == "player" then detachElements(k,thePlayer) warpPedIntoVehicle ( k, source,1) setElementData(thePlayer,"wasJailed",true) end end end addEventHandler ( "onVehicleEnter", getRootElement(), jajwarp) function jajwarps(thePlayer) local wasaaa = getElementData(thePlayer,"wasJailed") if wasaaa then for _,k in ipairs (getAttachedElements(thePlayer)) do if getElementType( k ) == "player" then removePedFromVehicle ( k ) attachElements ( k, thePlayer, 0, -1, 0 ) setCameraTarget(k) setPedRotation ( k, 90 ) end end end end addEventHandler ( "onVehicleExit", getRootElement(), jajwarps) Worng ! 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