Raised This Month: $ Target: $400
 0% 

[HELP] For item which cost money.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sintetic
Junior Member
Join Date: Aug 2012
Old 08-31-2012 , 19:30   [HELP] For item which cost money.
Reply With Quote #1

Hello there,first let me tell you that I am not englisham and I don't know english perfectly,also I am still newbie at scripting/coding,but I can make my own menu,with some functions but I want some of the functions to cost money in game money,so I will give you a short example.
As you type /menu,a menu displays on your screen you choose the first option,which give you "HE grenade" and I want the "HE grenade" to cost like 1000$,or 500$.
So how can I make that funciton to cost,I have watched deathrun shops but I can't understand anything there...So please help me,tell me as much as information you can tell me.Thanks in advance
sintetic is offline
Infernuz
Member
Join Date: May 2011
Old 08-31-2012 , 19:32   Re: [HELP] For item which cost money.
Reply With Quote #2

Show first what you have done.
Infernuz is offline
Send a message via ICQ to Infernuz
sintetic
Junior Member
Join Date: Aug 2012
Old 08-31-2012 , 19:39   Re: [HELP] For item which cost money.
Reply With Quote #3

That's my menu with options,but how can I make the first option to cost like 500$ ?

PHP Code:
#include <amxmodx>
#include <fun>
#include <fakemeta>
#include <cstrike>


public plugin_init()
{
    
register_plugin("TEST","1.0","Pris")
    
register_clcmd("say /menu","ClientCommand_Menu")
    
register_clcmd("say /menu","ClientCommand_Menu")
    
register_clcmd("say /menu","sht_silent")
    
register_event("CurWeapon","FwdSetMaxSpeed","be")
    
}
public 
FwdSetMaxSpeed(id)
{
    
set_user_maxspeed(id,1040.0)
}


public 
sht_silent()
{
    return 
PLUGIN_HANDLED_MAIN
}

public  
ClientCommand_Menu(id)
{
    new 
menu menu_create("Select option","function")
    
    
menu_additem(menu,"HE GRENADE","1",0)
    
menu_additem(menu ,"600 SPEED","2",0)
    
menu_additem(menu,"200 GRAVITY","3",0)
    
menu_additem(menu,"10k ARMOR","4",0)
    
    
menu_display(id,menu,0)
}
public  function(
id,menu,item)
{
    if(
item==MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    new 
iData[6],szName[64]
    new 
access,callback
    
    menu_item_getinfo
(menu,item,access,iData,charsmax(iData),szName,charsmax (szName),callback)
    
    new 
key str_to_num(iData)
    
    switch (
key)
    {
        case  

        {
            
            new 
weaponname[32]
            
get_weaponname(CSW_HEGRENADE,weaponname,charsmax(weaponname))
            
            
give_item(id,weaponname)
        }
        case 

        {
            
set_user_maxspeed(id,get_user_maxspeed(id)+600)
            
client_print(id,print_chat,"You have added +600 speed")
        }
        case 
:
        {
            if(
get_user_gravity(id)==1.0)
            
set_user_gravity(id,0.25)
            
            else 
set_user_gravity(id,1.0)
        }
        case 
:
        {
            
set_user_armor(id,get_user_armor(id)+1000)
        }
        
        
    }
    
menu_destroy(menu)
    
ClientCommand_Menu(id)
    return 
PLUGIN_HANDLED


Last edited by sintetic; 08-31-2012 at 19:40.
sintetic is offline
Infernuz
Member
Join Date: May 2011
Old 08-31-2012 , 20:23   Re: [HELP] For item which cost money.
Reply With Quote #4

Try this.

PHP Code:
#include <amxmodx>
#include <fun>
#include <fakemeta>
#include <cstrike>


public plugin_init() {
    
    
register_plugin("TEST","1.0","Pris")
    
register_clcmd("say /menu","ClientCommand_Menu")
    
register_clcmd("say /menu","ClientCommand_Menu")
    
register_clcmd("say /menu","sht_silent")
    
register_event("CurWeapon","FwdSetMaxSpeed","be")
    
}
public 
FwdSetMaxSpeed(id) {
    
set_user_maxspeed(id,1040.0)
}


public 
sht_silent() {
    return 
PLUGIN_HANDLED_MAIN
}

public  
ClientCommand_Menu(id) {
    
    new 
menu menu_create("Select option","function")
    
    
menu_additem(menu,"HE GRENADE","1",0)
    
menu_additem(menu ,"600 SPEED","2",0)
    
menu_additem(menu,"200 GRAVITY","3",0)
    
menu_additem(menu,"10k ARMOR","4",0)
    
    
menu_display(id,menu,0)
}

public function(
id,menu,item) {
    if(
item==MENU_EXIT) {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
iData[6],szName[64]
    new 
access,callback
    
    menu_item_getinfo
(menu,item,access,iData,charsmax(iData),szName,charsmax (szName),callback)
    
    new 
key str_to_num(iData)
    new 
user_money cs_get_user_money(id);
    
    switch (
key)
    {
        case  

        {
            if(
user_money >= 500) {
                new 
weaponname[32]
                
get_weaponname(CSW_HEGRENADE,weaponname,charsmax(weaponname))
                
                
cs_set_user_money(iduser_money 500);
                
give_item(id,weaponname)
            } else {
                
client_print(idprint_chat"You don't have enought money to buy HE grenade. Need 500$ buks.");
            }
        }
        case 

        {
            
set_user_maxspeed(id,get_user_maxspeed(id)+600)
            
client_print(id,print_chat,"You have added +600 speed")
        }
        case 
:
        {
            if(
get_user_gravity(id)==1.0)
            
set_user_gravity(id,0.25)
            
            else 
set_user_gravity(id,1.0)
        }
        case 
:
        {
            
set_user_armor(id,get_user_armor(id)+1000)
        }
        
        
    }
    
menu_destroy(menu)
    
ClientCommand_Menu(id)
    return 
PLUGIN_HANDLED


Last edited by Infernuz; 08-31-2012 at 20:24.
Infernuz is offline
Send a message via ICQ to Infernuz
sintetic
Junior Member
Join Date: Aug 2012
Old 08-31-2012 , 20:28   Re: [HELP] For item which cost money.
Reply With Quote #5

Thank you I will try it
sintetic is offline
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 08:21.


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