Cocodrilo Posted January 21, 2014 Posted January 21, 2014 Hi everyone, i got a little problem .. i will be very grateful if you show me a way to solve it I want to do two things: 1.- onClientMarkerHit - destroy: 'neumatico' and 'neumaticoMarker' i had hit i use destroyElement but it only destroys the marker. So, how to destroy the pickup too? 2.- I want to respawn 'neumatico' and 'neumaticoMarker' every 20 seconds if these elements are not. I tried to add setTimer function but doesn't worked. llantas = { {1665.1064453125, -2113.4404296875, 13.546875,0,0} } addEventHandler ("onClientResourceStart",getResourceRootElement(getThisResource()), function iniciar() for i,v in ipairs (llantas) do local neumatico = createPickup (v[1],v[2],v[3],3,2768,100) local neumaticoMarker = createMarker (v[1],v[2],v[3],"corona",1,143,143,17,80) setElementData (neumaticoMarker,"Neumatico!!", true) setElementInterior (neumaticoMarker,v[4]) setElementInterior (neumatico,v[4]) setElementDimension(neumatico,tonumber(v[5])) setElementDimension(neumaticoMarker,tonumber(v[5])) end end) addEventHandler ("onClientMarkerHit",getRootElement(), function(hitEle,dim) if (getLocalPlayer() == hitEle) and (getElementData (source,"Neumatico!!") == true) and (dim) then triggerServerEvent("addAcountNeumatico",getLocalPlayer(),getLocalPlayer(),1) outputChatBox ("+ 1 Neumático",0,255,0,false) --destroyElement(source) end end )
manawydan Posted January 21, 2014 Posted January 21, 2014 (edited) sorry Edited January 21, 2014 by Guest "Querer não é poder, mas tentar é avançar"!
DNL291 Posted January 21, 2014 Posted January 21, 2014 llantas = { {1665.1064453125, -2113.4404296875, 13.546875,0,0} } addEventHandler ("onClientResourceStart",getResourceRootElement(getThisResource()), function() for i,v in ipairs (llantas) do neumatico = createPickup (v[1],v[2],v[3],3,2768,100) neumaticoMarker = createMarker (v[1],v[2],v[3],"corona",1,143,143,17,80) setElementData (neumaticoMarker,"Neumatico!!", true) setElementInterior (neumaticoMarker,v[4]) setElementInterior (neumatico,v[4]) setElementDimension(neumatico,v[5]) setElementDimension(neumaticoMarker,v[5]) end end) addEventHandler ("onClientMarkerHit",getRootElement(), function(hitEle,dim) if (getLocalPlayer() == hitEle) and (getElementData (source,"Neumatico!!") == true) and (dim) then triggerServerEvent("addAcountNeumatico",getLocalPlayer(),getLocalPlayer(),1) outputChatBox ("+ 1 Neumático",0,255,0) destroyElement(source) destroyElement(neumatico) setTimer( function() for i,v in ipairs (llantas) do neumatico = createPickup (v[1],v[2],v[3],3,2768,100) neumaticoMarker = createMarker (v[1],v[2],v[3],"corona",1,143,143,17,80) end end, 20000, 1 ) end end ) Please do not PM me with scripting related question nor support, use the forums instead.
DNL291 Posted January 21, 2014 Posted January 21, 2014 You're welcome. Please do not PM me with scripting related question nor support, use the forums instead.
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