Changing clip and backpack ammo in Half-Life
Yes... how would one go on about that?
For Team Fortress, Day of Defeat, Natural Selection, of course for Counter-Strike, and even for the uncommon mod The Specialists there are appropriate modules which provide the functions. But Half-Life, which is the incarnation of standard and default seems to have no support for this at all. If I am just blind please direct me to the right direction. Untill then... Code:
|
Re: Changing clip and backpack ammo in Half-Life
I saw a thread about this before that had the offsets for half-life.
Search the Scripting Help section for it. |
Re: Changing clip and backpack ammo in Half-Life
This is all I found:
PHP Code:
"type" is not simply ammo_xyz, but some internal names. E.g. for radioactive ammo (ammo_gaussclip) you'd write "uranium", and for crossbow ammo (ammo_crossbow) you'd write "bolts". The others are "357", "9mm", "buckshot", "rocket" and "ARgrenades". Took me some time to figure them all out, especially "uranium". This works, but it changes backpack ammo only. ("uranium" and "ARgrenades" excepted) My great plan is to directly change clip ammo. Other Hamsandwich functions only allow to read ammo. I might use Ham_Player_UpdateClientData, but I don't know the offsets. It would be great if you could search for that thread you have in mind. You'd probably recognize it faster than me? Thanks in advance. |
Re: Changing clip and backpack ammo in Half-Life
See this for bpammo offsets : http://forums.alliedmods.net/showthread.php?t=93103
For weapons m_iClip offset you will have to find them by yourself. For ammo names, you can hook GiveAmmo forward, and for weaponbox ammo names (can be slightly differents like some caps at some places) you have to retrieve weaponbox offset, then convert from iString to szStrind with gbl_SzStringFromIndex or some name like that) To retrieve weapon by player id, see my snippet (search for id offsets first) : http://forums.alliedmods.net/showthread.php?t=85962 |
Re: Changing clip and backpack ammo in Half-Life
// Weapon
35 - m_flNextPrimaryAttack 36 - m_flNextSecondaryAttack 37 - m_flTimeWeaponIdle 38 - m_iPrimaryAmmoType 39 - m_iSecondaryAmmoType 40 - m_iClip 41 - m_iClientClip // player 306 - m_pActiveItem 307 - m_pClientActiveItem 308 - m_pLastItem 310 -> 321 : m_rgAmmo 342 -> 353 : m_rgAmmoLast |
Re: Changing clip and backpack ammo in Half-Life
Thanks for the offsets, but I can't get it to work...
Code:
Not even a merciless crash, as if nothing happened. |
Re: Changing clip and backpack ammo in Half-Life
Ham_Player_UpdateClientData has not the purpose to give clip or bpammo.
Use : set_pdata_int( WeaponIndex, m_iClip, Ammo, 4 ); - WeaponIndex = Weapon entity index - m_iClip = Weapon offset, 40 - Ammo = New ammo value - 4 = Extra offset for linux. Since it's a linux offset, it's 4. |
Re: Changing clip and backpack ammo in Half-Life
That works fine, especially doing fastfire with m_flNextPrimaryAttack on the rocket launcher is awesome. Thanks!
Now... how would I go about nicely hooking this up to player fire? Like: Player fires, and I block ammo deduction and hook up a different value for m_flNextPrimaryAttack. Would that be possible with forwarding UpdateClientData? |
Re: Changing clip and backpack ammo in Half-Life
PHP Code:
http://forums.alliedmods.net/showthread.php?t=93644 EDIT: ooops i forgot put crabs xD :crab::crab::crab: |
Re: Changing clip and backpack ammo in Half-Life
Look at my 2 plugins :
http://forums.alliedmods.net/showthread.php?p=728613 http://forums.alliedmods.net/showthread.php?t=81183 I also suggest you to have a look at HLSDK from where i copied almost all code of those plugins and where you gonna find code for each HL weapon. Also, not that what i did is hook correct places, but doesn't mean you can't achieve it more efficiently, or less cpu using. |
All times are GMT -4. The time now is 15:09. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.