Jump to content

[HELP] OutputChatBox help


LabiVila

Recommended Posts

function timePassed () 
    if not systemUpTime then 
        systemUpTime = getTickCount () 
    end 
     
    current = getTickCount () 
     
    local res = math.floor((current - systemUpTime)/1000) 
    dxDrawText (res, x/3, y/3, x, y, tocolor (255, 255, 255, 255), 1.5, "clear") 
     
    addEventHandler ("onClientMarkerHit", getRootElement(), 
        function () 
            outputChatBox (getPlayerName (localPlayer).." has finished the map in: "..res.." mins.", source) 
        end 
    ) 
end 
addEventHandler ("onClientRender", getRootElement(), timePassed) 
  
  

the problem is that there is not just one outputChatBox like: mysticguy has won the map in .. minutes, but there are a lot of those like this: http://www.upload.ee/image/4249449/sss.png

Link to comment

That's because you've put the outputChatBox within onClientRender, so it will output the string every time the client renders.

Take the addEventHandler("onClientMarkerHit") out of the onClientRender event and put it underneath it like this:

function timePassed () 
    if not systemUpTime then 
        systemUpTime = getTickCount () 
    end 
    
    current = getTickCount () 
    
    local res = math.floor((current - systemUpTime)/1000) 
    dxDrawText (res, x/3, y/3, x, y, tocolor (255, 255, 255, 255), 1.5, "clear") 
end 
  
addEventHandler ("onClientMarkerHit", getRootElement(), 
    function () 
        outputChatBox (getPlayerName (localPlayer).." has finished the map in: "..res.." mins.", source) 
    end 
) 

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