Jump to content

alcgroupaddobject


-misterX-

Recommended Posts

Posted

two things, one, (line 26) the console reports warning bad argument; two (line 29) error attempt to concatenate local ourGroup a boolean value

    function addACLGroupObject ( thePlayer, commandName, groupName) 
        local ourGroup = aclGetGroup ( groupName ) 
        -- if there is no previous group with this name, we need to create one 
        if ourGroup then 
        warnText("this goup already exist",thePlayer)     
         end      
            ourGroup = aclCreateGroup ( groupName ) 
         -- and finally let's add the object to it's group 
        local account = getPlayerAccount(thePlayer) 
        local accountN = getAccountName(account) 
        aclGroupAddObject ( ourGroup, 'user.'..accountN ) 
        setAccountData(account, "group", ourGroup) 
        setElementData(thePlayer, "group", ourGroup) 
        warnText( "Group created:"..ourGroup , thePlayer ) 
        -- don't forget to save the ACL after it has been modified 
        aclSave () 
         
    end 
    addCommandHandler ( "creategroup", addACLGroupObject ) 
  

Posted
two things, one, (line 26) the console reports warning bad argument; two (line 29) error attempt to concatenate local ourGroup a boolean value
    function addACLGroupObject ( thePlayer, commandName, groupName) 
        local ourGroup = aclGetGroup ( groupName ) 
        -- if there is no previous group with this name, we need to create one 
        if ourGroup then 
        warnText("this goup already exist",thePlayer)     
         end      
            ourGroup = aclCreateGroup ( groupName ) 
         -- and finally let's add the object to it's group 
        local account = getPlayerAccount(thePlayer) 
        local accountN = getAccountName(account) 
        aclGroupAddObject ( ourGroup, 'user.'..accountN ) 
        setAccountData(account, "group", ourGroup) 
        setElementData(thePlayer, "group", ourGroup) 
        warnText( "Group created:"..ourGroup , thePlayer ) 
        -- don't forget to save the ACL after it has been modified 
        aclSave () 
         
    end 
    addCommandHandler ( "creategroup", addACLGroupObject ) 
  

you need this for all player?

Welcom to my server Q.5

Current game type in my server Drift

350x20_FFFFFF_FFFFFF_000000_000000.png

my Email : [email protected]

Programming level: 90%

Posted
  
  
 function addACLGroupObject ( thePlayer, commandName, groupName) 
        local ourGroup = aclGetGroup ( groupName ) 
        -- if there is no previous group with this name, we need to create one 
        if ourGroup then 
        return warnText("this goup already exist",thePlayer)     
        end     
        ourGroup = aclCreateGroup ( groupName ) 
         -- and finally let's add the object to it's group 
        local account = getPlayerAccount(thePlayer) 
        local accountN = getAccountName(account) 
        aclGroupAddObject ( ourGroup, 'user.'..accountN ) 
        setAccountData(account, "group", ourGroup) 
        setElementData(thePlayer, "group", ourGroup) 
        warnText( "Group created:"..ourGroup , thePlayer ) 
        -- don't forget to save the ACL after it has been modified 
        aclSave () 
        
    end 
    addCommandHandler ( "creategroup", addACLGroupObject ) 
  
  

Welcom to my server Q.5

Current game type in my server Drift

350x20_FFFFFF_FFFFFF_000000_000000.png

my Email : [email protected]

Programming level: 90%

Posted
yes i need it for all players

and still reports the same error, cant concatenate

write command with player name or account?

Welcom to my server Q.5

Current game type in my server Drift

350x20_FFFFFF_FFFFFF_000000_000000.png

my Email : [email protected]

Programming level: 90%

Posted

ourGroup is not a string, it's an ACL group, so can't concatenate it.

  
-- use this 
warnText( "Group created:"..groupName , thePlayer ) 
-- or this: 
warnText( "Group created:"..aclGroupGetName(ourGroup) , thePlayer ) 
  

Owner of [HUN]Magyar Play Szerver 1.4, IP: 31.220.43.153:22003

Posted
  
 function addACLGroupObject ( thePlayer, commandName, groupName) 
        local ourGroup = aclGetGroup ( groupName ) 
        -- if there is no previous group with this name, we need to create one 
        if ourGroup then 
            return warnText("this goup already exist",thePlayer)     
        end     
        ourGroup = aclCreateGroup ( groupName ) 
         -- and finally let's add the object to it's group 
        local account = getPlayerAccount(thePlayer) 
        local accountN = getAccountName(account) 
        aclGroupAddObject ( ourGroup, 'user.'..accountN ) 
        setAccountData(account, "group",tostring(groupName)) 
        setElementData(thePlayer, "group", tostring(groupName)) 
        warnText( "Group created:"..tostring(groupName), thePlayer ) 
        -- don't forget to save the ACL after it has been modified 
        aclSave () 
    end 
    addCommandHandler ( "creategroup", addACLGroupObject ) 
  
  

Welcom to my server Q.5

Current game type in my server Drift

350x20_FFFFFF_FFFFFF_000000_000000.png

my Email : [email protected]

Programming level: 90%

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