Jump to content

help over here.


manve1

Recommended Posts

I need help of refreshing players alive, i tried different way's to fix it my own, but nothing helped. any help accepted

     
    function getAlivePlayers ( ) 
        local players = { } 
        for _, player in ipairs ( getElementsByType ( "player" ) ) do 
            if ( getElementHealth ( player ) > 0 ) then 
                table.insert ( players, player ) 
            end 
  
        end 
        return players 
    end 
setTimer( getAlivePlayers, 50, 0 ) 
  
label = guiCreateLabel ( 0, 0.9525, 1, 1, "ALIVE: ".. #getAlivePlayers ( ), true ) 
guiSetFont ( label, "sa-header" ) 
guiLabelSetColor ( label, 255, 175, 0 )      
  
  

Link to comment
function getAlivePlayers ( ) 
    local players = { } 
    for _, player in ipairs ( getElementsByType ( "player" ) ) do 
        if ( getElementHealth ( player ) > 0 ) then 
            table.insert ( players, player ) 
        end 
    end 
  
    return players 
end 
  
label = guiCreateLabel ( 0, 0.9525, 1, 1, "ALIVE: ".. #getAlivePlayers ( ), true ) 
guiSetFont ( label, "sa-header" ) 
guiLabelSetColor ( label, 255, 175, 0 ) 
  
setTimer ( 
    function ( ) 
        guiSetText ( label, "ALIVE: ".. #getAlivePlayers ( ) ) 
    end 
    ,3000, 0 
) 

That'll update it every 3 seconds.

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