GetClientIP: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
Line 4: Line 4:
==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
string getClientName ( client theClient )
string getClientIP ( client theClient )
</syntaxhighlight>
</syntaxhighlight>



Revision as of 22:17, 13 December 2006

This function returns a string containing the IP of the client.

Syntax

string getClientIP ( client theClient )

Required Arguments

  • theClient: The client element (player or admin) you want to get the IP of.

Returns

Returns a string containing the requested client's IP, or false if the client passed to the function is invalid.

Example

This example prints a player's IP to the chat.

addCommandHandler ( "ip", "printIP" )
function printIP ( thePlayer, key )
  outputChatBox ( getClientName ( thePlayer ) .. "'s IP is: " .. getClientIP ( thePlayer ) )
end

See Also

BEFORE VERSION 1.0 :