Raised This Month: $ Target: $400
 0% 

L4D2, How to Get Reserve Ammo Without m_hOwnerEntity?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
NgBUCKWANGS
Senior Member
Join Date: Dec 2014
Old 09-28-2017 , 05:51   L4D2, How to Get Reserve Ammo Without m_hOwnerEntity?
Reply With Quote #1

Hello,

I have a gripe with how I'm getting reserve ammo to any primary weapon. I currently have

PHP Code:
int _GetReserve(int ent) {

    static 
clienttype;
    
client GetEntPropEnt(entProp_Send"m_hOwnerEntity");

    if (
IsClientValid(client2)) {
        
type GetEntProp(entProp_Send"m_iPrimaryAmmoType");
        return 
GetEntProp(clientProp_Send"m_iAmmo"4type);
    }

    return -
1;

This works perfectly if the weapon is being held by a player. If the weapon is on the ground, it's f*****. I was
equipping the weapon onto a player just to get the reserve and then removing it but it feels hackish and if I remember correctly the player could potentially end up with 2 weapons in their primary slot. I was thinking about creating one fake client and hiding them off the map but again, it feels so damn hackish. I'm thinking there has to be a way to look at any weapon and without anyone holding it, get the reserve ammo?

I'm thinking maybe SetEntProp on the m_hOwnerEntity to the client requesting the reserve? If you know a better approach, can you please share? Thanks!
NgBUCKWANGS is offline
 



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 22:51.


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