Jump to content

Give team problem


Recommended Posts

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

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

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