Garry's Mod Wiki

Revision Difference

Player:IPAddress#548138

<function name="IPAddress" parent="Player" type="classfunc"> <description>Returns the player's IP address and connection port in ip:port form <note>Returns `Error!` for bots.</note></description> <realm>Server</realm> <rets> <ret name="ip" type="string">The player's IP address and connection port</ret> </rets> </function> <example> <description>Prints the player's IP and port</description> <code>print( Player( 1 ):IPAddress() )</code> <code>print( Entity( 1 ):IPAddress() )</code> <output>192.168.1.101:27005</output> ⤶ </example>⤶ ⤶ <example>⤶ <description>Prints all players IP and port</description>⤶ <code>for k,v in pairs(player.GetAll()) do⤶ print(v:IPAddress() )⤶ end</code>⤶ <output>All players ip</output>⤶ ⤶ </example></example>