Bean666 Posted July 8, 2016 Share Posted July 8, 2016 how could i destroy the blip that was attached to the destroyed marker and attach a new blip to the new created marker again? function createMarkers ( ) loc = math.random ( #markers ) marker = createMarker ( markers[loc][1], markers[loc][2], markers[loc][3], "cylinder", 5.0, 0, 0, 255, 150 ) blip = createBlipAttachedTo(marker, 41) end function MarkerHit ( hitPlayer, matchingDimension ) if (hitPlayer == localPlayer) then createMarkers() destroyElement(source) end end addEventHandler ( "onClientMarkerHit", resourceRoot, MarkerHit ) Link to comment
Calculador Posted July 8, 2016 Share Posted July 8, 2016 First you destroy the blip and after the marker, test it. function createMarkers ( ) loc = math.random ( #markers ) marker = createMarker ( markers[loc][1], markers[loc][2], markers[loc][3], "cylinder", 5.0, 0, 0, 255, 150 ) blip = createBlipAttachedTo(marker, 41) end function MarkerHit ( hitPlayer, matchingDimension ) if (hitPlayer == localPlayer) then destroyElement(blip ) destroyElement(source) createMarkers() end end addEventHandler ( "onClientMarkerHit", resourceRoot, MarkerHit ) Link to comment
Walid Posted July 8, 2016 Share Posted July 8, 2016 how could i destroy the blip that was attached to the destroyed marker and attach a new blip to the new created marker again? Try this: local blips = {} function createMarkers ( ) loc = math.random ( #markers ) marker = createMarker ( markers[loc][1], markers[loc][2], markers[loc][3], "cylinder", 5.0, 0, 0, 255, 150 ) blips[marker] = createBlipAttachedTo(marker, 41) addEventHandler ( "onClientMarkerHit", marker, MarkerHit ) end function MarkerHit ( hitPlayer, matchingDimension ) if (hitPlayer == localPlayer) then if blips[source] then destroyElement(blips[source]) destroyElement(source) createMarkers() end end end Link to comment
Bean666 Posted July 8, 2016 Author Share Posted July 8, 2016 btw is it possible to trigger setElementVisibleTo from s-side to c-side? Link to comment
Walid Posted July 8, 2016 Share Posted July 8, 2016 btw is it possible to trigger setElementVisibleTo from s-side to c-side? Use the whole code server side. Link to comment
Bean666 Posted July 8, 2016 Author Share Posted July 8, 2016 btw i'm creating a marker and i have it on "corona", but it's creating a huge cylinder, even i change the size to 0 i used setMarkerSize , the size got small but the marker is so high , it's exceeding over the top. nvm fixed. 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