Jump to content

Access denied for getPlayerIP?


MaddDogg

Recommended Posts

Hi!

I just ran into a strange problem. Maybe someone could help me with it.

I wrote a script which amongst other things is supposed to save the player's ip in a database.

So I used getPlayerIP to return the IP for me which I then put into a query.

But for some reason I am getting the following result in the server.log (and no result ingame, the script stops executing the called function at this point):

WARNING: script.lua: Access denied @ 'getClientIP' - Line: 2

Odd is that it says 'getClientIP' although I used getPlayerIP. Even when I used getClientIP I got the exact same error message.

Then I asked myself, if I misunderstood a function or something else so I tried out the following code, which I copied from the wiki:

function printIp ( thePlayer )
outputChatBox ( "IP: " .. getPlayerIP ( thePlayer ), thePlayer )
end
addCommandHandler ( "ip", printIp )

And what did I get? The error message..

So, what is my problem? Is there anything I have to do or consider using this function?

I also use the 'admin' resource by lil_toady and here the function works fine and in the GUI window the IP adress of a player is displayed correctly, so it is not a global problem of my server (configuration).

To prevent standard questions:

Yes, I used it in a server-side script. Yes, I restarted the server process several times.

Thanks for any help in advance.

Madd

Link to comment

Your resource is probably not allowed to use this function. To change this, you need to edit the ACL. You can do this by editing the acl.xml file or via the webadmin. You can either simply add your resource to the "Admin"-group or create your own group with the rights your resource needs. The admin-resource is in the "Admin"-group, that's why it is allowed to use this function:

<group name="Admin">
       <acl name="Moderator" />
       <acl name="SuperModerator" />
       <acl name="Admin" />
       <acl name="RPC" />
       <object name="resource.admin" />
       <object name="resource.webadmin" />
</group>

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