s1lentq / ReGameDLL_CS

:hammer: Reverse-engineered gamedll (CS 1.6 / CZero)
GNU General Public License v3.0
573 stars 196 forks source link

weapon ammo problem when dropping #620

Open wilianmaique opened 3 years ago

wilianmaique commented 3 years ago

problem when picking up weapons from the ground, values other than ammunition,

if you have 10/30 and drop the weapon, if another player picks up the weapon he will only have 10/0

fix the problem.

twisterniq commented 3 years ago

IIRC, it is not a problem. It is bpammo (backpack ammo). That ammo is not dropped with the weapon, it is the ammo that a player has in "inventory".

wilianmaique commented 3 years ago

then, add a cvar so that all the ammo is dropped together.

Vaqtincha commented 3 years ago

@wilianmaique Bad idea. Let's say you have usp and mac10 or ump45 (ammo 45acp) and when throwing usp, the player remains without ammo and this raises questions.

wilianmaique commented 3 years ago

you’re playing a mix / pug your ammo runs out, you’ll get a gun and you don’t have bpammo ammo, you have to be like CSGO

etojuice commented 3 years ago

no this is not CSGO

wilianmaique commented 3 years ago

finally, if you have how to add a 'cvar' it would be interesting

ghost commented 3 years ago

mp_save_bpammo "inventory" // save to inventory mp_save_bpammo "weapon" // save to weapon

it would be very good for servers from csgomod!

Vaqtincha commented 3 years ago
#include <amxmodx>
#include <reapi>

public plugin_init()
{
    register_plugin("Drop Weapon With Ammo", "0.1", "Vaqtincha")

    RegisterHookChain(RG_CreateWeaponBox, "CreateWeaponBox")

}

public CreateWeaponBox(const pItem, const pPlayer, const modelName[], Float:origin[3], Float:angles[3], Float:velocity[3], Float:lifeTime, bool:packAmmo)
{
    for (new pWeapon = NULLENT, ammoType = get_member(pItem, m_iPrimaryAmmoType), InventorySlotType:iSlot = PRIMARY_WEAPON_SLOT; iSlot <= PISTOL_SLOT; iSlot++)
    {
        pWeapon = get_member(pPlayer, m_rgpPlayerItems, iSlot)

        while (pWeapon > 0)
        {
            if (get_member(pWeapon, m_iPrimaryAmmoType) == ammoType)
            {
                return
            }

            pWeapon = get_member(pWeapon, m_pNext)
        }
    }

    SetHookChainArg(8 /* packAmmo */, ATYPE_BOOL, true)
}

only there is no RG_CreateWeaponBox API yet :(

Vaqtincha commented 3 years ago

https://github.com/s1lentq/ReGameDLL_CS/issues/520

wilianmaique commented 3 years ago
#include <amxmodx>
#include <reapi>

public plugin_init()
{
  register_plugin("Drop Weapon With Ammo", "0.1", "Vaqtincha")

  RegisterHookChain(RG_CreateWeaponBox, "CreateWeaponBox")

}

public CreateWeaponBox(const pItem, const pPlayer, const modelName[], Float:origin[3], Float:angles[3], Float:velocity[3], Float:lifeTime, bool:packAmmo)
{
  for (new pWeapon = NULLENT, ammoType = get_member(pItem, m_iPrimaryAmmoType), InventorySlotType:iSlot = PRIMARY_WEAPON_SLOT; iSlot <= PISTOL_SLOT; iSlot++)
  {
      pWeapon = get_member(pPlayer, m_rgpPlayerItems, iSlot)

      while (pWeapon > 0)
      {
          if (get_member(pWeapon, m_iPrimaryAmmoType) == ammoType)
          {
              return
          }

          pWeapon = get_member(pWeapon, m_pNext)
      }
  }

  SetHookChainArg(8 /* packAmmo */, ATYPE_BOOL, true)
}

only there is no RG_CreateWeaponBox API yet :(

n/a plugin

scripting6 commented 1 year ago
#include <amxmodx>
#include <reapi>

public plugin_init()
{
    register_plugin("Drop Weapon With Ammo", "0.1", "Vaqtincha")

    RegisterHookChain(RG_CreateWeaponBox, "CreateWeaponBox")

}

public CreateWeaponBox(const pItem, const pPlayer, const modelName[], Float:origin[3], Float:angles[3], Float:velocity[3], Float:lifeTime, bool:packAmmo)
{
    for (new pWeapon = NULLENT, ammoType = get_member(pItem, m_iPrimaryAmmoType), InventorySlotType:iSlot = PRIMARY_WEAPON_SLOT; iSlot <= PISTOL_SLOT; iSlot++)
    {
        pWeapon = get_member(pPlayer, m_rgpPlayerItems, iSlot)

        while (pWeapon > 0)
        {
            if (get_member(pWeapon, m_iPrimaryAmmoType) == ammoType)
            {
                return
            }

            pWeapon = get_member(pWeapon, m_pNext)
        }
    }

    SetHookChainArg(8 /* packAmmo */, ATYPE_BOOL, true)
}

only there is no RG_CreateWeaponBox API yet :(

n/a plugin

true