Raised This Month: $ Target: $400
 0% 

[solved]catch smoke grenade bought


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-10-2009 , 18:17   Re: [solved]catch smoke grenade bought
Reply With Quote #9

@xolent
VEN's method with client command hook should be better than hooking client prethink.

PHP Code:
#include <amxmodx>

#define MAX_CLIENTS 32
new g_weapons[MAX_CLIENTS 1]

public 
plugin_init() {
        
register_event("Money""event_money""be")
}

public 
client_command(id) {
        
g_weapons[id] = get_user_weapons(iddummydummy2)
}

public 
event_money(id) {
        new 
old_weapons g_weapons[id]
        
client_command(id)

        new 
new_weapon g_weapons[id] & ~old_weapons
        
if (new_weapon) {
                new 
= -1
                
do ++x; while ((new_weapon /= 2) >= 1)
                static 
wname[32]
                
get_weaponname(xwnamesizeof wname 1)
                
server_print("Player [ClientIndex=%d] has bought ^"%s^" [WeaponIndex=%d]"idwnamex)
        }

Should work for smokegrenade, not sure if the money check is required :
PHP Code:
#include <amxmodx>

#define MAX_CLIENTS 32
new g_bHasSmokeGren[MAX_CLIENTS 1]
new 
g_bUserMoney[MAX_CLIENTS 1]

public 
plugin_init() {
        
register_event("Money""event_money""be")
}

public 
client_command(id)
{
        
g_bHasSmokeGren[id] = user_has_weapon(idCSW_SMOKEGRENADE)
}

public 
event_money(id)
{
    new 
iNewMoney read_data(1)
    if(    !
g_bHasSmokeGren[id]
    &&    (
g_bHasSmokeGren[id] = user_has_weapon(idCSW_SMOKEGRENADE))    )
    {
        if( 
g_bUserMoney[id] - iNewMoney == 300 )
        {
            
client_print(idprint_chat"Enjoy the smoke.")
        }
    }

    
g_bUserMoney[id] = iNewMoney

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 11-10-2009 at 18:26.
ConnorMcLeod is offline
 



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:41.


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