Ulysses
General => Developers Corner => Topic started by: KiddleyWiffers on August 12, 2018, 05:06:40 PM
-
Hello. I opened a Breach server, and made a custom command that allows people to open Gate A as the newest version of the map broke the command. The only problem is the people. I recently found out that anyone can open Gate A using the command. Is there a way I could make my command only available to the following teams.
TEAM_GUARD
TEAM_CHAOS
Thanks in advance for whoever helps me figure this out.
-
For this you need the function to check a player's team.
but in your code you could do something like this..
if ply:GetPlayerTeam() == "TEAM_GUARD" or ply:GetPlayerTeam() == "TEAM_CHAOS" then
>>code to open gate here<<
end
Obviously you need to replace the ply:GetPlayerTeam() with the function provided by the gamemode for getting their team.
-
For this you need the function to check a player's team.
but in your code you could do something like this..
if ply:GetPlayerTeam() == "TEAM_GUARD" or ply:GetPlayerTeam() == "TEAM_CHAOS" then
>>code to open gate here<<
end
Obviously you need to replace the ply:GetPlayerTeam() with the function provided by the gamemode for getting their team.
I have been messing with this for a few days and still can't get it to work. This is what I have so far.
---[Open gate a]-------------------------------------------------------------------------
function ulx.opengatea(calling_play, should_silent)
if ply:GTeam() == TEAM_GUARD or ply:GTeam() == TEAM_CHAOS then // Team check for the gamemode
game.ConsoleCommand("ulx ent_fire gate_containment_door_r open\n") // The two commands I used to open Gate A
game.ConsoleCommand("ulx ent_fire gate_containment_door_l open\n")
end
end
local opengatea = ulx.command(CATEGORY_NAME, "ulx opengatea", ulx.opengatea, "!opengatea")
opengatea:defaultAccess(ULib.ACCESS_SUPERADMIN)
opengatea:help("Open Gate A (ONLY MTF and CI).")
---[End]----------------------------------------------------------------------------------------
---[Admin Open gate a]-------------------------------------------------------------------------
function ulx.adminopengatea(calling_play)
game.ConsoleCommand("ulx ent_fire gate_containment_door_r open\n")
game.ConsoleCommand("ulx ent_fire gate_containment_door_l open")
end
local adminopengatea = ulx.command(CATEGORY_NAME, "ulx adminopengatea", ulx.adminopengatea, "!adminopengatea")
adminopengatea:defaultAccess(ULib.ACCESS_SUPERADMIN)
adminopengatea:help("Open Gate A as any class.")
---[End]----------------------------------------------------------------------------------------
The command worked before, but not even adminopengatea is working now, which is just a copy and past of my first command. The ent_fire command opens it when I use it on its own, and the door opens, but the actual commands I have set up for it don't work.