Jump to content

Team health


boro

Recommended Posts

Posted

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 ) 

I'll help When I Can.

Posted

first error i detected...

local steam = getTeamFromName ( Snipers ) 

must be

local steam = getTeamFromName ( "Snipers" ) 

try that...

or u type "/snipers [team name]"

350x20_FFFFFF_FFFFFF_000000_000000.png

http://i.imgur.com/CSE28MJ.png

Don't hesitate to contact me for anything! If I can help, I will for sure!

Education is the most powerful weapon which you can use to change the world. - Castillo

Posted

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 ) 

I'll help When I Can.

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

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