Stylez Posted July 8, 2013 Share Posted July 8, 2013 hey i created this function, but i it doesnt work.. every time when i /team blue nick it outputs Wrong syntax : /team [teamName] [playerToAdd]" function adminCanAddTeam(thePlayer, command, playerName, teamName) if hasObjectPermissionTo(thePlayer, "function.ban", true) then local playerToAdd = getPlayerFromName(playerName) if playerToAdd then outputChatBox(playerToAdd) local isCreated = getTeamFromName(teamName) if isCreated then outputChatBox("team exists", thePlayer, 255,150,0) else createTeam(teamName) setPlayerTeam(playerToAdd, teamName) outputChatBox(playerToAdd) end else outputChatBox("Wrong syntax : /team [teamName] [playerToAdd]", thePlayer, 255, 150,0) end end end addCommandHandler("team", adminCanAddTeam) Link to comment
iPrestege Posted July 8, 2013 Share Posted July 8, 2013 Hello Stylez! Try this : addCommandHandler('team', function ( player,command,team,traget ) if not traget or not team then return outputChatBox ( 'Wrong syntax : /team [teamName] [playerToAdd]',player,255,150,0 ) end if not hasObjectPermissionTo( player, "function.ban", true ) then return false end local returnTraget = getPlayerFromName ( tostring ( traget ) ) if getTeamFromName ( tostring ( team ) ) and returnTraget then outputChatBox ( 'Team Found!' ) outputChatBox ( getPlayerName ( returnTraget ) ) else new = createTeam ( tostring ( team ) ) setPlayerTeam ( returnTraget,new ) outputChatBox ( 'Team Not Found Team Has Been Created!' ) outputChatBox ( getPlayerName ( returnTraget ) ) end end ) Link to comment
Stylez Posted July 8, 2013 Author Share Posted July 8, 2013 Thankyouuu! now im gonna read ur script 10 times to understand what you did 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