Raised This Month: $2 Target: $400
 0% 

what is wrong?


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

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
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 12-22-2017 , 04:07   Re: what is wrong?
Reply With Quote #12

Try to increase value of the chars of string.

Code:
new szIP[20
-->
Code:
new szIP[32]
__________________
Problem with ZP?
ZP Helper!
zmd94 is offline
Saint Sinner
Senior Member
Join Date: Feb 2016
Old 12-22-2017 , 04:49   Re: what is wrong?
Reply With Quote #13

Now works...Thanks man
Saint Sinner is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 12-22-2017 , 07:31   Re: what is wrong?
Reply With Quote #14

Welcome. Gladly can help you.
__________________
Problem with ZP?
ZP Helper!
zmd94 is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 12-23-2017 , 02:28   Re: what is wrong?
Reply With Quote #15

Quote:
Originally Posted by Saint Sinner View Post
the code not work...just test him before post
__________________

Last edited by Depresie; 12-23-2017 at 02:38.
Depresie is offline
Reply


Thread Tools
Display Modes

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 18:58.


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