LabiVila Posted August 7, 2014 Share Posted August 7, 2014 Hello, how is it possible to destroy the marker you just hit? I mean once you hit it, it will be destroyed then. And, the marker isn't in the script, it's the marker which is exported from the current map. Thanks further, feel free to ask me for details Link to comment
Et-win Posted August 7, 2014 Share Posted August 7, 2014 destroyElement --Event: (Server-side) onMarkerHit Link to comment
LabiVila Posted August 7, 2014 Author Share Posted August 7, 2014 I tried that already but couldn't succeed. How can I destroy that element when the marker isn't in client-side nor in server-side? Link to comment
Et-win Posted August 7, 2014 Share Posted August 7, 2014 function dMarker() destroyElement(source) end addEventHandler("onMarkerHit", getRootElement(), dMarker) Link to comment
LabiVila Posted August 7, 2014 Author Share Posted August 7, 2014 Doesn't work either, now no marker(checkpoint) appears Link to comment
Et-win Posted August 7, 2014 Share Posted August 7, 2014 Explain what you want exactly... Link to comment
LabiVila Posted August 7, 2014 Author Share Posted August 7, 2014 addEventHandler ("onClientMarkerHit", root, function (player) amount = #getElementsByType ("marker") hitCheckpoints = hitCheckpoints + 1 result = amount - hitCheckpoints outputChatBox (result.. " checkpoints to go") if result == 0 then outputChatBox (getPlayerName (player):gsub("#%x%x%x%x%x%x","").." has won the race.", 255, 255, 255) end end ) There are markers (checkpoints exactly) in my map. And I want to delete or destroy each marker I hit so this way I can't hit it twice. So far the script shows this: Once you hit a marker, it subtracts the hit checkpoins from all checkpoints on the map and outputs it on the chatbox. But there's a bug, I can hit a marker how many times I want, so that's why I'm trying to destroy the hit marker. Link to comment
Gr0x Posted August 7, 2014 Share Posted August 7, 2014 deletedMarkers = 0 addEventHandler ("onClientMarkerHit", root, function (player) deletedMarkers = deletedMarkers+1 destroyElement(source) amount = #getElementsByType ("marker")+deletedMarkers hitCheckpoints = hitCheckpoints + 1 result = amount - hitCheckpoints outputChatBox (result.. " checkpoints to go") if result == 0 then outputChatBox (getPlayerName (player):gsub("#%x%x%x%x%x%x","").." has won the race.", 255, 255, 255) end end ) Link to comment
LabiVila Posted August 7, 2014 Author Share Posted August 7, 2014 Solved, thank you so much both Link to comment
Gr0x Posted August 7, 2014 Share Posted August 7, 2014 You're welcome. If you need any help with scripts on your map, feel free to write me a PM. 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