this is a small code for the team balance systems taken from my CL_init.
[lua]
team_1.DoClick = function()
if team.NumPlayers (1) > team.NumPlayers (2) then return
false
print("This team is Full!")
else
[/lua]
am i doin' it wrong? or do i have it?
LocalPlayer:PrintMessage(HUD_PRINTCENTER, "This team is full!") < Center of Screen
LocalPlayer:PrintMessage(HUD_PRINTTALK, "This team is full!") < Chat Dialogue
[code]team_1.DoClick = function()
if team.NumPlayers (1) > team.NumPlayers (2) then return false
LocalPlayer:PrintMessage(HUD_PRINTTALK, "This team is Full!")
else [/code]
[lua]
team_1.DoClick = function()
if(team.NumPlayers(1) > team.NumPlayers(2)) then
LocalPlayer():PrintMessage(HUD_PRINTTALK, "Team 1 is full!")
return
end
//Ply:SetTeam(), etc
end
[/lua]
LocalPlayer is a function.
[lua]LocalPlayer()[/lua]
[b][url=http://wiki.garrysmod.com/?title=G.LocalPlayer]G.LocalPlayer [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
PortalGod's code failed
[editline]04:43AM[/editline]
so did mikeyM's.
any more ideas?
What do you mean, "failed"? Give us an error and we can correct it.
also, give us the full code + the function you used
anytime you return something, it goes to the end, so there is no point in having "else" afterwards, just do then print("") etc...
i need that else. this function says that if its too high then say you can, but if its NOT then go ahead and run the function
[QUOTE=Kruel Kramer;24762764]i need that else. this function says that if its too high then say you can, but if its NOT then go ahead and run the function[/QUOTE]
No need, if it's too high it says you can't and breaks the function. It won't get a chance to run the code below.
Sorry, you need to Log In to post a reply to this thread.