yToPzz Posted July 21, 2022 Share Posted July 21, 2022 (edited) WARNING: [SCRIPTS]\Trab3\s.lua:63: Bad argument @ 'destroyElement' [Expected element at argument 1] the error occurs when the truck's load explodes and when the player leaves when the truck is destroyed, it gives the error, so would there be a way to prevent this? function sair4 (source) if veh[source] and isElement(veh[source]) then Trabalho = false destroyElement (veh[source]) destroyElement (carga[source]) --- line 63 carga[source] = nil setElementVisibleTo ( blipfim4, source, false ) setElementVisibleTo ( entregartrab4, source, false ) setPedSkin (source,0) outputChatBox ('#000000[#ffffff Trabalho 3#000000 ]#FF0000 Você saiu do veiculo e perdeu o trabalho !',source,255,255,255,true) setElementData(source, "Trab", false) end end addEventHandler ("onVehicleExit", root, sair4) Edited July 21, 2022 by yToPzz Link to comment
roaddog Posted July 21, 2022 Share Posted July 21, 2022 should also check isElement(carga[source]) before destroying it 1 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