Jump to content

I keep getting this warning


marty000123

Recommended Posts

The problem is (as you may think) that whatever is in the second argument of the function isObjectInACLGroup at line 98 of the resource admintag, file server.lua, is returning (probably) false.

Can you give us the code of that file (server.lua)? At least the portion around that line including also the functions there called.

This way we can see where the cause of the error "start", and how to fix/handle it.

 

Also, by reading the wiki, i can assume that at the second argument there's a call to the function aclGetGroup, which  Returns false/nil if it [the acl group] did not exist or [the function itslef] failed for some reason.

Edited by LoPollo
Link to comment

   

     for _,v in ipairs(settings['adminTag']['ACL']) do
            if isObjectInACLGroup('user.' .. account, aclGetGroup(v[1])) and check == 0 and not spam[serial] then
                local message = v[2] .. RGBToHex(r, g, b) .. name .. ":#FFFFFF " .. text

 

If you need more lines please let me know.

Link to comment

The string in v[1] (where v is every value of settings['adminTag']['ACL'] ) is not a valid ACL group (and therefore the aclGetGroup returns false). You could try adding an outputChatBox (or equivalent) to see what v[1] contain:

		for _,v in ipairs(settings['adminTag']['ACL']) do
  			outputChatBox(v[1])
			if isObjectInACLGroup('user.' .. account, aclGetGroup(v[1])) and check == 0 and not spam[serial] then
				local message = v[2] .. RGBToHex(r, g, b) .. name .. ":#FFFFFF " .. text

Is the outputted value supposed to be an acl group? And is it a string in first place?

Edited by LoPollo
Link to comment
1 hour ago, marty000123 said:

   


     for _,v in ipairs(settings['adminTag']['ACL']) do
            if isObjectInACLGroup('user.' .. account, aclGetGroup(v[1])) and check == 0 and not spam[serial] then
                local message = v[2] .. RGBToHex(r, g, b) .. name .. ":#FFFFFF " .. text

 

 

If you need more lines please let me know.

Post the full function

Link to comment

@Gravestone i'm more interested about the content of settings['adminTag']['ACL']

It should be a table containing tables starting with the string of the acl group: if this is defined somewhere, it would be helpful seeing it.

Otherwise are required all the functions that access this variable, with all the functions that calls these function, and all these functions that call these... basically all the script xD

Edited by LoPollo
  • Like 1
Link to comment

settings['adminTag']['ACL'] is a table of tables starting with the string of an acl group :/

these are the groups defined in the script

  1.         { 'serverowner', '#FFFF00Server Owner ' },
  2.         { 'HQStaff', '#FFFF00HQ STAFF ' },
  3.         { 'Administrator', '#FFFF00Administrator ' },
  4.         { 'SeniorMod', '#FFFF00Senior Mod ' },
  5.         { 'Modgroup', '#FFFF00Moderator ' },
  6.         { 'Probationary', '#FFFF00Probationary ' },
  7.         { 'Scripter', '#FFFF00Scripter ' },
  8.         { 'Mapper', '#FFFF00Mapper ' },
  9.         { 'Premium', '#FF0000[Premium] '},
  10.         { 'VIP', '#9900FF[VIP] '},
  11.         { 'dp', '#00FFFFVeteran '},
  12.         { 'Everyone', ' ' }
 
They are supposed to be valid: so the only reason for aclGetGroup to return false is that, even if the "syntax" is valid, the group does not exists.
 
By default MTA has these groups: (source)
  • Everyone
  • Moderator
  • SuperModerator
  • Admin
  • Console
  • RPC

 

so when the script tries to find the group that are not specified in the acl.xml file the aclGetGroup returns false and the problem starts. So if until now i did not forgot anything and didn't make any error, there are these solutions:

  • Add a check to the script: if the group does not exists then for sure there are no players in it
  • Edit the part of the script where the groups are defined (the part i posted above)
  • Edit the acl (when server is off) adding these groups

A mix of these is also possible.

 

Notes: with the first solution players in groups that are not defined within the script will cause problems, so i recommend the second solution

Edited by LoPollo
  • Like 1
Link to comment

I still don't have a clue about what to do because the script works, I added those groups to the ACL, and it's giving a Warning as output, not an ERROR. So everything should be fine but still it gives the warning everytime someone says something. I really suck at scripting so I'm probably missing something obvious.

Link to comment

I can't see why it gives you the warning if you edited the acl and then all the groups are found :/ is the warning the same?

WARNING: admintag\server.lua:98: Bad argument @ 'isObjectInACLGroup' [Expected acl-group at argument 2, got boolean]

I still suggest to add the default groups to the script to prevent a player in these groups (defined in the acl but not in the script) gets not properly handled

Edited by LoPollo
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...