boro Posted August 7, 2014 Share Posted August 7, 2014 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
joaosilva099 Posted August 7, 2014 Share Posted August 7, 2014 first error i detected... local steam = getTeamFromName ( Snipers ) must be local steam = getTeamFromName ( "Snipers" ) try that... or u type "/snipers [team name]" Link to comment
[UCG]Mike Posted August 7, 2014 Share Posted August 7, 2014 Snipers = "Snipers" local steam = getTeamFromName ( Snipers ) or try that Link to comment
boro Posted August 7, 2014 Author Share Posted August 7, 2014 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
Et-win Posted August 7, 2014 Share Posted August 7, 2014 ...No, look to the function. It has to be snipers instead of Snipers local steam = getTeamFromName ( snipers ) Link to comment
Et-win Posted August 7, 2014 Share Posted August 7, 2014 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now