Raised This Month: $106 Target: $400
 26% 

what is wrong?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Saint Sinner
Senior Member
Join Date: Feb 2016
Old 12-20-2017 , 06:44   what is wrong?
Reply With Quote #1

Code:
#include <amxmodx> 

new cvar_ip

public plugin_init()  
{ 
    cvar_ip = register_cvar( "test", "132.168.1.103:27015" );
}

public test( ) 
{ 
    new szIP[20]; 
    get_user_ip(0, szIP, charsmax(szIP), false); 
     
    if(!equal(szIP, cvar_ip)) 
    { 
        server_cmd("quit")
        return 
    } 
}
Code:
error 035: argument type mismatch (argument 2)
warning 204: symbol is assigned a value that is never used: "cvar_ip"

Last edited by Saint Sinner; 12-20-2017 at 06:47.
Saint Sinner is offline
KliPPy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 12-20-2017 , 06:53   Re: what is wrong?
Reply With Quote #2

You have to properly retrieve the value of a cvar.
Read https://wiki.alliedmods.net/Scripting_Cvars_(AMX_Mod_X)
__________________
KliPPy is offline
Saint Sinner
Senior Member
Join Date: Feb 2016
Old 12-20-2017 , 08:33   Re: what is wrong?
Reply With Quote #3

that not work

if(!equal(szIP, get_pcvar_num(cvar_ip))
Saint Sinner is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 12-20-2017 , 09:14   Re: what is wrong?
Reply With Quote #4

Try get_pcvar_string.
__________________
Problem with ZP?
ZP Helper!
zmd94 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 12-20-2017 , 09:54   Re: what is wrong?
Reply With Quote #5

The cvar value is a string, the IP is a string, so get the string from the cvar and compare strings.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Saint Sinner
Senior Member
Join Date: Feb 2016
Old 12-20-2017 , 17:48   Re: what is wrong?
Reply With Quote #6

this is hard to make it...
Saint Sinner is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: Brazil 🇧🇷
Old 12-20-2017 , 19:13   Re: what is wrong?
Reply With Quote #7

Really? If this is hard for you, retire yourself from programming. You know what the problem is? You've at least tried and are waiting for someone to do it for you, but, that's where you fell off the horse, because no one here is going to help you with that, or rather, they've already helped you.
__________________
Working with $$$ paid plugins. Contact below (ONLY FOR NEGOTIATIONS)
  • Skype: crazy.770
  • Steam: crazy770
  • Discord: CrazY.#5317
Feel free to check my work at https://conceptstrike.blogspot.com

Check my Aliens vs. Predator: currently offline
CrazY. is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 12-20-2017 , 22:48   Re: what is wrong?
Reply With Quote #8

What you miss is that to him this simple task looks like an UFO since he is not a programmer

PHP Code:
#include <amxmodx> 

new cvar_ip

public plugin_init()  

    
cvar_ip register_cvar"test""132.168.1.103:27015" );
}

public 
test( ) 

    new 
szIP[20]; 
    
get_user_ip(0szIPcharsmax(szIP), false); 
   
    new 
szCV[20]
    
get_pcvar_string(cvar_ipszCVcharsmax(szCV)) // cvar handler, string to store to, max chars of string
     
    
if(!equal(szIPszCV))
    { 
        
server_cmd("quit")
        return 
    } 

__________________

Last edited by Depresie; 12-20-2017 at 22:48.
Depresie is offline
Saint Sinner
Senior Member
Join Date: Feb 2016
Old 12-21-2017 , 03:19   Re: what is wrong?
Reply With Quote #9

Quote:
What you miss is that to him this simple task looks like an UFO since he is not a programmer
the code not work...just test him before post
Saint Sinner is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 12-21-2017 , 06:34   Re: what is wrong?
Reply With Quote #10

It is not work because you do not register test( ) function.
__________________
Problem with ZP?
ZP Helper!
zmd94 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 08:28.


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