Raised This Month: $ Target: $400
 0% 

Item for money?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
drakeris
Senior Member
Join Date: Jul 2009
Old 10-30-2009 , 05:20   Item for money?
Reply With Quote #1

for example i blocked the buying but nowi want to make that they could buy by command for example:
PHP Code:
register_event("say /ak100" and etc
i done the uying command but how to make so when he buys helooses my wanted ammount?
drakeris is offline
unnyquee
Senior Member
Join Date: Jun 2009
Location: Constanta, Romania
Old 10-30-2009 , 07:48   Re: Item for money?
Reply With Quote #2

There's no such event.. after you blocked the buy commands, you can do something like this:

PHP Code:
// in your includes
#include <cstrike> // for cs_set_user_bpammo
#include <fun> // for give_item

// in your plugin_init()
pCvarCostAk register_cvar("buy_ak_cost");
register_clcmd("say /ak47""cmdBuyAK");

// in cmdBuyAk
new iMoney get_pcvar_num(pCvarCostAk);

if(
cs_get_user_money(id) < iMoney)
{
     
client_print(idprint_center"#Cstrike_TitlesTXT_Not_Enough_Money");
     return 
PLUGIN_HANDLED;
}
give_item(id"weapon_ak47");
cs_set_user_bpammo(id"weapon_ak47"0);
cs_set_weapon_ammo("weapon_ak47"30);

cs_set_user_money(idcs_get_user_money iMoney1); 
__________________

Last edited by unnyquee; 10-30-2009 at 08:00.
unnyquee is offline
drakeris
Senior Member
Join Date: Jul 2009
Old 10-30-2009 , 07:54   Re: Item for money?
Reply With Quote #3

i know how to give the gun but i need codefor to use money for example when palyer buys item he loooses money the amount of the guns cost so i need only how to make so he loose money after doing "/ak47"
drakeris is offline
unnyquee
Senior Member
Join Date: Jun 2009
Location: Constanta, Romania
Old 10-30-2009 , 08:00   Re: Item for money?
Reply With Quote #4

Edited
@ xPaw: You posted before this post
__________________
unnyquee is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 10-30-2009 , 07:55   Re: Item for money?
Reply With Quote #5

cs_get_user_money( )
cs_set_user_money( )
__________________
xPaw is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 10-30-2009 , 08:16   Re: Item for money?
Reply With Quote #6

fixed a bit
PHP Code:
new iMoney get_pcvar_numpCvarCostAk ), iCurrentMoney cs_get_user_moneyid );

if( 
iCurrentMoney iMoney ) {
    
client_printidprint_center"#Cstrike_TitlesTXT_Not_Enough_Money" );
    
    return 
PLUGIN_HANDLED;
}

// stuff

cs_set_user_moneyidiCurrentMoney iMoney); 
__________________
xPaw is offline
drakeris
Senior Member
Join Date: Jul 2009
Old 10-30-2009 , 08:21   Re: Item for money?
Reply With Quote #7

so how to set the cost?
drakeris is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 10-30-2009 , 08:23   Re: Item for money?
Reply With Quote #8

Quote:
Originally Posted by drakeris View Post
so how to set the cost?
PCVAR
__________________
<VeCo> is offline
unnyquee
Senior Member
Join Date: Jun 2009
Location: Constanta, Romania
Old 10-30-2009 , 08:23   Re: Item for money?
Reply With Quote #9

The cost is the value of the pCvarCostAk..
__________________
unnyquee 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 17:46.


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