AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   problem with get_pcvar_num in menu (https://forums.alliedmods.net/showthread.php?t=133137)

mati009988 07-22-2010 07:16

problem with get_pcvar_num in menu
 
Hi.
I have a problem with get_pcvar_num() in menu.

PHP Code:

public Sklep(id){
    if(!
is_user_alive(id) && get_pcvar_num(alive_only) == 1){
        
ColorChat(idRED"%L"LANG_PLAYER"NO_ALIVE_MENU_MSG"tag
            return 
PLUGIN_HANDLED 
    
}
    if(
get_pcvar_num(shop_on) != 1){     
            
ColorChat(idRED"%L"LANG_PLAYER"SHOP_OFF_MSG"tag
            return 
PLUGIN_HANDLED 
    
}
    new 
szText555 char ];
    
formatexszTextcharsmaxszText ), "%L"LANG_PLAYER"SHOP_NAME_MSG"id );
    new 
menu menu_createszText"sklep_h" );
    
formatexszTextcharsmaxszText ), "%L"LANG_PLAYER"ITEM1_MSG"idget_pcvar_numhpa_koszt ) );
    
menu_additemmenuszText"1");
    
formatexszTextcharsmaxszText ), "%L"LANG_PLAYER"ITEM2_MSG"idget_pcvar_numhpb_koszt ) );
    
menu_additemmenuszText"2");
    
formatexszTextcharsmaxszText ), "%L"LANG_PLAYER"ITEM3_MSG"idget_pcvar_numxpa_koszt ) );
    
menu_additemmenuszText"3");
    
formatexszTextcharsmaxszText ), "%L"LANG_PLAYER"ITEM4_MSG"idget_pcvar_numxpb_koszt ) );
    
menu_additemmenuszText"4");    
    
menu_setpropmenuMPROP_EXITMEXIT_ALL );
    
menu_displayidmenu);
    return 
PLUGIN_CONTINUE;


Code:

ITEM1_MSG = \w50 hp \r[\yCost \r%d\y$\r]
ITEM2_MSG = \w100 hp \r[\yCost \r%d\y$\r]
ITEM3_MSG = \w50 xp \r[\yCost \r%d\y$\r]
ITEM4_MSG = \w100 xp \r[\yCost \r %d\y$\r]

Always a price displayed 1
What I`m doing wrong?

YamiKaitou 07-22-2010 09:43

Re: problem with get_pcvar_num in menu
 
Because you are passing id to the %d.
PHP Code:

formatexszTextcharsmaxszText ), "%L"LANG_PLAYER"ITEM1_MSG"idget_pcvar_numhpa_koszt ) ); 

:arrow:
PHP Code:

formatexszTextcharsmaxszText ), "%L"id"ITEM1_MSG"get_pcvar_numhpa_koszt ) ); 

There is 1 line fix, now use that and correct your other lines

mati009988 07-22-2010 10:26

Re: problem with get_pcvar_num in menu
 
work. Thank you


All times are GMT -4. The time now is 00:06.

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