Jump to content

[HELP] Destroy a marker


LabiVila

Recommended Posts

Posted

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

Posted
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.

Posted
  
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 
) 
  

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...