Jump to content

isObjectInACLGroup script problem


wajsic

Recommended Posts

Hello! I have a problem. I have wrote this script:

  
addCommandHandler ( "wajsic", 
   function (thePlayer) 
        local accountname = getAccountName ( getPlayerAccount ( thePlayer ) ) 
        if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "admin" ) ) then 
        setElementPosition( thePlayer, 1257.8564453125, -775.72027587891, 92.03125 ) 
        end 
    end 
) 
  

Problem is that I get an error:

\script.lua: attempt to concatenate global 'accountname' (a nil value)

What could it be?

Thanks!

Link to comment
addCommandHandler ( "wajsic", 
   function (thePlayer) 
        local account = getPlayerAccount ( thePlayer ) 
        if account then 
        local accountname = getAccountName ( account ) 
        if isObjectInACLGroup ( "user." .. tostring(accountname), aclGetGroup ( "admin" ) ) then 
        setElementPosition( thePlayer, 1257.8564453125, -775.72027587891, 92.03125 ) 
           end 
        end 
    end 
) 

Try that.

Btw, you are doing it server side, right?

Link to comment

I found your problem, you put as group: "admin" but it's "Admin" with big A

addCommandHandler ( "wajsic", 
   function (thePlayer) 
        local account = getPlayerAccount ( thePlayer ) 
        if account then 
        local accountname = getAccountName ( account ) 
        if isObjectInACLGroup ( "user." .. tostring(accountname), aclGetGroup ( "Admin" ) ) then 
        setElementPosition( thePlayer, 1257.8564453125, -775.72027587891, 92.03125 ) 
           end 
        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...