Raised This Month: $ Target: $400
 0% 

what is wrong?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Saint Sinner
Senior Member
Join Date: Feb 2016
Old 12-21-2017 , 20:56   Re: what is wrong?
Reply With Quote #12

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;
    }
}

Last edited by Saint Sinner; 12-21-2017 at 23:04.
Saint Sinner is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:20.


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