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
1. 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.
2. Copy data/lang/olds_buyammo.txt to addons/amxmodx/data/lang/.
3. Copy configs/olds_ammoprices.ini to addons/amxmodx/configs/ and set
the prices you want.
4. 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.)
5. 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).