AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] get ip (https://forums.alliedmods.net/showthread.php?t=276449)

arvEL. 12-21-2015 16:00

[HELP] get ip
 
hi guys i want get ip server without port
example:

PHP Code:

new address[32];
get_cvar_string("net_address"addresscharsmax(address)); 

this code get ip:port 11.22.33.44:5555
i want get just ip server without port

example:
11.22.33.44

Kakarot47 12-21-2015 16:12

Re: [HELP] get ip
 
No chance lol xD you need to be hoster for that :v

addons_zz 12-21-2015 17:07

Re: [HELP] get ip
 
Quote:

Originally Posted by arvEL. (Post 2374879)
hi guys i want get ip server without port
example:

PHP Code:

new address[32];
get_cvar_string("net_address"addresscharsmax(address)); 

[/COLOR]

Code:

net_address
"net_address" is "192.168.42.246:27015"

Gives the local server ip. Unless your computer is connected to the internet without local ip.

Despite that, here there a plugin to get your server external: ip: /ip = show server IP and SQL Get column as cvar.

Quote:

Originally Posted by arvEL. (Post 2374879)
this code get ip:port 11.22.33.44:5555
i want get just ip server without port

example:
11.22.33.44

To remove the string, see:
  1. Rules
  2. Some help with AlliedModdersForum.

https://www.amxmodx.org/api/string/strtok
Code:
strtok( currentLine, string_ip, charsmax(string_ip), currentLine_splited, charsmax(currentLine_splited), ':', 0 )

siriusmd99 12-21-2015 17:29

Re: [HELP] get ip
 
Wut???
Serverid is 0, just use:
new svip[16]
get_user_ip(0, svip, charsmax(svip), 1)

1 means without port else if empty then with it.

arvEL. 12-21-2015 18:22

Re: [HELP] get ip
 
Quote:

Originally Posted by siriusmd99 (Post 2374911)
Wut???
Serverid is 0, just use:
new svip[16]
get_user_ip(0, svip, charsmax(svip), 1)

1 means without port else if empty then with it.

thank you very much.
solved.
T/C


All times are GMT -4. The time now is 18:06.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.