AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need help witch cost (https://forums.alliedmods.net/showthread.php?t=94216)

~Ice*shOt 06-08-2009 08:21

Need help witch cost
 
I want to do for this cost:
PHP Code:

public ShowMenu(id)
{
    new 
menu menu_create("\rMenu of Extra Items:""menu_handler");

    
menu_additem(menu"\yExtra Grenades""1"0);

    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
}

public 
menu_handler(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        return 
PLUGIN_HANDLED;
    }

    new 
data[6], iName[64];
    new 
accesscallback;
 
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);

    new 
key str_to_num(data);

    switch(
key)
    {
        case 
1:
        {
          
client_printcolor(id"/gItem/y: /ctrExtra Grenades");
        
client_printcolor(id"/gDescription/y: /ctrGives an Extra Grenades");
        
give_item(id"weapon_hegrenade")
        
give_item(id"weapon_smokegrenade")
        
give_item(id"weapon_flashbang")
        
give_item(id"weapon_flashbang")
        }
    }


what i can do this ??

micke1101 06-08-2009 08:40

Re: Need help witch cost
 
Before giving add the cs_get_user_money(id) and check if it is lower or higher than what you want it to cost and if its higher use cs_set_user_money(id, userMoney - WeaponCost)

(userMoney and WeaponCost is variables)

TitANious 06-08-2009 08:43

Re: Need help witch cost
 
Something like
PHP Code:

        case 1:
        {
            new 
iCost 3000
            
if( cs_get_user_money id ) >= iCost )
            {
                
cs_set_user_money idcs_get_user_money id ) - iCost )
                
client_printcolor(id"/gItem/y: /ctrExtra Grenades");
                
client_printcolor(id"/gDescription/y: /ctrGives an Extra Grenades");
                
give_item(id"weapon_hegrenade")
                
give_item(id"weapon_smokegrenade")
                
give_item(id"weapon_flashbang")
                
give_item(id"weapon_flashbang")
            }
            else
            {
                
client_print idprint_chat"Not enough money, you need %d"iCost)
            }
        } 


~Ice*shOt 06-08-2009 09:06

Re: Need help witch cost
 
thanks ;], but i can do this a buy witch points ? example grenades: need 5points points you have a killed enemy

TitANious 06-08-2009 09:29

Re: Need help witch cost
 
You mean that you get 1 point for 1 frag?

~Ice*shOt 06-08-2009 09:43

Re: Need help witch cost
 
Yes, and witch points i can buy items

TitANious 06-08-2009 10:11

Re: Need help witch cost
 
It's with

~Ice*shOt 06-08-2009 10:26

Re: Need help witch cost
 
Yes, yes but you can help for me ?

TitANious 06-08-2009 10:30

Re: Need help witch cost
 
REALLY EASY, try don't ask so much
PHP Code:

        case 1:
        {
            new 
iPoint 2
            
if( get_user_frags id ) >= iPoint )
            {
                
cs_set_user_money idget_user_frags id ) - iPoint )
                
client_printcolor(id"/gItem/y: /ctrExtra Grenades");
                
client_printcolor(id"/gDescription/y: /ctrGives an Extra Grenades");
                
give_item(id"weapon_hegrenade")
                
give_item(id"weapon_smokegrenade")
                
give_item(id"weapon_flashbang")
                
give_item(id"weapon_flashbang")
            }
            else
            {
                
client_print idprint_chat"Not enough frags, you need %d"iPoint)
            }
        } 


~Ice*shOt 06-08-2009 10:36

Re: Need help witch cost
 
TitANious THANKS!!!, but you can help for me with points creating ? I need taht code :oops:


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

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