Jump to content

[Help] using split


Mr.Loki

Recommended Posts

when i change the resource settings in the admin panel and i add multiple ACL groups to get('cinemaCommand') it does not work but if I change the setting to only have 1 ACL group it works.

addEventHandler('onPlayerCommand',root, 
    function(comm) 
        if comm == get('cinemaCommand') then 
            acls = get('cinemaACLAccess') 
            gnames = split(acls, ',') 
            for i, group in ipairs(gnames)do 
                if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup(group)) then 
                    triggerClientEvent('openViewer',source) 
                else 
                    triggerClientEvent('stvi',source,"You do not have access to this command.") 
                end 
            end 
        end 
    end 
) 

Link to comment

Try this

addEventHandler('onPlayerCommand',root, 
    function(comm) 
        if comm == get('cinemaCommand') then 
           local acls = get('cinemaACLAccess') 
           local gnames = split(acls, ';') 
            for i, group in ipairs(gnames)do 
                if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup(group)) then 
                    triggerClientEvent('openViewer',source) 
                else 
                    triggerClientEvent('stvi',source,"You do not have access to this command.") 
            end 
        end 
    end 
end) 

Edited by Guest
Link to comment

wow the script just randomly started to working... just wtf....

first i tried your code and it worked then i tried the original code and it also worked

If im not wrong, you can't send a full message like outputChatBox message inside the trigger functions
triggerClientEvent('stvi',source,"You do not have access to this command.") 

yep you can lol works like normal outputChatbox

kbl0976.png

now my problem is since im using for to loop through my function it has to run through all the groups so even tho im in admin and im not in moderator, the window would show and i'd get the access denied text how can i cancel it?

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