Propably you don't need cvar.
See this thread:
http://forums.alliedmods.net/showthread.php?t=116285
If you have to use cvar:
Code:
#include <amxmodx>
#define PLUGIN "IP show"
#define VERSION "1.0"
#define AUTHOR "Fantarn"
new gCvarServerIp;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /ip", "serverip")
gCvarServerIp = register_cvar("amx_serverip","109.72.82.22:27022")
}
public serverip(id)
{
new szIp[32]
get_pcvar_string(gCvarServerIp, szIp, 31)
client_print(0, print_chat, "The Server ip is %s", szIp)
}
Note that if any player will say /ip, all players will see the ip of the server.
If you want to show ip to only one player change
Code:
client_print(0, print_chat, "The Server ip is %s", szIp)
to
Code:
client_print(id, print_chat, "The Server ip is %s", szIp)