-misterX- Posted January 6, 2013 Share Posted January 6, 2013 how do i create a team by using a command i mean something /createteam teamname on the wiki i didn't see how to add information on addCommandHandler just how link it to a function Link to comment
Castillo Posted January 6, 2013 Share Posted January 6, 2013 addCommandHandler createTeam Click on both functions, both have examples, read them, try to understand them, then make it, if it doesn't work, post it here and we'll help you. Link to comment
Baseplate Posted January 6, 2013 Share Posted January 6, 2013 function createNewTeam (playerSource, cmd, team) local newTeam = createTeam(team) setPlayerTeam(playerSource, newTeam) end addCommandHandler("createteam", createNewTeam) Not sure if works, give it a shot and then reply if it works or not. Link to comment
myonlake Posted January 7, 2013 Share Posted January 7, 2013 function createNewTeam (playerSource, cmd, team) local newTeam = createTeam(team) setPlayerTeam(playerSource, newTeam) end addCommandHandler("createteam", createNewTeam) Not sure if works, give it a shot and then reply if it works or not. Good, but it won't work at some points. Check at my code, it has more checks to it and shizzle. Server-side addCommandHandler("createteam", -- The command is "createteam" function(player, cmd, team) if team then -- Check if the parameter has been entered local team = table.concat({...}, " ") -- Make sure all the spaces are gathered if #team > 1 then -- Check if the parameter is longer than one letter local newTeam = createTeam(team) -- Create the actual team setPlayerTeam(player, newTeam) -- Set the player into the team outputChatBox("Team created and you were set to the team.", player, 10, 255, 10, false) -- Output a message to the player else outputChatBox("Syntax: /" .. cmd .. " [team name]", player, 255, 180, 10, false) -- Returns this when the parameter is not longer than one letter end else outputChatBox("Syntax: /" .. cmd .. " [team name]", player, 255, 180, 10, false) -- Returns this when the parameter has not been entered end end ) Link to comment
xXMADEXx Posted January 7, 2013 Share Posted January 7, 2013 Try this code (i have not tested it) function createMyTeam(player,cmd,...,c1,c2,c3) -- Discribes the command local text = table.concat({...}, " ") -- Get text for team name myTeam = createTeam(...,c1,c2,c3) -- Create the team setPlayerTeam(player,myTeam) -- Set Play to the team that they have just created end -- ends function addCommandHandler("createteam", createMyTeam) -- Command --[[ The command Syntax is /createteam teamname colorRed colorGreen colorBlue For Example: /createteam 255 255 0 --]] Link to comment
50p Posted January 7, 2013 Share Posted January 7, 2013 Try this code (i have not tested it) function createMyTeam(player,cmd,...,c1,c2,c3) -- Discribes the command local text = table.concat({...}, " ") -- Get text for team name myTeam = createTeam(...,c1,c2,c3) -- Create the team setPlayerTeam(player,myTeam) -- Set Play to the team that they have just created end -- ends function addCommandHandler("createteam", createMyTeam) -- Command --[[ The command Syntax is /createteam teamname colorRed colorGreen colorBlue For Example: /createteam 255 255 0 --]] Your code is wrong in many aspects. You are not experienced enough to post such simple scripts without testing and confusing people. Please don't post incorrect code to confuse people even more. 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