Raised This Month: $ Target: $400
 0% 

Event unsuccessful primary weapons purchases


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 11-29-2012 , 12:13   Event unsuccessful primary weapons purchases
Reply With Quote #1

How can I know that a player is trying to buy a primary weapon and he did not have enough money ? I need to hook this event.

If the player does not have enough money to purchase new weapons, he gets ammo for weapons that he has. I need block it

Last edited by kadet.89; 11-29-2012 at 12:18.
kadet.89 is offline
Send a message via Skype™ to kadet.89
Xilver266
Member
Join Date: Apr 2011
Old 11-30-2012 , 05:26   Re: Event unsuccessful primary weapons purchases
Reply With Quote #2

An example don't tested xD

PHP Code:
new AwpCost 4500;

CS_OnBuyCommand(client, const String:weapon[])
{
    new 
Money FindSendPropOffs("CCSPlayer""m_iAccount");
    
    if (
StrEqual(weapon"weapon_awp")
    {
        if (
Money AwpCost)
        {
            new 
MoneyEx GetEntData(clientMoney);
            new 
MoneySet MoneyEx 100;
            
SetEntData(clientMoneySet); 
            
GivePrimaryAmmo(client);
            return 
Plugin_Handled;
        }
        return 
Plugin_Continue;
    }
}

GivePrimaryAmmo(client)
{
    
PAmmoCount FindSendPropOffs("CBaseCombatWeapon""m_iPrimaryAmmoCount");
    
WeaponActive FindSendPropOffs("CAI_BaseNPC""m_hActiveWeapon");
    new 
weapon GetEntDataEnt2(clientWeaponActive); 
    if (
PAmmoCount != -&& weapon != -1
    
SetEntData(weaponPAmmoCount304true); 

http://forums.alliedmods.net/showthread.php?t=130770
__________________

Last edited by Xilver266; 11-30-2012 at 13:30.
Xilver266 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 07:20.


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