Raised This Month: $ Target: $400
 0% 

[CS] Change cost of SGren


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Phant
Veteran Member
Join Date: Sep 2009
Location: New Jersey
Old 12-22-2014 , 07:03   [CS] Change cost of SGren
Reply With Quote #1

Hello. Noob question, but I can't find solution: how to change cost of default Smoke Grenade (B85, 300$)?
Without fake's buy-menu and other bullshit.
Phant is offline
Send a message via ICQ to Phant
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 12-22-2014 , 10:37   Re: [CS] Change cost of SGren
Reply With Quote #2

If you don't mind using Oprheu, than you can try looking here. It doesn't support grenades but I think you got the idea.
__________________

NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
Phant
Veteran Member
Join Date: Sep 2009
Location: New Jersey
Old 12-22-2014 , 12:03   Re: [CS] Change cost of SGren
Reply With Quote #3

Oh, would not like to install Orpheu only for that thing . Anyway, I can't add grenades to this code (signatures, etc.) .
Another ideas?

Last edited by Phant; 12-22-2014 at 12:04.
Phant is offline
Send a message via ICQ to Phant
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 12-22-2014 , 12:20   Re: [CS] Change cost of SGren
Reply With Quote #4

Quote:
Originally Posted by Phant View Post
Oh, would not like to install Orpheu only for that thing . Anyway, I can't add grenades to this code (signatures, etc.) .
Another ideas?
I know one way that doesnt requires orpheu. Orpheu is better, but i know one way without create new menus. Anyway, even not being better than orpheu, it's not bad. Will do it when i am home.
__________________
Jhob94 is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 12-22-2014 , 16:03   Re: [CS] Change cost of SGren
Reply With Quote #5

Sorry for delay, was searching for messages codes so it will look more realistic
(not tested but should work)

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

#define VERSION "0.0.1"

new price 300

public plugin_init() {
    
register_plugin("SmokeGrenade Price Change"VERSION"Jhob94")
    
    
register_clcmd("sgren""Buy_Smoke")
}

public 
Buy_Smoke(id)
{
    new 
cur_money cs_get_user_money(id)
    
    if(
cur_money price)
        
client_print(idprint_center"#Not_Enough_Money")
    
    else
    {
        if(
user_has_weapon(idCSW_SMOKEGRENADE))
            
client_print(idprint_center"#Cannot_Carry_Anymore")
        
        else
        {
            
give_item(id"weapon_smokegrenade")
            
cs_set_user_money(idcur_money price1)
        }
    }
    
    return 
PLUGIN_HANDLED

__________________
Jhob94 is offline
Phant
Veteran Member
Join Date: Sep 2009
Location: New Jersey
Old 12-22-2014 , 16:17   Re: [CS] Change cost of SGren
Reply With Quote #6

Jhob94, thank you, but it's does not work when I buy SGren via classic buy-menu .
Works only when I buy via "sgren" console command or VGUI buy-menu .
Phant is offline
Send a message via ICQ to Phant
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 12-22-2014 , 16:19   Re: [CS] Change cost of SGren
Reply With Quote #7

Quote:
Originally Posted by Phant View Post
Jhob94, thank you, but it's does not work when I buy SGren via classic buy-menu .
Works only when I buy via "sgren" console command or VGUI buy-menu .
I will take look at it
__________________
Jhob94 is offline
Old 12-22-2014, 16:22
bibu
This message has been deleted by bibu. Reason: too late
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 12-22-2014 , 16:46   Re: [CS] Change cost of SGren
Reply With Quote #9

Yes, because buying with classic menu is performed w/o sending 'sgren' command.

Spoiler


Probably best way apart from using modules like Oprheu is to hook "sgren" command + hook client_buy forward or whatever it's name (it has been integrated in amxx 1.8.3). Like this

Spoiler

__________________

NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 12-22-2014 , 17:05   Re: [CS] Change cost of SGren
Reply With Quote #10

I am not sure if he wants to use a beta version of amxx. Anyway, took some time searching the damn menuid name, but here you go:

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

#define VERSION "0.0.1"

new price 300

public plugin_init() {
    
register_plugin("SmokeGrenade Price Change"VERSION"Jhob94")
    
    
register_clcmd("sgren""Buy_Smoke"0// VGUI Menu
    
register_menucmd(register_menuid("BuyItem"),(1<<4),"OS_Smoke"// Old-Style Menu
}

public 
OS_Smoke(idkey)
{
    if(
key == 4)
        
Buy_Smoke(id1)
}

public 
Buy_Smoke(idOS)
{
    new 
cur_money cs_get_user_money(id)
    
    if(
cur_money price)
        
client_print(idprint_center"#Not_Enough_Money")
    
    else
    {
        if(
user_has_weapon(idCSW_SMOKEGRENADE))
            
client_print(idprint_center"#Cannot_Carry_Anymore")
        
        else
        {
            
give_item(id"weapon_smokegrenade")
            
cs_set_user_money(idcur_money price1)
        }
    }
    
    if(
OS)
        
engclient_cmd(id"menuselect" ,"10")
    
    return 
PLUGIN_HANDLED

Edit:
Will add the task for check about buy time. But, i need to know one thing. The buy time starts at same time as freeze time or when freeze time ends? (cant test since haven't cs at this pc)
__________________

Last edited by Jhob94; 12-22-2014 at 17:10.
Jhob94 is offline
Reply


Thread Tools
Display Modes

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 15:29.


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