Raised This Month: $51 Target: $400
 12% 

Need help witch cost


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
~Ice*shOt
Veteran Member
Join Date: Mar 2009
Location: Lithuania
Old 06-08-2009 , 08:21   Need help witch cost
Reply With Quote #1

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 ??
~Ice*shOt is offline
Send a message via Skype™ to ~Ice*shOt
micke1101
Veteran Member
Join Date: Jan 2008
Location: Banned-town
Old 06-08-2009 , 08:40   Re: Need help witch cost
Reply With Quote #2

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)
micke1101 is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 06-08-2009 , 08:43   Re: Need help witch cost
Reply With Quote #3

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)
            }
        } 
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
Old 06-08-2009, 08:45
xbatista
This message has been deleted by xbatista. Reason: Nvm
~Ice*shOt
Veteran Member
Join Date: Mar 2009
Location: Lithuania
Old 06-08-2009 , 09:06   Re: Need help witch cost
Reply With Quote #4

thanks ;], but i can do this a buy witch points ? example grenades: need 5points points you have a killed enemy
~Ice*shOt is offline
Send a message via Skype™ to ~Ice*shOt
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 06-08-2009 , 09:29   Re: Need help witch cost
Reply With Quote #5

You mean that you get 1 point for 1 frag?
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
~Ice*shOt
Veteran Member
Join Date: Mar 2009
Location: Lithuania
Old 06-08-2009 , 09:43   Re: Need help witch cost
Reply With Quote #6

Yes, and witch points i can buy items
~Ice*shOt is offline
Send a message via Skype™ to ~Ice*shOt
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 06-08-2009 , 10:11   Re: Need help witch cost
Reply With Quote #7

It's with
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
~Ice*shOt
Veteran Member
Join Date: Mar 2009
Location: Lithuania
Old 06-08-2009 , 10:26   Re: Need help witch cost
Reply With Quote #8

Yes, yes but you can help for me ?
~Ice*shOt is offline
Send a message via Skype™ to ~Ice*shOt
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 06-08-2009 , 10:30   Re: Need help witch cost
Reply With Quote #9

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)
            }
        } 
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
~Ice*shOt
Veteran Member
Join Date: Mar 2009
Location: Lithuania
Old 06-08-2009 , 10:36   Re: Need help witch cost
Reply With Quote #10

TitANious THANKS!!!, but you can help for me with points creating ? I need taht code

Last edited by ~Ice*shOt; 06-08-2009 at 11:02.
~Ice*shOt is offline
Send a message via Skype™ to ~Ice*shOt
Reply



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 06:57.


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