AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   HOw to set clip and default clip for weapon ? (https://forums.alliedmods.net/showthread.php?t=172565)

dias 11-22-2011 18:12

HOw to set clip and default clip for weapon ?
 
HOw to set clip and default clip for weapon ? :). I still don't know that. I only know how to set bpammo, but not clip

Devil259 11-22-2011 18:54

Re: HOw to set clip and default clip for weapon ?
 
cs_set_weapon_ammo().

Emp` 11-22-2011 19:26

Re: HOw to set clip and default clip for weapon ?
 
Note that cs_set_weapon_ammo needs the entity index which can be obtained from:

Code:

stock PlayerWeaponEnt( iPlayer, iWeaponID )
{
        if ( is_user_alive( iPlayer ) && iWeaponID != 2 && iWeaponID > 0 && iWeaponID < CSW_VEST )
        {
                new szWeapName[32];
                get_weaponname( iWeaponID, szWeapName, charsmax(szWeapName) );
                new iEntity;
                while ( ( iEntity = engfunc( EngFunc_FindEntityByString, iEntity, "classname", szWeapName ) ) && pev( iEntity, pev_owner ) != iPlayer ) {}
                return iEntity;
        }

        return 0;
}


dias 11-23-2011 04:45

Re: HOw to set clip and default clip for weapon ?
 
can we use fm_find_ent_by_owner ?

Devil259 11-23-2011 07:10

Re: HOw to set clip and default clip for weapon ?
 
I think.

JoKeR LauGh 11-23-2011 07:15

Re: HOw to set clip and default clip for weapon ?
 
I've tried like #2 said but after you reload it will back to normal default clip.

Devil259 11-23-2011 07:19

Re: HOw to set clip and default clip for weapon ?
 
You can do something like that : http://forums.alliedmods.net/showpos...78&postcount=8

or

Quote:

new weapon_id = find_ent_by_owner(-1, "weapon_ak47", id);
if(weapon_id)
{
cs_set_weapon_ammo(weapon_id, 50);
}

Emp` 11-23-2011 11:40

Re: HOw to set clip and default clip for weapon ?
 
If you want to permanently set the max clip of a weapon, look at this plugin: https://forums.alliedmods.net/showthread.php?t=82093


All times are GMT -4. The time now is 08:30.

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