Raised This Month: $ Target: $400
 0% 

Add bullets to current mag?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 06-26-2010 , 19:35   Add bullets to current mag?
Reply With Quote #1

Is there a way to add like 2 bullets in the current mag of the current gun in use? I mean maybe a native like cs_set_user_bpammo().
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 06-26-2010 , 19:44   Re: Add bullets to current mag?
Reply With Quote #2

Quote:
Originally Posted by Jelle View Post
Is there a way to add like 2 bullets in the current mag of the current gun in use? I mean maybe a native like cs_set_user_bpammo().
This should work, I don't know if you're trying to use a say command or what not.

PHP Code:
new userammo cs_get_user_bpammoidCSW_WEAPONNAME )
cs_set_user_bpammoidCSW_WEAPONNAMEuserammo 
Of course change the "CSW_WEAPONNAME" to "CSW_AK47" or whatever weapon it is.
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 06-26-2010 , 20:13   Re: Add bullets to current mag?
Reply With Quote #3

Code:
#define cs_add_user_bpammo(%1,%2,%3) (cs_set_user_bpammo(%1,%2,cs_get_user_bpammo(%1,%2)+%3) // Usage cs_add_user_bpammo( id, CSW_DEAGLE, 2 )
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 06-26-2010 , 21:15   Re: Add bullets to current mag?
Reply With Quote #4

Quote:
Originally Posted by wrecked_ View Post
Code:
#define cs_add_user_bpammo(%1,%2,%3) (cs_set_user_bpammo(%1,%2,cs_get_user_bpammo(%1,%2)+%3) // Usage cs_add_user_bpammo( id, CSW_DEAGLE, 2 )
Lol'd because my version = long way
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX is offline
Kreation
Veteran Member
Join Date: Jan 2010
Location: Illinois
Old 06-26-2010 , 23:26   Re: Add bullets to current mag?
Reply With Quote #5

Wouldn't that add ammo for their bp? The current mag would be something like as they're shooting and the ammo is running out. I think that may be what he wants, not sure though.
__________________
Hi.
Kreation is offline
Old 06-27-2010, 00:30
wrecked_
This message has been deleted by wrecked_. Reason: nvm
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 06-27-2010 , 00:43   Re: Add bullets to current mag?
Reply With Quote #7

Code:
cs_add_weapon_ammo( id, weapon, amt=1 ) {     if( is_user_alive( id ) )     {         new bad_weapons_bitsum = ( ( 1 << CSW_KNIFE ) | ( 1 << CSW_HEGRENADE ) | ( 1 << CSW_FLASHBANG ) | ( 1 << CSW_SMOKEGRENADE ) | ( 1 << 2 ) )                 if( !( ( 1 << weapon ) & bad_weapons_bitsum ) )         {             new wname[20]             get_weaponname( weapon, wname, 19 )             new iWep = find_ent_by_owner( iWep, wname, id, 0 )                         if( iWep )             {                 cs_set_weapon_ammo( iWep, cs_get_weapon_ammo( iWep ) + amt )                 return iWep;             }         }     }     return 0; } // Usage Example cs_add_weapon_ammo( id, CSW_DEAGLE, 2 ) cs_add_weapon_ammo( id, CSW_AWP, 1 )
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT

Last edited by wrecked_; 06-28-2010 at 10:11.
wrecked_ is offline
madeitout
Member
Join Date: Jun 2008
Old 06-27-2010 , 23:37   Re: Add bullets to current mag?
Reply With Quote #8

PHP Code:
stock set_user_clip(idammo)
{
    new 
weaponname[32], weaponid = -1weapon get_user_weapon(id__);
    
get_weaponname(weaponweaponname31);
    while ((
weaponid engfunc(EngFunc_FindEntityByStringweaponid"classname"weaponname)) != 0)
        if (
pev(weaponidpev_owner) == id) {
            
set_pdata_int(weaponid51ammo4);
            return 
weaponid;
        }
    return 
0;

__________________
madeitout is offline
Jelle
[b]MOAR CANDY[/b]
Join Date: Aug 2009
Location: Denmark
Old 06-28-2010 , 09:43   Re: Add bullets to current mag?
Reply With Quote #9

Thank you all.

What I want to do is to make a superhero, where you, each second gain 2 more bullets in current mag. This makes it so people just doesn't spray, which is a common thing in SH mod.

Also, I have no idea how to use stocks.

I believe wrecked_'s version is the best?
__________________
No idea what to write here...
Jelle is offline
Send a message via MSN to Jelle
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 06-28-2010 , 10:10   Re: Add bullets to current mag?
Reply With Quote #10

Both will work. Mine is a little more direct, as his searches for the gun in a loop.

A stock is a function. All you have to do is paste it at the bottom of your plugin and you can use it.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ 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 14:44.


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