Jump to content

help lock and unlock addCommandHandler


iiv03

Recommended Posts

Hello there I want to ask how make switch lock and unlock?

example: If a player enter a team and cannot

I want someone else if he wrote
/join
can not access FIRST and SECOND team only

If i type

/djoin
stops of entering people in team

..

i don't want make that with ACL Group is there another way?

i tried this and it didn't work

 

addCommandHandler("djoin", function(command, teamId)
	teamId = tonumber(teamId) or false
	if not teamId == 1 then
		team = clanwar.homeTeam
outputChatBox("work", root, 255, 255, 255, true)
		teamColor = clanwar.homeTeamData.color
	elseif teamId == 2 then
		team = clanwar.guestTeam
end
end)

 

my code

addCommandHandler("join", function(player, command, teamId)
	teamId = tonumber(teamId) or false
	if not teamId then
		outputChatBox("Syntax: /join [id]", player, 255, 0, 0, true)
		return
	end
	local team = nil
	local teamColor = "#FFFFFF"
	if teamId == 0 then -- TEAM SPECTATORS
		team = clanwar.spectatorsTeam
	elseif teamId == 1 then -- FIRST TEAM
		team = clanwar.homeTeam
		teamColor = clanwar.homeTeamData.color
	elseif teamId == 2 then -- SECOND TEAM
		team = clanwar.guestTeam
		teamColor = clanwar.guestTeamData.color
	elseif teamId == 3 then -- TEAM SPTREAMING
		local accountName = getAccountName(getPlayerAccount(player))
		if not isObjectInACLGroup("user."..accountName, aclGetGroup("Streaming")) then
			outputChatBox("#313131ERROR #ffffff| You are not allowed to join this team #ff0000invisible", player, 255, 0, 0, true)
			return
		end
		team = clanwar.refereesTeam -- TEAM REFEREES
		local r, g, b = getTeamColor(clanwar.refereesTeam)
		teamColor = string.format("#%.2X%.2X%.2X", r, g, b)
	elseif teamId == 4 then
		local accountName = getAccountName(getPlayerAccount(player))
		if not isObjectInACLGroup("user."..accountName, aclGetGroup("Referees")) then
			outputChatBox("#313131ERROR #ffffff| You are not allowed to join this team #ff0000invisible", player, 255, 0, 0, true)
			return
		end
		team = clanwar.streamersTeam
		local r, g, b = getTeamColor(clanwar.streamersTeam)
		teamColor = string.format("#%.2X%.2X%.2X", r, g, b)
	else
		outputChatBox("Please enter an id between 0 and 4.", player, 255, 0, 0, true)
		return
	end
	if getPlayerTeam(player) == team then
		outputChatBox("You are already in "..getTeamName(team)..".", player, 255, 0, 0, true)
		return
	end
	if not team then
		return
	end
	setPlayerTeam(player, team)
	outputChatBox("#FF8800* #FFFFFF"..getPlayerName(player).." #FFFFFFhas joined "..teamColor..getTeamName(team), root, 255, 255, 255, true)
end)

 

Edited by xFabel
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...