Crossbow ammo not working

I’m working on a custom darkrp sever (woo another rp server -.-) and I’m trying to add 2 more types of ammo. 357, which works fine, and crossbow ammo. When i buy the 357, my magnum gets ammo and i can kill things with loud bangs np. When i buy crossbow ammo, no ammo is added. I’m pretty darn sure the ammo type for crossbows is XBowBolt. I’ve edited this in main.lua:
[lua] if args == “rifle” then
ply:GiveAmmo(80, “smg1”)
elseif args == “shotgun” then
ply:GiveAmmo(50, “buckshot”)
elseif args == “pistol” then
ply:GiveAmmo(50, “pistol”)
elseif args == “357” then
ply:GiveAmmo(50, “357”)
elseif args == “crossbow” then
ply:GiveAmmo(20, “XBowBolt”)

I’ve also added the icons in the showteamtabs.lua which work fine as well. I just cant get the crossbow ammo, when bought, to give me any ammo for the crossbow.

EDIT: now i’m getting confused here. I had my buddy go into hammer (map maker) and check wut the ammo spawner was called for the crossbow and it’s item_ammo_crossbow. so i made a custom weapons shipment (just like a custom weapons shipment of say, an ak47) using this and it gives me crossbow ammo (6 which is prob default). Anyhoo, when i try to buy crossbow ammo via the F4 menu (the lua code above), i get a message on the side saying “This ammo is unavailable” but i don’t get this with any of the other ammo including the 357 which i added.


Have you possibly misspelled “crossbow” where ever your argument is coming from?
I also am confused about the “item_ammo_crossbow” because Im positive that XBowBolt is the correct ammo type…

The code I linked is the only place that deals with the ammo given aside from the icon on which you click (and it shows up so that works just fine). I’ve also added 357 and ar2 ammo the exact same way and they both work just dandy which is why this is confusing me and why I can only think that xbowbolt is the wrong ammo type. The message I get when I purchase the crossbow ammo says “that ammo is unavailable” which leads me to believe it’s the wrong name for the ammo or something.

The whole item_ammo_crossbow is what can be picked up from within the world. for instance, I made a custom shipment in darkrp:
[lua] AddCustomShipment(“Bolts”, “models/Items/CrossbowRounds.mdl”, “item_ammo_crossbow”, 6000, 12, false, 0, false, {TEAM_GUN})
this spawns a box like all the other shipments and when you “use” the box it will spawn whatever model (in this case the “models/items/crossbowrounds.mdl” which is the little stack of bolts you find during the campaign). When you “use” the model it spawned, it will give you whatever the item is (in this case it’s “item/ammo/crossbow”). This gives me 6 crossbow bolts. I’m guessing it’s the world entity of the ammo. I found this list which works with shipments just fine:

  • item_ammo_357
  • item_ammo_357_large
  • item_ammo_ar2
  • item_ammo_ar2_altfire
  • item_ammo_ar2_large
  • item_ammo_crate
  • item_ammo_crossbow
  • item_ammo_pistol
  • item_ammo_pistol_large
  • item_ammo_smg1
  • item_ammo_smg1_grenade
  • item_ammo_smg1_large
  • item_battery
  • item_box_buckshot
  • item_dynamic resupply
  • item_healthcharger
  • item_healthkit
  • item_healthvial
  • item_item_crate
  • item_rpg_round
  • item_suit
  • item_suitcharger

It’s kind of beside the point but the crossbow ammo works none the less but only with the item_ammo_crossbow and not via the darkrp actual ammo type.

EDIT: Also, keep in mind I’m trying to get the crossbow ammo working via the single click and not via shipments.


Didnt see the thread above me XD