Jump to content

[HELP] Bad argument @ 'getPlayerAccount', Bad argument @ 'getAccountName' and attempt to concatenate local 'accName' (a boolean value)


NovaCrew

Recommended Posts

I have 3 errors:
barierki/barierki.lua:4: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got nil]

barierki/barierki.lua:5: Bad argument @ 'getAccountName' [Expected account at argument 1, got boolean]

barierki/barierki.lua:6: attempt to concatenate local 'accName' (a boolean value)

I've tried to fix it but it's still not working.

How to fix this?

Here's the code:

barierki = {} 

addCommandHandler ( "barierka", function(plr)  
  local accName = getAccountName ( getPlayerAccount ( thePlayer ) )
  if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Policja" ) ) then
     x,y,z = getElementPosition ( plr ) 
     r1,r2,r3 = getElementRotation ( plr ) 
     barierka = createObject ( 1459, x, y, z, r1, r2, r3 ) 
     table.insert ( barierki, barierka )
   end
end 
)

addCommandHandler ( "busun", function(plr)
   local account = getPlayerAccount(thePlayer) 
   local accName = getAccountName ( getPlayerAccount ( thePlayer ) )
   if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Policja" ) ) then
      for k,v in ipairs ( barierki ) do 
         destroyElement ( v ) 
       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...