Setting up M9K in DarkRP

Adding M9K weapons, dont require much these days. However you cant do it without touching some code.
Note: This article has most M9K Weapons premade at the bottom of the thread.

We have chosen to provide two examples of weapons and all the ammo you need for all of the M9K weapons.

Firstly, you need to have darkrpmodification installed, this can be done from the mod manager. Once installed, enter the file manager and locate the shipments.lua inside addons/darkrpmodification/lua/darkrp_customthings/shipments.lua This file will hold all our custom code, so lets get started.

We have chosen two of the most requested weapons in our line up, however you can very easily add other once using these as a template.

First we have the standard AK47, we suggest you change the price to what you want.

DarkRP.createShipment("M9K AK47", {
model = "models/weapons/w_ak47_m9k.mdl",
entity = "m9k_ak74",
price = 2450,
amount = 10,
seperate = false,
pricesep = nil,
noship = false,
allowed = {TEAM_GUN}
})

Next we have the AI AW50 Sniper, again edit the price as you see fit:

DarkRP.createShipment("AI AW50", {
model = "models/weapons/w_acc_int_aw50.mdl",
entity = "m9k_aw50",
price = 2450,
amount = 10,
seperate = false,
pricesep = nil,
noship = false,
allowed = {TEAM_GUN}
})

Create your own!
You can edit the code as you like, and use them as a template for adding the remaining weapons. You can very easily find out the entity name by simply opening your single player, go to “Weapons” and right-click the weapon you want to add, and click “Copy To Clipboard” now you have the entity name ie weapon_ak47 stored, and you wanna change the entity = “m9k_aw50”, to whatever your custom weapon was called. You can simply remove the m9k_ak74 and replace it with what you just copied.

Now to find the model, its a little harder you want to replace model = “models/weapons/w_ak47_m9k.mdl”, with a new model path, so head over to “Spawnlist” in the Q menu, and scroll down to Browse, and then expand addons. Then locate the m9k packages, and depending on what weapon you wanted to add, it may be in Assault, Heavy, Small Arms or Specialties. Now simply find the one you wanted, ie the ak47. And spawn the one without the hands on it, just make sure it looks alright. Now again like we did before, right click and copy to clipboard. Now just replace models/weapons/w_ak47_m9k.mdl with whatever you copied.

Now the ammo:

To make it as easy as possible, we simply provide ALL of the ammo types you need. All this code simply goes into the file located at addons/darkrpmodification/lua/darkrp_customthings/ammo.lua:

Ammo

DarkRP.createAmmoType("357", {
	name = "M9K 357 ammo",
	model = "models/Items/357ammobox.mdl",
	price = 60,
	amountGiven = 20
})
DarkRP.createAmmoType("ar2", {
	name = "M9K Rifle ammo",
	model = "models/Items/BoxMRounds.mdl",
	price = 60,
	amountGiven = 30
})
DarkRP.createAmmoType("buckshot", {
	name = "M9K Shotgun ammo",
	model = "models/Items/BoxBuckshot.mdl",
	price = 40,
	amountGiven = 8
})
DarkRP.createAmmoType("pistol", {
	name = "M9K Pistol ammo",
	model = "models/Items/BoxSRounds.mdl",
	price = 20,
	amountGiven = 20
})
DarkRP.createAmmoType("smg1", {
	name = "M9K SMG ammo",
	model = "models/Items/BoxMRounds.mdl",
	price = 40,
	amountGiven = 60
})
DarkRP.createAmmoType("SniperPenetratedRound", {
	name = "M9K Sniper ammo",
	model = "models/Items/BoxMRounds.mdl",
	price = 80,
	amountGiven = 6
})

If you are lazy you can use these, not sure if they are all there but if not use the instructions above to add the missing ones!
You may think its not structured like the others, however the format used below is just the “short-hand” version of the code above. :slight_smile:

PISTOLS

DarkRP.createShipment("Python", "models/weapons/w_colt_python.mdl", "m9k_coltpython", 12000, 10, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("Python Single", "models/weapons/w_colt_python.mdl", "m9k_coltpython", 1200, 1, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("Colt 1911", "models/weapons/s_dmgf_co1911.mdl", "m9k_colt1911", 12000, 10, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("Colt 1911 Single", "models/weapons/s_dmgf_co1911.mdl", "m9k_colt1911", 1500, 1, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("HK 45C", "models/weapons/w_hk45c.mdl", "m9k_hk45", 15000, 10, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("HK 45C Single", "models/weapons/w_hk45c.mdl", "m9k_hk45", 2000, 1, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("Luger", "models/weapons/w_luger_p08.mdl", "m9k_luger", 12000, 10, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("Luger Single", "models/weapons/w_luger_p08.mdl", "m9k_luger", 1000, 1, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("Raging Bull", "models/weapons/w_hk45c.mdl", "m9k_ragingbull", 30000, 10, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("Raging Bull Single", "models/weapons/w_hk45c.mdl", "m9k_ragingbull", 6000, 1, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("S&W 500", "models/weapons/w_sw_model_500.mdl", "m9k_model500", 27500, 10, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("S&W 500 Single", "models/weapons/w_sw_model_500.mdl", "m9k_model500", 5500, 10, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("M29 Satan", "models/weapons/w_m29_satan.mdl", "m9k_m29satan", 30000, 10, false, 0, false, {TEAM_LIGHT})
DarkRP.createShipment("M29 Satan Single", "models/weapons/w_m29_satan.mdl", "m9k_m29satan", 7500, 1, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("Baretta", "models/weapons/w_beretta_m92.mdl", "m9k_m92baretta", 14000, 10, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("Baretta Single", "models/weapons/w_beretta_m92.mdl", "m9k_m92baretta", 2000, 1, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("S&W Model 3 Russian", "models/weapons/w_model_3_rus.mdl", "m9k_model3russian", 30000, 10, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("S&W Model 3 Russian Single", "models/weapons/w_model_3_rus.mdl", "m9k_model3russian", 4000, 1, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("S&W 627", "models/weapons/w_sw_model_627.mdl", "m9k_model627", 30000, 10, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("S&W 627 Single", "models/weapons/w_sw_model_627.mdl", "m9k_model627", 4250, 1, false, 0, false, {TEAM_GUN})

ASSAULT GUNS

DarkRP.createShipment("Acr", "models/weapons/w_masada_acr.mdl", "m9k_acr", 40000, 10, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("Acr Single", "models/weapons/w_masada_acr.mdl", "m9k_acr", 5000, 1, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("AMD 65", "models/weapons/w_amd_65.mdl", "m9k_amd65", 50000, 10, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("AMD 65 Single", "models/weapons/w_amd_65.mdl", "m9k_amd65", 6000, 1, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("FN FAL", "models/weapons/w_fn_fal.mdl", "m9k_fal", 40000, 10, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("FN FAL Single", "models/weapons/w_fn_fal.mdl", "m9k_fal", 5500, 1, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("M14", "models/weapons/w_snip_m14sp.mdl", "m9k_m14sp", 50000, 10, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("M14 Single", "models/weapons/w_snip_m14sp.mdl", "m9k_m14sp", 5250, 1, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("M16 Scoped", "models/weapons/w_dmg_m16ag.mdl", "m9k_m16a4_acog", 52500, 10, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("M16 Scoped Single", "models/weapons/w_dmg_m16ag.mdl", "m9k_m16a4_acog", 5750, 1, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("HK 16", "models/weapons/w_hk_416.mdl", "m9k_m416", 50000, 10, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("HK 16 Single", "models/weapons/w_hk_416.mdl", "m9k_m416", 5500, 1, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("Scar", "models/weapons/w_fn_scar_h.mdl", "m9k_scar", 60000, 10, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("Scar Single", "models/weapons/w_fn_scar_h.mdl", "m9k_scar", 7250, 1, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("TAR-21", "models/weapons/w_imi_tar21.mdl", "m9k_tar21", 50000, 10, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("TAR-21 Single", "models/weapons/w_imi_tar21.mdl", "m9k_tar21", 5250, 1, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("Val", "models/weapons/w_dmg_vally.mdl", "m9k_val", 55750, 10, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("Val Single", "models/weapons/w_dmg_vally.mdl", "m9k_val", 5500, 1, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("SR-3M Vikhr", "models/weapons/w_dmg_vikhr.mdl", "m9k_vikhr", 50000, 10, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("SR-3M Vikhr Single", "models/weapons/w_dmg_vikhr.mdl", "m9k_vikhr", 4500, 1, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("Winchester 73", "models/weapons/w_winchester_1873.mdl", "m9k_winchester73", 35000, 10, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("Winchester 73 Single", "models/weapons/w_winchester_1873.mdl", "m9k_winchester73", 4000, 1, false, 123, false, {TEAM_GUN})

SHOTGUNS

DarkRP.createShipment("1887 Winchester", "models/weapons/w_winchester_1887.mdl", "m9k_1887winchester", 40000, 10, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("1887 Winchester Single", "models/weapons/w_winchester_1887.mdl", "m9k_1887winchester", 5000, 1, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("Double Barrel", "models/weapons/w_double_barrel_shotgun.mdl", "m9k_dbarrel", 50000, 10, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("Double Barrel Single", "models/weapons/w_double_barrel_shotgun.mdl", "m9k_dbarrel", 6000, 1, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("Jack Hammer", "models/weapons/w_pancor_jackhammer.mdl", "m9k_jackhammer", 80000, 10, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("Jack Hammer Single", "models/weapons/w_pancor_jackhammer.mdl", "m9k_jackhammer", 9500, 1, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("Benelli M3", "models/weapons/w_benelli_m3.mdl", "m9k_m3", 45000, 10, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("Benelli M3 Single", "models/weapons/w_benelli_m3.mdl", "m9k_m3", 5000, 1, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("Ithaca M37", "models/weapons/w_ithaca_m37.mdl", "m9k_ithacam37", 30000, 10, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("Ithaca M37 Single", "models/weapons/w_ithaca_m37.mdl", "m9k_ithacam37", 4000, 10, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("Mossberg", "models/weapons/w_mossberg_590.mdl", "m9k_mossberg590", 30000, 10, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("Mossberg Single", "models/weapons/w_mossberg_590.mdl", "m9k_mossberg590", 4000, 1, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("Remington 870", "models/weapons/w_remington_870_tact.mdl", "m9k_remington870", 25000, 10, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("Remington 870 Single", "models/weapons/w_remington_870_tact.mdl", "m9k_remington870", 3000, 1, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("1897 Winchester", "models/weapons/w_winchester_1897_trench.mdl", "m9k_1897winchester", 40000, 10, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("1897 Winchester Single", "models/weapons/w_winchester_1897_trench.mdl", "m9k_1897winchester", 4250, 1, false, 123, false, {TEAM_GUN})

SNIPER RIFLES

DarkRP.createShipment("Barret M82", "models/weapons/w_barret_m82.mdl", "m9k_barret_m82", 100000, 10, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("Barret M82 Single", "models/weapons/w_barret_m82.mdl", "m9k_barret_m82", 12500, 1, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("Barret M98B", "models/weapons/w_barrett_m98b.mdl", "m9k_m98b", 110000, 10, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("Barret M98B Single", "models/weapons/w_barrett_m98b.mdl", "m9k_m98b", 12000, 1, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("SVT 40", "models/weapons/w_svt_40.mdl", "m9k_svt40", 50000, 10, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("SVT 40 Single", "models/weapons/w_svt_40.mdl", "m9k_svt40", 6000, 1, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("Dragunov SVU", "models/weapons/w_dragunov_svu.mdl", "m9k_svu", 80000, 10, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("Dragunov SVU Single", "models/weapons/w_dragunov_svu.mdl", "m9k_svu", 9000, 1, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("SVD Dragunov", "models/weapons/w_svd_dragunov.mdl", "m9k_dragunov", 85000, 10, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("SVD Dragunov Single", "models/weapons/w_svd_dragunov.mdl", "m9k_dragunov", 9500, 1, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("Intervention", "models/weapons/w_snp_int.mdl", "m9k_intervention", 125000, 10, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("Intervention Single", "models/weapons/w_snp_int.mdl", "m9k_intervention", 15000, 1, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("PSG-1", "models/weapons/w_hk_psg1.mdl", "m9k_psg1", 70000, 10, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("PSG-1 Single", "models/weapons/w_hk_psg1.mdl", "m9k_psg1", 8000, 1, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("AW 50", "models/weapons/w_acc_int_aw50.mdl", "m9k_aw50", 100000, 10, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("AW 50 Single", "models/weapons/w_acc_int_aw50.mdl", "m9k_aw50", 12000, 1, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("M24", "models/weapons/w_snip_m24_6.mdl", "m9k_m24", 70000, 10, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("M24 Single", "models/weapons/w_snip_m24_6.mdl", "m9k_m24", 7750, 1, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("Remington 7615P", "models/weapons/w_remington_7615p.mdl", "m9k_remington7615p", 80000, 10, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("Remington 7615P Single", "models/weapons/w_remington_7615p.mdl", "m9k_remington7615p", 9000, 1, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("Thompson Condender", "models/weapons/w_g2_contender.mdl", "m9k_contender", 50000, 10, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("Thompson Condender Single", "models/weapons/w_g2_contender.mdl", "m9k_contender", 6000, 1, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("AWP", "models/weapons/w_snip_awp.mdl", "weapon_mad_awp", 50000, 10, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("AWP Single", "models/weapons/w_snip_awp.mdl", "weapon_mad_awp", 8000, 1, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("Scout", "models/weapons/w_snip_scout.mdl", "weapon_mad_scout", 45000, 10, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("Scout Single", "models/weapons/w_snip_scout.mdl", "weapon_mad_scout", 6000, 1, false, 0, false, {TEAM_GUN})

MACHINE GUNS

DarkRP.createShipment("FG42", "models/weapons/w_fg42.mdl", "m9k_fg42", 5000, 10, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("FG42 Single", "models/weapons/w_fg42.mdl", "m9k_fg42", 550, 1, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("M60", "models/weapons/w_m60_machine_gun.mdl", "m9k_m60", 20000, 10, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("M60 Single", "models/weapons/w_m60_machine_gun.mdl", "m9k_m60", 5000, 1, false, 123, false, {TEAM_GUN})
DarkRP.createShipment("Mini Gun", "models/weapons/w_m134_minigun.mdl", "m9k_minigun", 1500000, 10, false, 0, false, {TEAM_GUN})
DarkRP.createShipment("Mini Gun Single", "models/weapons/w_m134_minigun.mdl", "m9k_minigun", 150000, 1, false, 0, false, {TEAM_GUN})