Jump to content

Team health


boro

Recommended Posts

Hi all i try make script for show team health but it dont work please help.

function showteamhealth ( command, snipers ) 
local steam = getTeamFromName ( Snipers ) 
if ( steam ) then 
for i, player in ipairs(getPlayersInTeam(steam)) do 
health = health + getElementHealth(player) 
outputChatBox("Team Snipers have" .. health .. " %health", getRootElement(), 255, 255, 255, true) 
end 
end 
end 
addCommandHandler ( "snipers", showteamhealth ) 

Link to comment

Still dont work message dont are showed

function showteamhealth ( command, snipers ) 
Snipers = "Snipers" 
local steam = getTeamFromName ( Snipers ) 
if ( steam ) then 
for i, player in ipairs(getPlayersInTeam(steam)) do 
health = health + getElementHealth(player) 
outputChatBox("Team Snipers have" .. health .. " %health", getRootElement(), 255, 255, 255, true) 
end 
end 
end 
addCommandHandler ( "snipers", showteamhealth ) 

Link to comment
function showteamhealth ( command, snipers ) 
local steam = getTeamFromName ( snipers ) 
if ( steam ) then 
health = 0 
for i, player in ipairs(getPlayersInTeam(steam)) do 
health = health + getElementHealth(player) 
end 
outputChatBox("Team "..steam.." has " .. tostring(health) .. " %health", getRootElement(), 255, 255, 255, true) 
end 
end 
addCommandHandler ( "snipers", showteamhealth ) 

This should work.

PS: This gets the team you have entered in the command. (e.g. /snipers teamname1)

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