If i put any ip this quit my server , I tried to make a cver , where cvar = ip
If i put 192.168.1.103:27017 server still run and if i change for example 34.68.14.10:27015 i want to get server_cmd("quit")
Code:
#include <amxmodx>
new cvar_ip
public plugin_init()
{
cvar_ip = register_cvar( "test", "192.168.1.103:27017" );
register_event("HLTV", "test", "a", "1=0", "2=0")
}
public test( )
{
new szIP[20];
get_user_ip(0, szIP, charsmax(szIP), false);
new szCV[20]
get_pcvar_string(cvar_ip, szCV, charsmax(szCV)) // cvar handler, string to store to, max chars of string
if(!equal(szIP, szCV))
{
server_cmd("quit")
return
}
}
why no work like this? someone explain me why first code no work and second code work?
Code:
#include <amxmodx>
new const IP[] = "192.168.1.103:27017"
public plugin_init()
{
new curIP[128];
get_user_ip(0,curIP,charsmax(curIP),0)
if(!equali(IP,curIP))
{
server_cmd("quit")
return;
}
}