Raised This Month: $51 Target: $400
 12% 

Ammo reload on kill


Post New Thread Reply   
 
Thread Tools Display Modes
Jack86
Veteran Member
Join Date: Dec 2008
Location: Belgrade, Serbia
Old 01-26-2010 , 11:07   Re: Ammo reload on kill
Reply With Quote #21

Just to say that i noticed few bugs, sometimes a countdown is shown after a kill with famas and u can fire with awp like with auto-snipers, but since i switched back from KWo's version of DM to BAILOPAN's now i can use CSDM Refill from Radiance and i have no need to use this one on DM and for standard servers it works without bugs.
__________________

Jack86 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-12-2010 , 12:29   Re: Ammo reload on kill
Reply With Quote #22

Requested by lowed

PHP Code:
/*    Copyright © 2010, ConnorMcLeod 

    Refill Weapon On Kill 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 Refill Weapon On Kill; 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 VERSION "0.1.0"

#define XO_WEAPON    4
#define m_iId        43
#define m_iClip        51
#define get_weapon_id(%0)    get_pdata_int(%0, m_iId, XO_WEAPON)
#define set_weapon_ammo(%0)    set_pdata_int(%0, m_iClip, XO_WEAPON)

#define XO_PLAYER                5
#define m_LastHitGroup            75
#define m_pActiveItem            373 
#define get_user_last_hitgroup(%0)    get_pdata_int(%0, m_LastHitGroup, XO_PLAYER)
#define get_user_active_weapon(%0)    get_pdata_cbase(%0, m_pActiveItem, XO_PLAYER)

#define FIRST_PLAYER_ID    1

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

new const 
g_iMaxClip[CSW_P90+1] = { 
    -
1,    13,    -1,    10,    1,    7,    1,    30,    30,    1,    30,  
        
20,    25,    30,    35,    25,    12,    20,    10,    30,    100,  
        
8,    30,    30,    20,    2,     7,    30,    30,    -1,    50

        
new 
g_iMaxPlayers
#define IsPlayer(%1)    ( FIRST_PLAYER_ID <= %1 <= g_iMaxPlayers )

public plugin_init() 

    
register_plugin("Refill Weapon On Hs Kill"VERSION"ConnorMcLeod"

    
RegisterHam(Ham_Killed"player""Player_Killed"1

    
g_iMaxPlayers get_maxplayers() 


public 
Player_Killed(idiKilleriGib

    if(    
IsPlayer(iKiller)
    &&    
id != iKiller
    
&&    is_user_alive(iKiller)
    &&    
get_user_last_hitgroup(id) == HIT_HEAD    )
    { 
        new 
iActiveWeapon get_user_active_weapon(iKiller)
        if( 
iActiveWeapon )
        {
            new 
iId get_weapon_id(iActiveWeapon)
            if( !( 
NOCLIP_WPN_BS & (1<<iId) ) )
            {
                
set_weapon_ammo(iActiveWeapong_iMaxClip[iId])
            }
        }
    } 

Attached Files
File Type: sma Get Plugin or Get Source (refill_weapon_on_hs_kill.sma - 1491 views - 2.3 KB)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Ejziponken
AlliedModders Donor
Join Date: Apr 2008
Old 03-08-2011 , 10:15   Re: Ammo reload on kill
Reply With Quote #23

Quote:
Originally Posted by Jack86 View Post
Just to say that i noticed few bugs, sometimes a countdown is shown after a kill with famas and u can fire with awp like with auto-snipers, but since i switched back from KWo's version of DM to BAILOPAN's now i can use CSDM Refill from Radiance and i have no need to use this one on DM and for standard servers it works without bugs.
I have the same problem with the AWP.. :/
Ejziponken is offline
fantastiko
BANNED
Join Date: Feb 2013
Old 08-18-2013 , 15:12   Re: Ammo reload on kill
Reply With Quote #24

ConnorMcLeod, possible in half-life ?

pdata
m_iId 30
m_iClip 40
m_pActiveItem 306
fantastiko is offline
Silks
Junior Member
Join Date: Dec 2013
Location: Estonia
Old 12-26-2013 , 08:46   Re: Ammo reload on kill
Reply With Quote #25

ConnorMcLeod can u update script, it dosent work on my server :/
Silks is offline
pUnk
Member
Join Date: Apr 2009
Old 06-23-2014 , 17:43   Re: Ammo reload on kill
Reply With Quote #26

ConnorMcLeod

Could you plz update your plugin so that we can choose wether to set manually from hs only refill or normal/any kill refill in either console or menu front. Instead of needing to load each plugin manually. Also, there's a minor glitch with post #19
Awp wont restore scope when killing oponent making it act like the automatic sniper rifles (g3sg1 & sg550) if shot without kiling anything the scope will restore. There is also a minor glitch with Famas, while shooting in "burst-mode" sometimes it will continue shooting by itself as if it was in normal mode until magazine is depleted.
The rest seems to be working perfectly fine!
I am using:
csdm_2.1.3d_KWo
+ PodBot V3.0Metamod Build19D + Metamod 1.21.1-am + amxmodx 1.8.2 + Steam build 68736

pUnk is offline
Sugisaki
Junior Member
Join Date: Oct 2014
Location: Venezuela
Old 01-15-2015 , 06:45   Re: Ammo reload on kill
Reply With Quote #27

try my version Original Post
PHP Code:
/* 
*  _ _ _ _   _       _   _ _ _ _   _                                                  
* |  _ _ _| | |     | | |   _   | |_|                                              
* | |       | |     | | |  |_|  |  _                                            
* | | _ _   | |     | | |       | | |                                            
* | _ _ _ | | |     | | |_ _ _  | | |                                              
*       | | | |_ _ _| |       | | | |                                               
*  _ _ _| | |         |  _ _ _| | | |                                                     
* | _ _ _ | | _ _ _ _ | |_ _ _ _| |_|                                                             

*  _ _ _ _   _       _   _       _          _ _ _ _   _ _ _ _                          
* |   _   | | |_   _| | | |     | |        |  _ _ _| |  _ _ _|                  
* |  |_|  | |   |_|   | |_|_   _|_|        | |       | |              
* |       | |  _   _  |   |_|_|_|   _ _ _  | |_ _    | | _ _                                                                                    
* |  _ _  | | | |_| | |    _|_|_   |_ _ _| |  _ _|   | _ _ _ |                            
* | |   | | | |     | |  _|_| |_|_         | |             | |  
* | |   | | | |     | | | |     | |        | |_ _ _   _ _ _| |             
* |_|   |_| |_|     |_| |_|     |_|        |_ _ _ _| | _ _ _ |                   

* AmxModx-Es
* https://amxmodx-es.com/Sugisaki
*/

#include <amxmodx>
#include <hamsandwich>

#define PLUGIN    "Refill Ammo (Ham Version)"
#define AUTHOR    "Sugisaki"
#define VERSION    "3.1"

#define m_LastHitGroup 75

new iMax_Players
//cstrike
native cs_set_weapon_ammo(indexnewammo);
//fun
native give_item(index, const item[]);
//engine
native find_ent_by_owner(iIndex, const szClass[], iOwneriJghgType=0);
//fakemeta
native get_pdata_int(_index_Offset_linuxdiff 5_macdiff 5);

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
RegisterHam(Ham_Killed"player""hm_Killed"1)
    
iMax_Players get_maxplayers()
}

public 
hm_Killed(victimkiller)
{
    if(
victim == killer || !is_user_alive(killer) || !(1<= killer <= iMax_Players)) return HAM_IGNORED
    
    
if(get_pdata_int(victimm_LastHitGroup5) == HIT_HEAD)
    {
        new 
weapon get_user_weapon(killer)
        
        new 
namew[20]
        
get_weaponname(weaponnamew31)
        new 
weaponent find_ent_by_owner(-1namewkiller)
        
        
cs_set_weapon_ammo(weaponentmaxclip(weapon))
        
        
emit_sound(killerCHAN_ITEM"items/9mmclip1.wav"VOL_NORMATTN_NORM,PITCH_NORM)
    }
    return 
HAM_IGNORED
}

stock maxclip(wpnid
{    
    static 
ca;
    
ca 0;
    
    switch (
wpnid
    {
        case 
CSW_P228 ca 13;
        case 
CSW_SCOUT ca 10;
        case 
CSW_XM1014 ca 7;
        case 
CSW_MAC10 ca 30;
        case 
CSW_AUG ca 30;
        case 
CSW_ELITE ca 30;
        case 
CSW_KNIFE ca 0;
        case 
CSW_FIVESEVEN ca 20;
        case 
CSW_UMP45 ca 25;
        case 
CSW_SG550 ca 30;
        case 
CSW_GALI ca 35;
        case 
CSW_FAMAS ca 25;
        case 
CSW_USP ca 12;
        case 
CSW_GLOCK18 ca 20;
        case 
CSW_AWP ca 10;
        case 
CSW_MP5NAVY ca 30;
        case 
CSW_M249 ca 100;
        case 
CSW_M3 ca 8;
        case 
CSW_HEGRENADE ca 1;
        case 
CSW_M4A1 ca 30;
        case 
CSW_TMP ca 30;
        case 
CSW_G3SG1 ca 20;
        case 
CSW_DEAGLE    ca 7;
        case 
CSW_SG552 ca 30;
        case 
CSW_AK47 ca 30;
        case 
CSW_P90 ca 50;
    }
    return 
ca;

__________________

Last edited by Sugisaki; 01-15-2015 at 06:51.
Sugisaki 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 18:30.


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