TorNix~|nR Posted July 9, 2016 Share Posted July 9, 2016 Hi everyone, I have my admin panel of give Teams, I disable some teams like: Militar, I made my code but not work, anyone help? --Set Team local inValidTeams = {Militar = true} addEvent("AdminPanel.setTeam", true) function setTeam(plr, getText) if plr and isElement(plr) then if getText then local team = getTeamFromName(getText) if not team then team = getText end if inValidTeams[tonumber(team)] then outputChatBox("#00FF00Este arma es solo para #FF0000[ADM]", source, r, g, b, true) return end setPlayerTeam(plr, team, true) outputChatBox("#FF0000" ..getPlayerName(source).."#00FF00 Ha combiar su team a #0B00FF("..getText(team)..") ", plr, r, g, b, true) outputChatBox("#00FF00Combiar #FF0000"..getPlayerName(plr).."#00FF00 team a #0B00FF("..getText(team)..") ", source, r, g, b, true) end end end addEventHandler("AdminPanel.setTeam", root, setTeam) Link to comment
Captain Cody Posted July 10, 2016 Share Posted July 10, 2016 --Set Team local inValidTeams = {"Militar" = true} addEvent("AdminPanel.setTeam", true) function setTeam(plr, getText) if plr and isElement(plr) then if getText then local team = getTeamFromName(getText) if not team then team = getText end if inValidTeams[team] then outputChatBox("#00FF00Este arma es solo para #FF0000[ADM]", source, r, g, b, true) return end setPlayerTeam(plr, team, true) outputChatBox("#FF0000" ..getPlayerName(source).."#00FF00 Ha combiar su team a #0B00FF("..team..") ", plr, r, g, b, true) outputChatBox("#00FF00Combiar #FF0000"..getPlayerName(plr).."#00FF00 team a #0B00FF("..team..") ", source, r, g, b, true) end end end addEventHandler("AdminPanel.setTeam", root, setTeam) Link to comment
Captain Cody Posted July 10, 2016 Share Posted July 10, 2016 Sorry Missing somethings --Set Team local inValidTeams = {["Militar"] = true} addEvent("AdminPanel.setTeam", true) function setTeam(plr, getText) if plr and isElement(plr) then if getText then local team = getTeamFromName(getText) if not team then team = getText end if inValidTeams[team] then outputChatBox("#00FF00Este arma es solo para #FF0000[ADM]", source, r, g, b, true) return end setPlayerTeam(plr, team, true) outputChatBox("#FF0000" ..getPlayerName(source).."#00FF00 Ha combiar su team a #0B00FF("..team..") ", plr, r, g, b, true) outputChatBox("#00FF00Combiar #FF0000"..getPlayerName(plr).."#00FF00 team a #0B00FF("..team..") ", source, r, g, b, true) end end end addEventHandler("AdminPanel.setTeam", root, setTeam) Link to comment
TorNix~|nR Posted July 10, 2016 Author Share Posted July 10, 2016 nothing in debug, but is not work:/ Link to comment
TorNix~|nR Posted July 10, 2016 Author Share Posted July 10, 2016 anyone can help please? Link to comment
Walid Posted July 10, 2016 Share Posted July 10, 2016 nothing in debug, but is not work:/ local inValidTeams = {["TeamName"] = true} -- replace teamName with the team you want addEvent("AdminPanel.setTeam", true) function setTeam(plr, getText) if plr and isElement(plr) then if getText then local team = getTeamFromName(getText) if not team then team = getText end if inValidTeams[getTeamName(team)] then -- you can use getTeamName or simply replace it with getText outputChatBox("#00FF00Este arma es solo para #FF0000[ADM]", client, r, g, b, true) return end setPlayerTeam(plr, team) outputChatBox("#FF0000" ..getPlayerName(client).."#00FF00 Ha combiar su team a #0B00FF("..getTeamName(team)..") ", plr, 0, 255, 0, true) outputChatBox("#00FF00Combiar #FF0000"..getPlayerName(plr).."#00FF00 team a #0B00FF("..getTeamName(team)..") ", client, 0, 255, 0, true) end end end addEventHandler("AdminPanel.setTeam", root, setTeam) Link to comment
TorNix~|nR Posted July 10, 2016 Author Share Posted July 10, 2016 works fine, thanks Walid Link to comment
Walid Posted July 10, 2016 Share Posted July 10, 2016 works fine, thanks Walid Posting all your problems on the forum will never make you better in Lua language try to fix all of them by yourself , anyways you are welcome. Link to comment
TorNix~|nR Posted July 10, 2016 Author Share Posted July 10, 2016 Thanks walid, but I'm beginner and I need to learn, and with time I will be for exp: like you 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