Jump to content

[HELP] Markers left


LabiVila

Recommended Posts

Hello,

my problem is simple and hard I think, how can I output a chatbox everytime I hit a marker with: markers left? Like this:

You're running a race map for example and once you hit a marker, you destroy the marker you just hitted and output the number of checkpoints left?

Thank you farther :)

Link to comment

Tried already, my scripting knowledge isn't very nice so far. I was confused because I haven't created a marker in my script, it's the markers on a map I'm playing. I'll try as you assumed, thank you :)

EDIT: Nah, it's way too difficult for me, I'd appreciate if anyone writes me the approximate script.

Link to comment
function checkToGo(gCheckPointNumber) 
    local checkpointCount = 0 
    local gMap = exports.mapmanager:getRunningGamemodeMap() --Get the current running map 
    local gRoot = getResourceRootElement(gMap) --Get the root where to check the checkpoints, the map-resource it is 
    if (gRoot == false) or (gRoot == nil) then --Check or the root was found, otherwise check through the whole server 
        gRoot = getRootElement() 
    end 
    local gCheckPoints = getElementsByType("checkpoint", gRoot) --Get the checkpoints in the root. 
    if (gCheckPoints ~= false) and (gCheckPoints ~= nil) then --Check or any found 
        for placeNumber, checkpointData in ipairs(gCheckPoints) do --Loop through them, for each checkpoint check or you already had it. 
            checkpointCount = checkpointCount + 1 --For every checkpoint, + the count 
        end 
    end 
    checkpointCount = checkpointCount - gCheckPointNumber --All checkpoints - Reached checkpoint = To Go 
    outputChatBox(tostring(checkpointCount)..." checkpoints to go!", source) --Output it. 
end 

Out of my head, could be wrong/have typos.

Link to comment

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