.:HyPeX:. Posted January 30, 2014 Posted January 30, 2014 what im doing wrong here? '}' expected near '=' teams.newteam = {"name" = ""..tagname.."","tag" = ""..gettaglower.."" } My ingame nick is ~HyPeX~ BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager
xXMADEXx Posted January 30, 2014 Posted January 30, 2014 Here: local teams = { newteam = { ['name'] = tagname, -- Make sure "tagname" is defined ['tag'] = gettaglower, -- make sure "gettaglower" is defined } } The Ultimate Lua Tutorial! | MTA PHP SDK
.:HyPeX:. Posted January 30, 2014 Author Posted January 30, 2014 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) My ingame nick is ~HyPeX~ BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager
xXMADEXx Posted January 30, 2014 Posted January 30, 2014 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... The Ultimate Lua Tutorial! | MTA PHP SDK
.:HyPeX:. Posted January 30, 2014 Author Posted January 30, 2014 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. My ingame nick is ~HyPeX~ BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager
Sasu Posted January 30, 2014 Posted January 30, 2014 teams[newteam] = { ['name'] = tagname, -- Make sure "tagname" is defined ['tag'] = gettaglower, -- make sure "gettaglower" is defined } Also make sure "team" is defined as table. State: Inactive
.:HyPeX:. Posted January 30, 2014 Author Posted January 30, 2014 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. My ingame nick is ~HyPeX~ BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager
Bilal135 Posted January 30, 2014 Posted January 30, 2014 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. "Get busy living or get busy dying"
.:HyPeX:. Posted January 30, 2014 Author Posted January 30, 2014 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) My ingame nick is ~HyPeX~ BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager
Sasu Posted January 30, 2014 Posted January 30, 2014 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) State: Inactive
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