AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Weapon owner (https://forums.alliedmods.net/showthread.php?t=252309)

Xalus 11-30-2014 06:21

Weapon owner
 
For my nightcrawler unlimmited clip,
I tought to make an easy way for it.

Tho easy doesnt always work, sometimes it does, sometime it doesnt.
Any impovements, fix sugguestions?

Thx

PHP Code:

            if(get_pcvar_num(g_pAdrenalineUnlimmitedClip))
            {
                new 
arrayWeapons[32], intWeaponsstrWeaponname[32], intEntity
                get_user_weapons
(idarrayWeaponsintWeapons)
                
                for(new 
0intWeaponsi++)
                {
                    if(
g_iMaxClipAmmo[arrayWeapons[i]])
                    {
                        
get_weaponname(arrayWeapons[i], strWeaponname31)
                        
                        if(
pev_valid( (intEntity engfunc(EngFunc_FindEntityByStringid"classname"strWeaponname)) ))
                        {
                            
cs_set_weapon_ammo(intEntity5000)
                        }
                    }
                }
            } 


DavidJr 11-30-2014 07:50

Re: Weapon owner
 
Try this

PHP Code:

new iWpn get_user_weapon(iIndex);
new 
iEnt Retrieve_WeaponEnt(iIndexiWpn);
    
cs_set_weapon_ammo(iEnt5000);

Retrieve_WeaponEnt(iIndexwpnIndex)
{
    static 
szWpn[32];
    
get_weaponname(wpnIndexszWpnsizeof szWpn 1);
    
    new 
iEnt = -1;
    
iEnt fm_find_ent_by_owner(iEntszWpniIndex);
    
    return 
iEnt;



Arkshine 11-30-2014 08:31

Re: Weapon owner
 
This is worse.

Just loop with m_rgpPlayerItems.


All times are GMT -4. The time now is 15:19.

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