Named Game of the Year by over 50 publications, Valve's d├ębut title blends action and adventure with award-winning technology to create a frighteningly realistic world where players must think to survive. Also includes an exciting multiplayer mode that allows you to play against friends and enemies around the world.

Post tutorial Report RSS Half-life1 Coding: More than 254 of ammo

In hl1 you can simply edit the max_ammo_carry of certain ammo type but the hud would show up to 254 of ammo, this is because the message that send the info to the client uses a byte value for it.

Posted by on - Basic Server Side Coding

Open player.cpp and look for gmsgAmmoX definition

gmsgAmmox

we need to change that 2 to -1

gmsgAmmoxMOD

then look for the function SendAmmoUpdate

sendammoupdate

we need to edit those WRITE_BYTE from the message and change them to WRITE_SHORT, also change the 254 to 999(the new ammo limit, now just limited by the HUD)

sendammoupdateMOD

then we need to open ammo.cpp and go to the ammox function

ammox

we need to change the READ_BYTE to READ_SHORT

ammoxMOD

with that now the client receives the information of the ammo, up to 65,535 theorically but you need to modified the HUD in order to expand the digits shown.

Comments
Gunship_Mark_II
Gunship_Mark_II

That is very useful, much appreciated c:

Reply Good karma Bad karma+2 votes
Foxtrop Author
Foxtrop

I hope so, I tried to find why the ammo hud didnt accept more ammo for a good time

Reply Good karma+1 vote
Secret_Coming
Secret_Coming

I'm glad to see this game as more mod support than any other recent valve game.

Reply Good karma Bad karma+3 votes
Foxtrop Author
Foxtrop

I tried to mod in source engine but I could not even compile a simple mod everything seems broken with the source sdk

Reply Good karma+1 vote
Secret_Coming
Secret_Coming

are you sure you are doing the "updated" stuff? Valve broke some mods after steampipe update, so almost anything before 2011 is pretty much broken (including tutorials)

Reply Good karma Bad karma+1 vote
Foxtrop Author
Foxtrop

I stop trying and just go goldsource :)

Reply Good karma+3 votes
KenWayneKazama
KenWayneKazama

This is really useful for me! Thanks! I'm going to start game modding soon and I thought of making a Half-Life mod. Very useful stuff for weapons like Minigun and etc. Can I do the same limit removal stuff for health and armor digits?

Reply Good karma Bad karma+1 vote
Foxtrop Author
Foxtrop

The health uses this message
MESSAGE_BEGIN( MSG_ONE, gmsgHealth, NULL, pev );
WRITE_BYTE( iHealth );
MESSAGE_END();
and is a byte to so if you change it to short and all the other stuff you can allow it to send a higher number

Reply Good karma+2 votes
ankkala
ankkala

Not working, sorry. After making these changes, the HUD always shows 0 ammo.

Reply Good karma Bad karma+1 vote
Foxtrop Author
Foxtrop

this changes are for the server to send info to the client, these do not include changes on the HUD itself, that would be a next step to do

Reply Good karma+1 vote
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

Follow Report Profile
Icon
Half-Life
Platforms
Windows, Mac, Linux, PS2
Developer
Valve
Engine
GoldSource
Contact
Send Message
Release date
Game watch
Follow
Purchase
Tutorial
Browse
Tutorials
Report
Report
Share
Related Games
Half-Life
Half-Life First Person Shooter
Related Engines
GoldSource
GoldSource Commercial
Related Groups
Sierra Entertainment
Sierra Entertainment Developer & Publisher
Valve
Valve Developer & Publisher