Jump to content

Give team problem


Recommended Posts

Posted

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)  

76561198387870432.png

ZI ZOMBIE INFECTION: mtasa://5.196.7.163:22003

560x95_FFFFFF_FF9900_000000_000000.png

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

Wolf Inc Discord

Youtube channel
Github

Posted

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)  

Wolf Inc Discord

Youtube channel
Github

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

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted
works fine, thanks Walid :D

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.

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

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