ULX how to make it so you can use certain commands as certain roles.

In excl’s jailbreak, i want to make it so the warden can use ulx rebel and ulx norebel. How would i do this?

I’m guessing in the actual command field itself you’d have to run a check to see if the ply:Team() == TEAM_WARDEN or some shit like that and if not just print to chat “You’re not the warden” or something like that. Shouldn’t be too hard.

i figured that it would be something similar to that, but i wasnt sure if it had to be within the command or in its own addon


function()	
	if not opposite then
		for k, v in pairs( player.GetAll() ) do
			if v:Team() == TEAM_WARDEN then
				--Rebel command here
			else
			calling_ply:ChatPrint( "You are not a Warden!" )
			end
		end
		ulx.fancyLogAdmin( calling_ply, "is rebelling" ) 
		else
		--Norebel command here
		ulx.fancyLogAdmin( calling_ply, "has finished rebelling" )
	end
end

local rebel = ulx.command( CATEGORY_NAME, "ulx rebel", ulx.rebel, "!rebel" )
rebel:addParam{ type=ULib.cmds.PlayerArg }
rebel:setOpposite = ( "ulx norebel", {_, true}, "!norebel", true )
rebel:defaultAccess( ULib.ACCESS_ALL )
rebel:help( "Rebel" )

This’ll get you started

What did you just post