Jump to content

[HELP] inObjectInACLGroup Offline players


Seba500PLK

Recommended Posts

hi, I can do that showed the players offline?

  
--Server 
function getgroup (player) 
players = getElementsByType ( "player" ) 
admins = "" 
for k,v in ipairs(players) do 
   local accountname = "" 
   if (isGuestAccount(getPlayerAccount(v)) == false) then 
      accountname = getAccountName (getPlayerAccount(v)) 
       
      if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "BazaAdminow" ) ) then 
         if (admins == "") then 
            admins = getAccountName (getPlayerAccount(v)) 
         else 
            admins = admins .. ", " .. getAccountName (getPlayerAccount(v)) 
         end 
      end 
   end 
end 
outputChatBox( "Base Own:", player, 255, 255, 0) 
outputChatBox( " " .. tostring ( admins ), player, 255, 255, 0) 
end 
addCommandHandler ("gettest", getgroup) 
  

Link to comment

[2014-08-15 22:28:33] ERROR: [DayZ-MTA]/infopanel/infos.lua:6: bad argument #1 to 'ipairs' (table expected, got boolean)

[2014-08-15 22:28:33] WARNING: [DayZ-MTA]/infopanel/infos.lua:4: Bad argument @ 'getElementsByType' [Expected string at argument 1, got table]

[2014-08-15 22:28:33] WARNING: [DayZ-MTA]/infopanel/infos.lua:3: Bad argument @ 'getAccountPlayer' [Expected account at argument 1, got

trying to figure something out, but I do not it goes

  
function getgroup (player ) 
local thePlayer = getAccountPlayer ( getAccounts () )   
players = getElementsByType ( thePlayer ) 
admins = "" 
for k,v in ipairs(players) do 
   local accountname = "" 
   if (isGuestAccount(getPlayerAccount(v)) == false) then 
      accountname = getAccountName (getPlayerAccount(v)) 
       
      if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "BazaAdminow" ) ) then 
         if (admins == "") then 
            admins = getAccountName (getPlayerAccount(v)) 
         else 
            admins = admins .. ", " .. getAccountName (getPlayerAccount(v)) 
         end 
      end 
   end 
end 
outputChatBox( "Base Owns:", player, 255, 255, 0) 
outputChatBox( " " .. tostring ( admins ), player, 255, 255, 0) 
end 
addCommandHandler ("gettest", getgroup)  
  

Link to comment

...You have no idea what you are doing, right?

First get all accounts (getAccounts())

Then use a loop on that table.

Then get the player who is using the account at that moment (getAccountPlayer())

If it is false it's not in use so you could call that offline, otherwise online.

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