Jump to content

Table Error


.:HyPeX:.

Recommended Posts

Here:
local teams = {  
    newteam = { 
        ['name'] = tagname, -- Make sure "tagname" is defined 
        ['tag'] = gettaglower, -- make sure "gettaglower" is defined 
    } 
} 

Yeah, but newteam is defined, will it work? Like i wanna create a new team with the variable newteam (i set that variable each time the code is run)

Link to comment
Here:
local teams = {  
    newteam = { 
        ['name'] = tagname, -- Make sure "tagname" is defined 
        ['tag'] = gettaglower, -- make sure "gettaglower" is defined 
    } 
} 

Yeah, but newteam is defined, will it work? Like i wanna create a new team with the variable newteam (i set that variable each time the code is run)

I'm not too sure what you mean...

Link to comment
Here:
local teams = {  
    newteam = { 
        ['name'] = tagname, -- Make sure "tagname" is defined 
        ['tag'] = gettaglower, -- make sure "gettaglower" is defined 
    } 
} 

Yeah, but newteam is defined, will it work? Like i wanna create a new team with the variable newteam (i set that variable each time the code is run)

I'm not too sure what you mean...

I want to create teams with the command /newteam, and the function takes: (player,cmd,newteam,tagname,gettaglower), and i want to create the teams with those variables.

Link to comment
  
teams[newteam] = {  
        ['name'] = tagname, -- Make sure "tagname" is defined 
        ['tag'] = gettaglower, -- make sure "gettaglower" is defined 
    }  

Also make sure "team" is defined as table.

Yes, i did that myself on the script for avoid any mistakes, just like that, and it is all defined.

Link to comment
function createteam (TeamName, color) 
    local teams = { 
        newteam = { 
            ['name'] = tagname, -- Make sure "tagname" is defined 
            ['tag'] = gettaglower, -- make sure "gettaglower" is defined 
        } 
    } 
end 
     end 
           end 
addCommandHandler (''createteam getTeamName color'', createteam) 

Put it in the end and type /createteam TeamName color I'm not sure this will work or not coz I'm not good in scripting.

Link to comment
function createteam (TeamName, color) 
    local teams = { 
        newteam = { 
            ['name'] = tagname, -- Make sure "tagname" is defined 
            ['tag'] = gettaglower, -- make sure "gettaglower" is defined 
        } 
    } 
end 
     end 
           end 
addCommandHandler (''createteam getTeamName color'', createteam) 

Put it in the end and type /createteam TeamName color I'm not sure this will work or not coz I'm not good in scripting.

Just nevermind, that was only a small part of the code:

  
local teams = {} 
local teamacl = {} 
function CreateNewTeam(player, cmd, newteam, tagname, gettag) 
if not gettag then 
outputChatBox("Please Specify the command completly!", getRootElement()) 
return  
end 
  
  
if (isObjectInACLGroup("user"..(getAccountName(getPlayerAccount(player))), aclGetGroup("Admin"))) then 
-- Check team 
    if not teams.newteam then 
        for v, i in ipairs(teams) do 
-- Check name 
            if string.match(teams.v.name, tagname) then 
            return outputChatBox('Tag Name is already occupied!', player) 
            end 
-- Check tag 
                if string.match(teams.v.tag, gettag) then 
                return outputChatBox('Tag recognizing is already occupied!', player) 
                end 
  
        end 
local gettaglower = string.lower(gettag) 
teams.newteam = {["name"] = ""..tagname.."", 
                 ["tag"] = ""..gettaglower.."" 
                 } 
  
teamacl.newteam = aclCreateGroup(newteam) 
triggerEvent("onCreateNewTeam", newteam) 
  
    else 
    outputChatBox("Team already exists!", player) -- Team already exists 
    end 
else 
outputChatBox("You cant use this!", player) 
end 
end 
addCommandHandler("newteam", CreateNewTeam, false,false) 

Link to comment
  
local teams = {} 
local teamacl = {} 
function CreateNewTeam(player, cmd, newteam, tagname, gettag) 
if not gettag then 
outputChatBox("Please Specify the command completly!", getRootElement()) 
return  
end 
  
  
if (isObjectInACLGroup("user"..(getAccountName(getPlayerAccount(player))), aclGetGroup("Admin"))) then 
-- Check team 
    if not teams.newteam then 
        for v, i in ipairs(teams) do 
-- Check name 
            if string.match(teams.v.name, tagname) then 
            return outputChatBox('Tag Name is already occupied!', player) 
            end 
-- Check tag 
                if string.match(teams.v.tag, gettag) then 
                return outputChatBox('Tag recognizing is already occupied!', player) 
                end 
  
        end 
local gettaglower = string.lower(gettag) 
teams[newteam] = {["name"] = ""..tagname.."", 
                 ["tag"] = ""..gettaglower.."" 
                 } 
  
teamacl[newteam] = aclCreateGroup(newteam) 
triggerEvent("onCreateNewTeam", newteam) 
  
    else 
    outputChatBox("Team already exists!", player) -- Team already exists 
    end 
else 
outputChatBox("You cant use this!", player) 
end 
end 
addCommandHandler("newteam", CreateNewTeam, false,false)  

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