Jump to content

I need to restrict a skin for the admin


Recommended Posts

server-side

  
addEventHandler ("onElementModelChange", getRootElement (), 
    function (oldModel, newModel) 
        local function isPlayerAdmin (thePlayer) 
            local aclAdminGroup = aclGetGroup ("Admin"); 
            local playerAccount = getPlayerAccount (thePlayer); 
            local playerAccountName = getAccountName (playerAccount); 
            return isObjectInACLGroup ("user." .. playerAccountName, aclAdminGroup); 
        end; 
        if getElementType (source) ~= "player" then return; end; 
        if (newModel == 217) and (not isPlayerAdmin (source)) then 
            outputChatBox (getPlayerName (source) .. ", skin 217 is just for admins!", source, 255, 0, 0); 
            -- restore old skin. 
            if oldModel == 217 then return; end; -- avoid stack overflow. 
            -- small delay to restore again the model. 
            setTimer (setElementModel, 50, 1, source, oldModel); 
        end; 
    end); 
  

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