Raised This Month: $ Target: $400
 0% 

How to put in weapon only 1 bullet?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PWA
Junior Member
Join Date: May 2010
Old 05-21-2010 , 19:20   How to put in weapon only 1 bullet?
Reply With Quote #1

Hello everyone, i wanted to ask, how to put in the weapon only 1 bullet?
Help me ;)
PWA is offline
KadiR
Unnecessary Member
Join Date: Aug 2008
Location: Zürich / Switzerland
Old 05-21-2010 , 19:22   Re: How to put in weapon only 1 bullet?
Reply With Quote #2

http://www.amxmodx.org/funcwiki.php?go=func&id=208
KadiR is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 05-21-2010 , 21:40   Re: How to put in weapon only 1 bullet?
Reply With Quote #3

PHP Code:
public somefunc(id)
{
    if(
is_user_alive(id))
    {
         new 
wpn = (give_item(id"weapon_usp")
         
cs_set_weapon_ammo(wpn1)
         
cs_set_user_bpammo(idCSW_USP0)
    }

__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.

Last edited by drekes; 05-21-2010 at 21:42.
drekes is offline
Send a message via MSN to drekes
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-21-2010 , 23:27   Re: How to put in weapon only 1 bullet?
Reply With Quote #4

PHP Code:
public somefunc(id)
{
    if(
is_user_alive(id))
    {
        new 
wpn give_item(id"weapon_usp")
        if(
wpn 0)
        {
            
cs_set_weapon_ammo(wpn1)
        }
        
cs_set_user_bpammo(idCSW_USP0)
    }

But I would use something to make the rest easier like:

Code:
GiveWeapon( iPlayer, iWeaponID = 0, szWeaponName[ ] = "", iClip = -1, iAmmo = -1 ) {     if( !is_user_alive( iPlayer ) )     {         return 0;     }         new _szWeaponName[ 20 ]; // weapon_smokegrenade = 19         if( !iWeaponID )     {         if( !( iWeaponID = get_weaponid( szWeaponName ) ) )         {             return 0;         }                 copy( _szWeaponName, charsmax( _szWeaponName ), szWeaponName );     }     else if( !get_weaponname( iWeaponID, _szWeaponName, charsmax( _szWeaponName ) ) )     {         return 0;     }         new iWeaponEntity = give_item( iPlayer, _szWeaponName );         if( iWeaponEntity > 0     &&  iClip >= 0 )     {         cs_set_weapon_ammo( iWeaponEntity, iClip );     }         if( iAmmo >= 0 )     {         cs_set_weapon_ammo( iPlayer, iWeaponID, iAmmo );     }         return 1; }

Code:
GiveWeapon( iPlayer, CSW_USP, _, 1, 0 ); // 1 clip ammo GiveWeapon( iPlayer, _, "weapon_ak47" ); // default ammo
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 05-21-2010 at 23:36.
Exolent[jNr] is offline
KadiR
Unnecessary Member
Join Date: Aug 2008
Location: Zürich / Switzerland
Old 05-22-2010 , 05:42   Re: How to put in weapon only 1 bullet?
Reply With Quote #5

Is that wrong when I make this, works perfectly for me:

PHP Code:
        new weapon_id find_ent_by_owner(-1"weapon_awp"id);
        if(
weapon_id)
        {
            
cs_set_weapon_ammo(weapon_id1);
            
//cs_set_user_bpammo ( id, CSW_AWP, 3 );
        

KadiR is offline
NiQu
Veteran Member
Join Date: Nov 2009
Old 05-22-2010 , 05:51   Re: How to put in weapon only 1 bullet?
Reply With Quote #6

You have errors in your code exolent.
__________________
My Projects
  • RoTAPI V0.0.1 ------- Private
    • Progress - [||||||||||]
  • CashMod V0.0.6 ----- Public
    • Progress - [||||||||||]
  • CashMod V0.0.7 ----- Public
    • Progress - [||||||||||]
NiQu is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-22-2010 , 22:57   Re: How to put in weapon only 1 bullet?
Reply With Quote #7

Quote:
Originally Posted by NiQu View Post
You have errors in your code exolent.
Show me?
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 03:33.


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