• Possible to restrict ULX commands to a job?
    1 replies, posted
I'm having trouble trying to restrict the command !noclip to the job Staff on Duty and was hoping somebody could help. [CODE]------------------------------ Noclip ------------------------------ function ulx.noclip( calling_ply, target_plys ) if not target_plys[ 1 ]:IsValid() then Msg( "You are god, you are not constrained by walls built by mere mortals.\n" ) return end local affected_plys = {} for i=1, #target_plys do local v = target_plys[ i ] if v.NoNoclip then ULib.tsayError( calling_ply, v:Nick() .. " can't be noclipped right now.", true ) else if v:GetMoveType() == MOVETYPE_WALK then v:SetMoveType( MOVETYPE_NOCLIP ) table.insert( affected_plys, v ) elseif v:GetMoveType() == MOVETYPE_NOCLIP then v:SetMoveType( MOVETYPE_WALK ) table.insert( affected_plys, v ) else -- Ignore if they're an observer ULib.tsayError( calling_ply, v:Nick() .. " can't be noclipped right now.", true ) end end end end local noclip = ulx.command( CATEGORY_NAME, "ulx noclip", ulx.noclip, "!noclip" ) noclip:addParam{ type=ULib.cmds.PlayersArg, ULib.cmds.optional } noclip:defaultAccess( ULib.ACCESS_ADMIN ) noclip:help( "Toggles noclip on target(s)." )[/CODE] Above is the code for the noclip module in ULX, I doubt editing this is the way to resolve this problem so any other solutions would be greatly appreciated!
[QUOTE=archolas;49405993]I'm having trouble trying to restrict the command !noclip to the job Staff on Duty and was hoping somebody could help. [CODE]------------------------------ Noclip ------------------------------ function ulx.noclip( calling_ply, target_plys ) if not target_plys[ 1 ]:IsValid() then Msg( "You are god, you are not constrained by walls built by mere mortals.\n" ) return end local affected_plys = {} for i=1, #target_plys do local v = target_plys[ i ] if v.NoNoclip then ULib.tsayError( calling_ply, v:Nick() .. " can't be noclipped right now.", true ) else if v:GetMoveType() == MOVETYPE_WALK then v:SetMoveType( MOVETYPE_NOCLIP ) table.insert( affected_plys, v ) elseif v:GetMoveType() == MOVETYPE_NOCLIP then v:SetMoveType( MOVETYPE_WALK ) table.insert( affected_plys, v ) else -- Ignore if they're an observer ULib.tsayError( calling_ply, v:Nick() .. " can't be noclipped right now.", true ) end end end end local noclip = ulx.command( CATEGORY_NAME, "ulx noclip", ulx.noclip, "!noclip" ) noclip:addParam{ type=ULib.cmds.PlayersArg, ULib.cmds.optional } noclip:defaultAccess( ULib.ACCESS_ADMIN ) noclip:help( "Toggles noclip on target(s)." )[/CODE] Above is the code for the noclip module in ULX, I doubt editing this is the way to resolve this problem so any other solutions would be greatly appreciated![/QUOTE] Well, one way you could do it is to make a check using: [url]https://wiki.garrysmod.com/page/team/GetName[/url]
Sorry, you need to Log In to post a reply to this thread.