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.

Post comment Comments
Gunship_Mark_II
Gunship_Mark_II - - 4,864 comments

That is very useful, much appreciated c:

Reply Good karma Bad karma+2 votes
Foxtrop Author
Foxtrop - - 1,007 comments

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 - - 1,057 comments

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 - - 1,007 comments

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 - - 1,057 comments

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 - - 1,007 comments

I stop trying and just go goldsource :)

Reply Good karma+3 votes
Kazamanowski
Kazamanowski - - 252 comments

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 - - 1,007 comments

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 - - 1 comments

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

Reply Good karma Bad karma+1 vote
Foxtrop Author
Foxtrop - - 1,007 comments

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

Your comment will be anonymous unless you join the community. Or sign in with your social account: