I was messing around because I want to learn lua, I want it so if the target_plys is greater than 1 it prints something else than if it was 1. I know why the fancylog is ran multiple times. It runs multiple times because it runs once for each consecutive player. How would I make it where it only prints it once?
function ulx.test( calling_ply, target_plys, amount )
local prevhp2 = target_plys[1]:Health()
for i=1, #target_plys do
target_plys[ i ]:SetHealth(amount)
if #target_plys > 1 then
ulx.fancyLogAdmin( calling_ply, "#A set the HP of #T to #s", target_plys, amount )
else
ulx.fancyLogAdmin( calling_ply, "#A set the HP of #T to #s (it was previously #s)", target_plys, amount, prevhp2)
end
end
end
local test = ulx.command( CATEGORY_NAME, "ulx test", ulx.test, "!test", true )
test:addParam{ type=ULib.cmds.PlayersArg }
test:addParam{ type=ULib.cmds.NumArg }
test:defaultAccess( ULib.ACCESS_ADMIN )
test:help( "Test." )