Raised This Month: $ Target: $400
 0% 

Question on read_data()


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-07-2009 , 21:35   Re: Question on read_data()
Reply With Quote #4

For pistol infinite ammo you can do this :

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define VERSION "0.0.1"

#define EXTRAOFFSET_WEAPONS    4
#define m_iId                43
#define m_iClip            51
#define m_iClientClip        52

#define fm_cs_get_weapon_id(%1)    get_pdata_int(%1, m_iId, EXTRAOFFSET_WEAPONS)
#define fm_cs_get_weapon_ammo(%1)    get_pdata_int(%1, m_iClip, EXTRAOFFSET_WEAPONS)
#define fm_cs_set_weapon_ammo(%1,%2)    set_pdata_int(%1, m_iClip, %2, EXTRAOFFSET_WEAPONS)

stock const g_iDftMaxClip[CSW_P90+1] = {
    -
1,  13, -110,  1,  7,    13030,  1,  30
        
2025303525,   12201030100
        
303020,  2,    73030, -1,  50}

public 
plugin_init()
{
    
register_plugin("Infinite Pistol Ammo"VERSION"ConnorMcLeod")

    new 
iCswGuns[] = {CSW_P228CSW_ELITECSW_FIVESEVENCSW_USPCSW_GLOCK18CSW_DEAGLE}
    new 
szWeaponName[20]

    for(new 
iCswId 0iCswId<sizeof(iCswGuns); iCswId++)
    {
        
get_weaponname(iCswGuns[iCswId], szWeaponNamecharsmax(szWeaponName))
        
RegisterHam(Ham_Item_PostFrameszWeaponName"Pistols_PostFrame")
    }
}

public 
Pistols_PostFrame(iEnt)
{
    new 
iClip fm_cs_get_weapon_ammo(iEnt)
    new 
iClientClip get_pdata_int(iEntm_iClientClipEXTRAOFFSET_WEAPONS)
    if( 
iClip != iClientClip )
    {
        new 
iMaxClip g_iDftMaxClipfm_cs_get_weapon_id(iEnt) ]
        if( 
iClip != iMaxClip )
        {
            
fm_cs_set_weapon_ammo(iEntiMaxClip)
            
set_pdata_int(iEntm_iClientClipiMaxClipEXTRAOFFSET_WEAPONS)
            return 
HAM_HANDLED
        
}
    }
    return 
HAM_IGNORED

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 11-08-2009 at 07:00.
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:39.


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