Raised This Month: $ Target: $400
 0% 

Regen ammo,without sg,fb,he.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 02-24-2009 , 13:56   Regen ammo,without sg,fb,he.
Reply With Quote #1

Hmmm... I need regen ammo of weapons not grenades ,how to do that?
PHP Code:
public ExtraAmmo(id) {
    new 
clipammo;
    new 
weapon get_user_weapon(idclipammo);
    
fm_set_user_bpammo(idweaponammo xxx[id] * xxx);
    
    
set_task(20.0"ExtraAmmo"id);

xbatista is offline
Send a message via Skype™ to xbatista
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 02-24-2009 , 14:07   Re: Regen ammo,without sg,fb,he.
Reply With Quote #2

do what?
__________________
xPaw is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 02-24-2009 , 14:10   Re: Regen ammo,without sg,fb,he.
Reply With Quote #3

Don't give ammo to sg,fb,he.
xbatista is offline
Send a message via Skype™ to xbatista
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-24-2009 , 14:16   Re: Regen ammo,without sg,fb,he.
Reply With Quote #4

Regen ammo in weapons or backpackammo that the player holds ?
And when regen it ? unlimitade ammo ?
Explain better or you will get a bunch of code that you won't need.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 02-24-2009 , 14:21   Re: Regen ammo,without sg,fb,he.
Reply With Quote #5

In backpack,I've just ha a problem with giving AMMO of all types of NADES,I don't need to give ammo of nades.
EDIT:
PHP Code:
stock fm_set_user_bpammo(idiWeaponiAmount

    new 
iOffset
    switch(
iWeapon
    { 
        case 
CSW_AWPiOffset 377
        case 
CSW_SCOUTCSW_AK47CSW_G3SG1iOffset 378
        case 
CSW_M249iOffset 379
        case 
CSW_FAMASCSW_M4A1CSW_AUGCSW_SG550CSW_GALICSW_SG552iOffset 380
        case 
CSW_M3CSW_XM1014iOffset 381
        case 
CSW_USPCSW_UMP45CSW_MAC10iOffset 382
        case 
CSW_FIVESEVENCSW_P90iOffset 383
        case 
CSW_DEAGLEiOffset 384
        case 
CSW_P228iOffset 385
        case 
CSW_GLOCK18CSW_MP5NAVYCSW_TMPCSW_ELITEiOffset 386
        default:return; 
    } 
    
set_pdata_int(idiOffsetiAmount); 

I've deleted from stock nades ,now nades is not giving ;) Problem solved :}

And I wanna ask another question.
I've bad coded it?
I do ExtraAmmo(id) in spawn.
It works very strange :/

Last edited by xbatista; 02-24-2009 at 14:28.
xbatista is offline
Send a message via Skype™ to xbatista
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 02-24-2009 , 14:25   Re: Regen ammo,without sg,fb,he.
Reply With Quote #6

Code:
public ExtraAmmo(id) {
    new clip, ammo;
    new weapon = get_user_weapon(id, clip, ammo);
    if( weapon != CSW_HEGRENADE && weapon != CSW_SMOKEGRENADE && weapon != CSW_FLASHBANG && weapon != CSW_C4 )
        fm_set_user_bpammo(id, weapon, ammo + xxx[id] * xxx);
    
    set_task(20.0, "ExtraAmmo", id);
}
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Old 02-24-2009, 14:32
xbatista
This message has been deleted by xbatista. Reason: I have a headache.
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-24-2009 , 15:03   Re: Regen ammo,without sg,fb,he.
Reply With Quote #7

You can use this full code, bpammo will not change.
If you still want to use your task, juste use the code i've put in Player_Spawn function and past it in your task.

PHP Code:
/*    Copyright © 2009, ConnorMcLeod

    Free Reload is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Free Reload; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN "Free Reload"
#define AUTHOR "ConnorMcLeod"
#define VERSION "0.0.1"

const NOCLIP_WPN_BS    = ((1<<CSW_HEGRENADE)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_FLASHBANG)|(1<<CSW_KNIFE)|(1<<CSW_C4))
const 
SHOTGUNS_BS    = ((1<<CSW_M3)|(1<<CSW_XM1014))

// weapons offsets
const m_pPlayer            41
const m_iId                43
const m_flNextPrimaryAttack    46
const m_iPrimaryAmmoType        49
const m_iClip                51
const m_fInReload            54
const m_fInSpecialReload        55

// players offsets
const m_flNextAttack        83
new const m_rgAmmo_Player[] = {376377378379380381382383384385386}

new const 
g_iMaxAmmo[] = {0309020090321001003552120}

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

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
RegisterHam(Ham_Spawn"player""Player_Spawn"1)

    new 
szWeapon[17]
    for(new 
i=1i<=CSW_P90i++)
    {
        if( !(
NOCLIP_WPN_BS & (1<<i)) && get_weaponname(iszWeaponcharsmax(szWeapon)) )
        {
            if( 
SHOTGUNS_BS & (1<<i) )
            {
                
RegisterHam(Ham_Weapon_ReloadszWeapon"Shotgun_Reload")
            }
            else
            {
                
RegisterHam(Ham_Item_PostFrameszWeapon"Item_PostFrame")
            }
        }
    }
}

public 
Player_Spawnid )
{
    if( 
is_user_aliveid ) )
    {
        for(new 
i=1i<sizeof(m_rgAmmo_Player); i++)
        {
            
set_pdata_int(idm_rgAmmo_Player[i], g_iMaxAmmo[i], 5)
        }
    }
}

public 
Item_PostFrameiEnt )
{
    if( 
get_pdata_int(iEntm_fInReload4) && get_pdata_float(get_pdata_cbase(iEntm_pPlayer4), m_flNextAttack5) )
    {
        
set_pdata_int(iEntm_iClipg_iMaxClip[get_pdata_int(iEntm_iId4)], 4)
        
set_pdata_int(iEntm_fInReload04)
        return 
HAM_HANDLED
    
}
    return 
HAM_IGNORED
}

public 
Shotgun_ReloadiEnt )
{
    if( 
get_pdata_float(iEntm_flNextPrimaryAttack4) <= 0.0 && get_pdata_int(iEntm_fInSpecialReload4) == )
    {
        
set_pdata_int(get_pdata_cbase(iEntm_pPlayer4), 381335)
    }

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 02-24-2009 , 15:09   Re: Regen ammo,without sg,fb,he.
Reply With Quote #8

I've tested with this:
fm_set_user_bpammo(id, weapon, ammo + xxx[id] * xxx);
Somehow ,but BACKPACKAMMO won't be increased(when holding current's weapon ammo is increased) , but it's good for me ;)
OK will use your code.
And I wanna ask next question about increasing ->30<- | 90 ,ammo in clip,possible to increase?

Last edited by xbatista; 02-24-2009 at 15:13.
xbatista is offline
Send a message via Skype™ to xbatista
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-24-2009 , 15:45   Re: Regen ammo,without sg,fb,he.
Reply With Quote #9

Of course, but it will be useless as this value will never change, player bpammo won't be used, the only thing left is the time needed to reload, that's whay i called it free reload.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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:09.


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