Jump to content

getPlayerIp error ( updated, another problem )


arnoldasz

Recommended Posts

I am trying to get player ip, but I get errors in console:

[22:02:57] WARNING: FreeRoam\fr_server.lua:75: Access denied @ 'getClientIP' 
[22:02:57] ERROR: FreeRoam\fr_server.lua:75: attempt to concatenate a nil value 

Whats wrong? Code:

  
-- Function that sends info to server script: 
function    onRegisterButtonClicked ( button, state ) 
    if button == "left" and state == "up" then 
        local 
            username, password = guiGetText ( MainWindow [ "lineEdit_3" ] ), guiGetText ( MainWindow [ "lineEdit_4" ] ) 
         
        if string.len ( username ) > 3 and string.len ( password ) > 3 then 
            triggerServerEvent  ( "registerPlayer", localPlayer, username, password ) 
        else 
            outputChatBox   ( "#FFFF00[serveris]#FF0000[Klaida]:#FFFFFF Slapyvardį ir slaptažodį turi sudaryti ne mažiau kaip 4 simboliai." ) 
        end 
    end 
end 
  
-- Server 
addEventHandler ( "registerPlayer", rootElement, 
    function    ( username, password ) 
        local 
            res = mysql_query ( mysql, "SELECT `reg_id` FROM `server_users` WHERE `IP` = '" .. getPlayerIP ( source ) .. "'" ) 
         
    end 
) 
  

Edited by Guest
Link to comment
-- Function that sends info to server script:

I writed comment, over that function. This message means, that I am sending info from client side script into server side script. I am sorry if it was unclear.

Now I have another problem ( I don't want to create other thread, so I'll post in that ). I have a query to mysql server, but I can't get error which has been occoured:

res = mysql_query   ( mysql, "INSERT INTO `table` ( `name`, `ip`, `pass` ) VALUES ( '" .. name .. "', '" .. ip .. "', MD5('" .. pass .. "')" ) 
        outputChatBox   ( "error:" .. mysql_error ( mysql ), source ) 

Nothing outputs in chat ( I know that error occours, because query returns nil )

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