Raised This Month: $ Target: $400
 0% 

Refill "storage ammo" (not clip) when killing enemy


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nss
Junior Member
Join Date: Feb 2011
Old 04-20-2014 , 21:10   Re: Refill "storage ammo" (not clip) when killing enemy
Reply With Quote #1

hi, any helps ? thanks
nss is offline
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 04-21-2014 , 02:21   Re: Refill "storage ammo" (not clip) when killing enemy
Reply With Quote #2

Quote:
Originally Posted by nss View Post
hi, any helps ? thanks
If I get any time later I may code one for you.

If I end up making it ill Pm you.
__________________
Blizzard_87 is offline
NikKOo31
Senior Member
Join Date: May 2013
Location: Home
Old 04-21-2014 , 05:03   Re: Refill "storage ammo" (not clip) when killing enemy
Reply With Quote #3

Hi buddy, not tested, but I hope it helps ^^

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

new const g_max_ammo[] =
{
    
052090132100901120100100909090100120301202003290120290359090 ,10000
}
new 
giveammo

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("DeathMsg""EventDeathMsg""a")
    
giveammo register_cvar("amx_percentgiveammo""0.25")
}

public 
EventDeathMsg()
{
    new 
killer read_data(1)
    if(!
is_user_alive(killer))
        return

    new 
victim read_data(2)
    if(!
is_user_connected(victim) || victim == killer)
        return

    new 
clipammoweapon get_user_weapon(killerclipammo)
    
    if(
weapon == CSW_KNIFE || weapon == CSW_C4)
        return

    new 
give cs_get_user_bpammo(killer) + floatround(get_pcvar_float(giveammo) * g_max_ammo[weapon]) // give 25% of max ammo
    
if(give g_max_ammo[weapon])    //if we are giving more than max, just give max ammo
        
give g_max_ammo[weapon]

    
cs_set_user_bpammo(killerweapongive)


Last edited by NikKOo31; 04-21-2014 at 07:55.
NikKOo31 is offline
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 04-21-2014 , 06:58   Re: Refill "storage ammo" (not clip) when killing enemy
Reply With Quote #4

Quote:
Originally Posted by NikKOo31 View Post
Hi buddy, not tested, but I hope it helps ^^

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

new const g_max_ammo[] =
{
    
052090132100901120100100909090100120301202003290120290359090 ,10000
}
new 
giveammo

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("DeathMsg""EventDeathMsg""a")
    
giveammo register_cvar("amx_percentgiveammo""0.25")
}

public 
EventDeathMsg()
{
    new 
killer read_data(1)
    if(!
is_user_alive(killer))
        return

    new 
victim read_data(2)
    if(!
is_user_connected(victim) || victim == killer)
        return

    new 
clipammoweapon get_user_weapon(killerclipammo)
    
    if(
weapon == CSW_KNIFE || weapon == CSW_C4)
        return

    new 
give floatround(get_pcvar_float(giveammo) * g_max_ammo[weapon]) // give 25% of max ammo
    
if(give g_max_ammo[weapon])    //if we are giving more than max, just give max ammo
        
give g_max_ammo[weapon]

    
cs_set_user_bpammo(killerweapongive)

your code only sets players bpammo to the % of the maximum not Adding that % to current bpammo.
__________________
Blizzard_87 is offline
NikKOo31
Senior Member
Join Date: May 2013
Location: Home
Old 04-21-2014 , 07:56   Re: Refill "storage ammo" (not clip) when killing enemy
Reply With Quote #5

Yup, my bad. Thanks @Blizzard_87 ^^

I edited the code
NikKOo31 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 15:08.


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