EW1611 Posted July 27, 2019 Share Posted July 27, 2019 (edited) hi, this is my script, first marker works good, but the second(for destruction) dont work, only the outputChatBox, the marker is on the map, but dont work Edit: on console shows this error: WARNING: Oficina-Mecanica\spawn.Lua:22: Bad argument @ 'destroyElement' [Expected element at argument 1, got nil] WARNING: Oficina-Mecanica\spawn.Lua:21: Bad argument @ 'isPedInVehicle' [Expected ped at argument 1, got vehicle] local Marker1 = createMarker (119.86518859863, -1832.1979980469, 5, "cylinder", 1.25, 0, 250, 0, 50) local Marker2 = createMarker (127.06451416016, -1848.4306640625, 5, "cylinder", 3, 0, 250, 0, 50) veh = {} function Vehicle1 ( hitPlayer, getPlayerVehicle ) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(hitPlayer)), aclGetGroup("Mecanico")) then if isElement(Veh1) then destroyElement(Veh1) end local Veh1 = createVehicle(525, 132.57461547852, -1815.671875, 5.795524597168, 0, 0, 270) warpPedIntoVehicle ( hitPlayer, Veh1 ) else outputChatBox ("Você não é um Mecanico", hitPlayer, 0, 0, 0) end end addEventHandler( "onMarkerHit", Marker1, Vehicle1) function Vehicle2(player) if isElementWithinMarker(player, Marker2) then if isPedInVehicle(player) == true then destroyElement(veh[player]) veh[player] = nil else outputChatBox("Você não esta em um veículo", hitPlayer, 0, 0, 0) end end end addEventHandler("onMarkerHit", Marker2, Vehicle2) sorry for my bad english Edited July 27, 2019 by EW1611 Link to comment
HassoN Posted July 27, 2019 Share Posted July 27, 2019 local Marker1 = createMarker (119.86518859863, -1832.1979980469, 5, "cylinder", 1.25, 0, 250, 0, 50) local Marker2 = createMarker (127.06451416016, -1848.4306640625, 5, "cylinder", 3, 0, 250, 0, 50) veh = {} function Vehicle1 (hitPlayer) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(hitPlayer)), aclGetGroup("Mecanico")) then if isElement(veh[hitPlayer]) then destroyElement(veh[hitPlayer]) veh[hitPlayer] = nil end veh[hitPlayer] = createVehicle(525, 132.57461547852, -1815.671875, 5.795524597168, 0, 0, 270) warpPedIntoVehicle ( hitPlayer, veh[hitPlayer] ) else outputChatBox ("Você não é um Mecanico", hitPlayer, 0, 0, 0) end end addEventHandler( "onMarkerHit", Marker1, Vehicle1) function Vehicle2(player) if isElementWithinMarker(player, Marker2) then if isPedInVehicle(player) == true then destroyElement(veh[player]) veh[player] = nil else outputChatBox("Você não esta em um veículo", hitPlayer, 0, 0, 0) end end end addEventHandler("onMarkerHit", Marker2, Vehicle2) 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