iiv03 Posted November 2, 2019 Posted November 2, 2019 (edited) 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 November 2, 2019 by xFabel
Overkillz Posted November 3, 2019 Posted November 3, 2019 you can add a variable that check if is allowed to use the command. if theVariable then ... And that variable could be switched by a specific group like admin or whatever
komal Posted November 3, 2019 Posted November 3, 2019 try with setElementData() and getElementData() team getTeamFromName ( string teamName ) createTeam("streamersTeam") setElementData(getTeamFromName("streamersTeam"),"lock",true) if getElementData(getTeamFromName("streamersTeam"),"lock") then outputChatBox("you cant join the team right now ", root, 255, 255, 255, true) end
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