DarkRP:Ammo

From Official DarkRP Wiki
Revision as of 18:40, 30 May 2012 by FPtje (talk | contribs) (Created page with "'''NOTE: This feature is only available in the DarkRP SVN Revision 1173 or later!''' A file called ammotypes.lua in your DarkRP/gamemode folder is available for you to custom...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

NOTE: This feature is only available in the DarkRP SVN Revision 1173 or later!

A file called ammotypes.lua in your DarkRP/gamemode folder is available for you to customize everything about DarkRP ammo buying.

There are three ammo boxes in there by default: the pistol, shotgun and rifle ammo.

Here's how you create your own:

GM:AddAmmoType(ammoType, name, model, price, amountGiven, customCheck)

ammoType: The name of the ammo that Garry's mod recognizes If you open your SWEP's shared.lua, you can find the ammo name next to SWEP.Primary.Ammo = "AMMO NAME HERE" or SWEP.Secondary.Ammo = "AMMO NAME HERE"

name: The name you want to give to the ammo. This can be anything.

model: The model you want the ammo to have in the F4 menu

price: the price of your ammo in dollars

amountGiven: How much bullets of this ammo is given every time the player buys it

customCheck: (Optional! Advanced!) a Lua function that describes who can buy the ammo. Similar to the custom check function for jobs and shipments Parameters: ply: the player who is trying to buy the ammo

Removing ammo

Any/all the ammo can be removed without breaking the gamemode. Just remove the lines with the ammo types.

Examples:

Adding rifle ammo (in by default)

GM:AddAmmoType("smg1", "Rifle ammo", "models/Items/BoxMRounds.mdl", 80, 30)

Adding rifle ammo for donator/admin only (replace the original rifle ammo with this)

GM:AddAmmoType("smg1", "Rifle ammo", "models/Items/BoxMRounds.mdl", 80, 30, function(ply)
	return ply:IsAdmin() or ply:GetNWString("usergroup") == "donator"
end)