Raised This Month: $ Target: $400
 0% 

Invalid CVAR pointer


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 09-27-2009 , 21:00   Invalid CVAR pointer
Reply With Quote #1

PHP Code:
////////////////////////////////
//  Credits...                //
//                            //
//  Arkshine, xPaw, joropito  //
//                            //
////////////////////////////////

#include <amxmodx>
#include <cstrike>
#include <geoip>

#define PLUGIN    "Country & City Menu"
#define AUTHOR    "Alucard"
#define VERSION    "1.1"

//--------------------START EDIT------------------------//

#define DURATION    8.0

#define RED        255
#define GREEN    255
#define BLUE    255

#define POS_X    0.02
#define POS_Y    0.23

#define is_user_admin2(%1)  (get_user_flags(%1) & ADMIN_KICK)

//--------------------END EDIT-------------------------//

new Ip1[48], Ip2[48]

new 
g_msgSayText

new p_ShowModep_OnlyAdminsp_ShowCode

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_cvar("cc_version"VERSION,FCVAR_SERVER|FCVAR_SPONLY)
    
register_cvar("cc_author"AUTHOR,FCVAR_SERVER|FCVAR_SPONLY)
    
    
register_clcmd("say /country""CountryMenu")
    
    
p_ShowMode register_cvar("cc_showmode""1")
    
p_ShowCode register_cvar("cc_showcode""1")
    
p_OnlyAdmins register_cvar("cc_onlyadmins""0")
    
    
g_msgSayText get_user_msgid("SayText")
}

public 
CountryMenu(id)
{
    if(!
get_pcvar_num(p_ShowMode) )
        return 
PLUGIN_HANDLED
    
    
if(get_pcvar_num(p_OnlyAdmins) && !is_user_admin2(id) )
        return 
PLUGIN_HANDLED
    
    
new Menu menu_create("\rCountry Menu:""CountryHandler")
    
    new 
szName[32], szTarget[10], players[32],
    
Code2[3], Code3[4], Item[64], pnumtarget
    
    get_players
(playerspnum)
    
    for(new 
ipnumi++)
    {
        
target players[i]
        
        
get_user_ip(targetIp1471)
        
get_user_name(targetszName31)
        
        
num_to_str(targetszTarget9)
        
        
geoip_code2_ex(Ip1Code2)
        
geoip_code3_ex(Ip1Code3)
        
        switch(
get_pcvar_num(p_ShowCode) )
        {
            case 
0:
            
formatex(Item63"%s"szName)
            case 
1:
            
formatex(Item63"%s \y[%s]"szNameCode2)
            case 
2:
            
formatex(Item63"%s \y[%s]"szNameCode3)
        }
        
        
menu_additem(MenuItemszTarget0)
    }
    
    if(
cs_get_user_buyzone(id) )
        
BuyIcon(id0)
    
    
menu_display(idMenu0)
    return 
PLUGIN_HANDLED
}

public 
CountryHandler(idMenuitem)
{
    if( 
item == MENU_EXIT )
    {
        if(
cs_get_user_buyzone(id) )
            
BuyIcon(id1)    
        
        
menu_destroy(Menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], iName[64]
    new 
accesscallback
    menu_item_getinfo
(Menuitemaccessdata,5iName63callback)
    
    new 
target str_to_num(data)
    
    static 
szCountry[48], szCity[48], szName[32], szTimeZone[48]
    
    
get_user_name(targetszName31)
    
    
get_user_ip(targetIp1471)
    
get_user_ip(idIp2471)
    
    
geoip_timezone(Ip1szTimeZone47)
    
geoip_country(Ip1szCountry47)
    
geoip_city(Ip1szCity47)
    
    if(
equal(szCountry"error") )
    {
        if(!
contain(Ip1"192.168.") || !contain(Ip1"10.") || !contain(Ip1"172.") || equal(Ip1"127.0.0.1") )
        {
            
szCountry "LAN"
            
szCity "LAN"
            
szTimeZone "LAN"
        
}
        else if(
equal(Ip1"loopback") )
        {
            
szCountry "LAN Owner"
            
szCity "LAN Owner"
            
szTimeZone "LAN Owner"
        
}
        else
        {
            
szCountry "Unknown Country"
            
szCity "Unknown City"
            
szTimeZone "Unknown TimeZone"
        
}    
    }
    
    switch(
get_pcvar_num(p_ShowMode) )
    {
        case 
1:
        {
            
chat_color(id"!gName: !y%s !t| !gCountry: !y%s !t| !gCity: !y%s !t| !gTime: !y%s"szNameszCountryszCityszTimeZone)
            
chat_color(id"!gDistance with you: !y%f"geoip_distance(geoip_latitude(Ip1), geoip_longitude(Ip1), geoip_latitude(Ip2), geoip_longitude(Ip2) ) )
        }
        case 
2:
        {
            
set_hudmessage(REDGREENBLUEPOS_XPOS_Y06.0DURATION0.10.2, -1)
            
show_hudmessage(id"Name: %s^nCountry: %s^nCity: %s^nTime: %s"szNameszCountryszCityszTimeZone)
        }
        case 
3:
        {
            static 
MotdChars[1536], iLen
            
            iLen 
formatex(MotdChars[iLen], (charsmax(MotdChars) ) - iLen"<html>" 
            
iLen += formatex(MotdChars[iLen], (charsmax(MotdChars) ) - iLen"<body bgcolor=#000000><font color=#FFFFFF face=Verdana size=4>")
            
iLen += formatex(MotdChars[iLen], (charsmax(MotdChars) ) - iLen"<center><font size=8 color=#3399FF><b><u>Country & City Info</u></b></font></center>")
            
iLen += formatex(MotdChars[iLen], (charsmax(MotdChars) ) - iLen"<br><br><br><center><font color=#CCCC00>Name:</font> %s</center>"szName)
            
iLen += formatex(MotdChars[iLen], (charsmax(MotdChars) ) - iLen"<center><font color=#CCCC00>Country:</font> %s</center>"szCountry)
            
iLen += formatex(MotdChars[iLen], (charsmax(MotdChars) ) - iLen"<center><font color=#CCCC00>City:</font> %s</center>"szCity)
            
iLen += formatex(MotdChars[iLen], (charsmax(MotdChars) ) - iLen"<center><font color=#CCCC00>Time:</font> %s</center>"szTimeZone)
            
            
iLen += formatex(MotdChars[iLen], (charsmax(MotdChars) ) - iLen"</font></body></html>" )
            
            
show_motd(idMotdChars"Country & City Info"
        }
    }
    
    if(
cs_get_user_buyzone(id) )
        
BuyIcon(id1)
    
    
menu_destroy(Menu)
    return 
PLUGIN_HANDLED    
}


stock chat_color(const id, const input[], any:...)
{
    static 
msg[191]
    
vformat(msg190input3)
    
    
replace_all(msg190"!g""^4")
    
replace_all(msg190"!y""^1")
    
replace_all(msg190"!t""^3")
    
    
message_begin(MSG_ONE_UNRELIABLEg_msgSayText_id)
    
write_byte(id)
    
write_string(msg)
    
message_end()
}

BuyIcon(idiNum)
{
    
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("StatusIcon"), _id)
    
write_byte(iNum)
    
write_string("buyzone")
    
write_byte(0)
    
write_byte(160)
    
write_byte(0)
    
message_end()

This is very annoying :/

I edited some things and now the menu don't work... when i type /country... i get this error, with debug.

Quote:
L 09/28/2009 - 02:537: Invalid CVAR pointer
L 09/28/2009 - 02:537: [AMXX] Displaying debug trace (plugin "country_new.amxx")
L 09/28/2009 - 02:537: [AMXX] Run time error 10: native error (native "get_pcvar_num")
L 09/28/2009 - 02:537: [AMXX] [0] country_new.sma::CountryMenu (line 55)
The line is this:

PHP Code:
if(!get_pcvar_num(p_ShowMode) ) 
o.o

Also, if i comment that part... i get the same error with other get_pcvar_num native...

What is the problem? i can't find what is wrong in this code.
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
 



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 22:38.


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