ertlflorian1 Posted March 16, 2013 Share Posted March 16, 2013 Why it wont work? function lizacheck (player, name) if (getElementData (player, "A") ~= 0) then outputChatBox ("Du hast diese Lizenz bereits!", player, 255,0,0) else setElementData (player, "A", 1) int = getFreeDimension (player) setElementInterior (player, 0) setElementDimension (player, int) local car = createVehicle (445,-2159.8,292.6,34.7) setElementPosition (player, -2159.8,292.6,34.7) setElementDimension (car, int) warpPedIntoVehicle (player, car) triggerClientEvent (player, "closeRathausGUI", player) addEventHandler ("onVehicleExit", player, ifPlayerWantsToExit) end end addEventHandler ("lizae", root, lizacheck) function ifPlayerWantsToExit () destroyElement (getPedOccupiedVehicle(source)) setElementDimension (source, 0) removeEventHandler ("onVehicleExit", source, ifPlayerWantsToExit) end I get no error? Link to comment
TAPL Posted March 16, 2013 Share Posted March 16, 2013 The attachedTo in this event must be vehicle Not a player. addEventHandler ("onVehicleExit", player, ifPlayerWantsToExit) Link to comment
ertlflorian1 Posted March 16, 2013 Author Share Posted March 16, 2013 Ok thank you i have solved it now but now I get the error: Bad argument expcted near destroyElement got boolean? function lizacheck (player, name) if (getElementData (player, "A") ~= 0) then outputChatBox ("Du hast diese Lizenz bereits!", player, 255,0,0) else setElementData (player, "A", 1) int = getFreeDimension (player) setElementInterior (player, 0) setElementDimension (player, int) local car = createVehicle (445,-2159.8,292.6,34.7) setElementPosition (player, -2159.8,292.6,34.7) setElementDimension (car, int) warpPedIntoVehicle (player, car) triggerClientEvent (player, "closeRathausGUI", player) addEventHandler ("onPlayerVehicleExit", player, ifPlayerWantsToExit) end end addEventHandler ("lizae", root, lizacheck) function ifPlayerWantsToExit () destroyElement (getPedOccupiedVehicle(source)) setElementDimension (source, 0) removeEventHandler ("onPlayerVehicleExit", source, ifPlayerWantsToExit) end Link to comment
TAPL Posted March 16, 2013 Share Posted March 16, 2013 That's because the player exit from the vehicle and he no longer have vehicle, so the function getPedOccupiedVehicle will return false and it's boolean. You should use the parameters of the event onPlayerVehicleExit. Parameters vehicle theVehicle, int seat, player jacker theVehicle: A vehicle element representing the vehicle in which the player exited from seat: An integer representing the seat in which the player was before exiting jacker: A player element representing the player who jacked the driver https://wiki.multitheftauto.com/wiki/OnPlayerVehicleExit Link to comment
ertlflorian1 Posted March 16, 2013 Author Share Posted March 16, 2013 Thank you so 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