Skip to content
View in the app

A better way to browse. Learn more.

Learn more

Ammo Purchase Command

Featured Replies

  • Administrator

A buy command that tops up ammo for the held weapon at a configurable price.

Ammo Purchase Command 1.0.0 (olds.ro)

A buy command that fills up the backpack ammo of the gun in the player's hands, for a price set per weapon class.

  • /buyammo (or amx_buyammo from the console) fills the backpack of the gun in hand up to the game's limit (90 for an AK-47, 35 for a Desert Eagle, and so on).
  • The price depends on the weapon class and is set in configs/olds_ammoprices.ini (pistol 200, shotgun 300, smg 300, rifle 400, sniper 500, machinegun 600 by default). A class that is not listed costs olds_ba_price.
  • With olds_ba_free_pistol 1, pistol ammo is free.
  • With olds_ba_buytime 1, ammo can be bought only during the buy time (mp_buytime).
  • Refused, with a chat line and no money taken: holding the knife, a grenade or the bomb; a full backpack (the player is told so); not enough money (the price is shown); after the buy time; dead.

Requirements

  • ReHLDS, ReGameDLL_CS, Metamod-r, ReAPI
  • AMX Mod X 1.10.0.5490 or newer, with the cstrike module (enabled by default)

Install

  • Compile scripting/olds_buyammo.sma and copy olds_buyammo.amxx to addons/amxmodx/plugins/. The compiler needs ReAPI's include files (reapi.inc and the reapi_*.inc files from the ReAPI release, in addons/amxmodx/scripting/include/) next to the stock AMX Mod X includes.
  • Copy data/lang/olds_buyammo.txt to addons/amxmodx/data/lang/.
  • Copy configs/olds_ammoprices.ini to addons/amxmodx/configs/ and set the prices you want.
  • Copy configs/plugins/olds_buyammo.cfg to addons/amxmodx/configs/plugins/ and change the values you want. (If the file is missing, the plugin writes one with the defaults the first time it starts.)
  • Add olds_buyammo.amxx to addons/amxmodx/configs/plugins.ini.

Prices (addons/amxmodx/configs/olds_ammoprices.ini) One "class price" pair per line; lines starting with ; # or // are comments. Classes: pistol, shotgun, smg, rifle, sniper, machinegun. The file is read when the map starts.

Settings (addons/amxmodx/configs/plugins/olds_buyammo.cfg)

  olds_ba_price 400         price for a weapon class that is not in
                            olds_ammoprices.ini
  olds_ba_buytime 1         1 = only during the buy time; 0 = any time
  olds_ba_free_pistol 0     1 = pistol ammo is free

The buy time is the server's own mp_buytime (minutes; -1 = no limit).

Commands

  say /buyammo, say_team /buyammo   fill up the ammo of the gun in hand
  amx_buyammo                       the same from the console or a key
                                    (bind x amx_buyammo)

Chat text "[Ammo] Ammo filled up for $400." and the refusal lines are in data/lang/olds_buyammo.txt and can be translated there. The sound is the game's own items/gunpickup2.wav, so nothing is downloaded.

Tested on ReHLDS 3.15.0.896, ReGameDLL_CS 5.30.0.814, Metamod-r 1.3.0.149, AMX Mod X 1.10.0-git5490, ReAPI 5.29.0.358.

Credits and licence Written from scratch by alexit (olds.ro workshop) for workshop card LIB-0075. Licence: GNU General Public License v3.0 or later (GPL-3.0-or-later).

Install

Download the ZIP above and copy its folders into cstrike/. Compile the .sma in addons/amxmodx/scripting with the AMX Mod X 1.10 compiler, put the .amxx in addons/amxmodx/plugins, and add it to plugins.ini.

Files: addons/amxmodx/scripting/olds_buyammo.sma, test/lib0075_probe.sma

License: GPL-3.0-or-later.
Written for the olds.ro plugin workshop (LIB-0075), by alexit and checked by the automated Claude review.

Ammo Purchase Command
v1.0Counter-Strike 1.6PluginTests: warnings
AMX Mod X 1.10Server engine ReHLDSNeeds ReAPI YesMetamod Metamod-R0 downloads6 KBUpdated 11 hours ago
Sign in to download
Pawn (AMX Mod X) · 268 lines
/*
 * Ammo Purchase Command (olds.ro workshop card LIB-0075)
 *
 * A buy command that fills up the backpack ammo of the gun in the player's
 * hands, for a price set per weapon class.
 *
 * Commands:
Show all 268 lines

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.