m9k Ammo for Darkrp

I can’t seem to find the answer for this. How do I add m9k ammo to my darkrp server?
Edit: I can’t figure out how to add ar2 ammo. It doesn’t show up when I add it.

Post your addentities.lua

Sigh, you shouldn’t be using something so mainstream for a good server anyways.

To add in m9k ammo into your darkrp server add the ammo types in the ammotypes.lua file. Simple.

How do you add them? Find the ammo type to place in (this case example will be sniper rounds).

  1. Find which m9k addon has the sniper ammo (in this case its the m9k heavy weapons addon)
  2. Use a batch file or a program (GMAD) to extract the addon so you can explore the contents inside.
  3. Locate the lua/entities file. In this file contains the ammo types used by all the ammo types of this pack.
    4)in this case m9k_ammo_sniper_rounds is the ammo entity name. Opening the folder will contain a shared.lua file. Opening it will contain all the info needed to add m9k ammo to your darkrp server.
    5)Goback to your gamemodes/darkrp/gamemode/ammotypes.lua and do the following:
    [LUA] GM:AddAmmoType(“m9k_ammo_sniper_rounds”, “SNIPER ammo”, “models/Items/sniper_round_box.mdl”, 200, 120 end)[/LUA]
    If you dont know what this means well this.
    GM AddAmmoTYPE = AddAmmoType
    “m9k_ammo_sniper_rounds” is the entitiy name.
    “SNIPER ammo” is the name of the ammo type we desire.
    “models/Items/sniper_round_box.mdl” is the model needed (found in shared.lua of the ammo type)
    200 = Price of box of ammo
    120 = Bullets one box of ammo contains.
    DONT FORGET THE END AND THE COMMAS.
    Rince and repeat for all the ammo types you want to add in.

-Matt.

PS You can also restrict ammo types using THIS code instead.
[LUA]GM:AddAmmoType(“m9k_ammo_sniper_rounds”, “SNIPER ammo”, “models/Items/sniper_round_box.mdl”, 200, 120, function( ply ) return ply:Team() == TEAM_ONE or ply:Team() == TEAM_TWO end)[/LUA]
The extra function checks if the player is in X team (or Y team) and allows them to purchase it. Otherwise they cant. And wont be able to see it in their f4 menu.
Just make sure you replace TEAM_ONE and TEAM_TWO with the respective job teamnames in the darkrp/gamemodes/shared.lua file…

-Matt

The base weapons pack is really nice.

[editline]1st September 2013[/editline]

Thanks! But the main thing I can’t seem to figure out is ar2 ammo for the rifles.

Did you check your addons/m9k_assault_rifles/lua/entities folder? You should see what you need there :slight_smile:

All that contains is sniper ammo.

SHOULD have sniper rounds, 357 ammo, ar2 ammo, buckshot, pistol ammo, smg ammo, and winchester ammo. You should redownload the m9k assault riffles pack then since if you only have the sniper rounds it seems incomplete.

I’m using the m9k base pack not assault rifles.

[editline]1st September 2013[/editline]

Doing it like this fixed it:


AddEntity("Rifle Ammo", {
	ent = "m9k_ammo_ar2",
	model = "models/Items/BoxMRounds.mdl",
	price = 250,
	max = 5,
	cmd = "/buyrifleammo",
})

AddEntity("Sniper Ammo", {
	ent = "m9k_ammo_sniper_rounds",
	model = "models/Items/sniper_round_box.mdl",
	price = 250,
	max = 5,
	cmd = "/buysniperammo",
})