Jump to content

problem /staff command


Jullul7000

Recommended Posts

why is it not working ??? everyone can use the command

local allowedGroups = {"Owner", "HeadAdmin", "SuperModerator", "Moderator", "Trialstaff"} 
local Staff = createTeam ( "Staff", 126, 0, 145 ) 
  
function SetSkinAndTeam ( player ) 
    setElementModel ( player, 217 ) 
    setPlayerTeam ( player, Staff ) 
end 
addCommandHandler ( "staff", SetSkinAndTeam ) 

Link to comment

try it this way;

addEventHandler("onResourceStart", getRootElement(getThisResource()), 
    function() 
        Staff = createTeam ( "Staff", 126, 0, 145 ); 
    end 
); 
  
addCommandHandler ( "staff",  
    function ( player, command ) 
        setElementModel ( player, 217 ); 
        setPlayerTeam ( player, getTeamFromName("Staff") ); 
    end 
); 

Link to comment

Is because is not being restricted at all, use this:

local allowedGroups = { "Owner", "HeadAdmin", "SuperModerator", "Moderator", "Trialstaff" } 
local Staff = createTeam ( "Staff", 126, 0, 145 ) 
  
function SetSkinAndTeam ( player ) 
    local account = getPlayerAccount ( player ) 
    if ( not isGuestAccount ( account ) ) then 
        local accountName = getAccountName ( account ) 
        for _, group in ipairs ( allowedGroups ) do 
            if isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( group ) ) then 
                setElementModel ( player, 217 ) 
                setPlayerTeam ( player, Staff ) 
                break 
            end 
        end 
    end 
end 
addCommandHandler ( "staff", SetSkinAndTeam ) 

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...