1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Sign up for news, events and more!

    You're currently visiting the official DarkRP Forums as a guest. Sign up now to participate in our community and we'll let you know when we have news.

DarkRP Ammo doesn't want to show up

Discussion in 'DarkRP Modding Questions & Help' started by ♥ Dagun | kickback.com ♥, Jul 8, 2019.

  1. I tried everything, from coding it myself to copying the code and inserting it into the .lua file. This is the last code I tried (which I have in the .lua file right now).

    <code>
    DarkRP.createAmmoType("pistol", {
    name = "Pistol Ammo",
    model = "models/weapons/w_pist_fiveseven.mdl",
    price = 25,
    amountGiven = 12,
    })
    DarkRP.createAmmoType("buckshot", {
    name = "Shotgun Ammo",
    model = "models/weapons/w_pist_fiveseven.mdl",
    price = 50,
    amountGiven = 4,
    })
    DarkRP.createAmmoType("smg1", {
    name = "Rifle Ammo",
    model = "models/weapons/w_pist_fiveseven.mdl",
    price = 75,
    amountGiven = 24,
    })
    DarkRP.createAmmoType("ar2", {
    name = "Pulse Ammo",
    model = "models/weapons/w_pist_fiveseven.mdl",
    price = 125,
    amountGiven = 32,
    })
    DarkRP.createAmmoType("AirboatGun", {
    name = "Winchester Ammo",
    model = "models/weapons/w_pist_fiveseven.mdl",
    price = 100,
    amountGiven = 8,
    })
    DarkRP.createAmmoType("SniperPenetratedRound", {
    name = "50cal. Sniper Ammo",
    model = "models/weapons/w_pist_fiveseven.mdl",
    price = 150,
    amountGiven = 14,
    })
    DarkRP.createAmmoType("357", {
    name = "357 Ammo",
    model = "models/weapons/w_pist_fiveseven.mdl",
    price = 150,
    amountGiven = 6,
    })
    </code>​

    I'm using M9K Weapons and I found out that the weapons are not showing up after restart, but if I reupload the file on filezilla without restarting the server, the ammo shows up and works perfectly fine. After the restart the ammo is gone though and I have to reupload it again so that it shows up.
     
  2. FireWolf

    FireWolf Member

    m9k weapons use different ammo names. You'll need to right click on their ammo to find out their names.
    i.e.
    DarkRP.createAmmoType("pistol", {
    name = "M9K Pistol",
    model = "models/Items/BoxSRounds.mdl",
    price = 10,
    amountGiven = 20
    })
     
  3. Tried this before, nothing. But if I reupload the same code withotu restarting it suddenly shows up.
    --- Double Post Merged, Jul 8, 2019 ---
    DarkRP.createAmmoType("m9k_ammo_357", {
    name = "M9K 357 ammo",
    model = "models/Items/357ammobox.mdl",
    price = 100,
    amountGiven = 20
    })

    DarkRP.createAmmoType("m9k_ammo_ar2", {
    name = "Assult Rifle Ammo",
    model = "models/Items/357ammobox.mdl",
    price = 150,
    amountGiven = 20
    })

    DarkRP.createAmmoType("m9k_ammo_buckshot", {
    name = "Shotgun Ammo",
    model = "models/Items/357ammobox.mdl",
    price = 80,
    amountGiven = 20
    })

    DarkRP.createAmmoType("m9k_ammo_pistol", {
    name = "Pistol Ammo",
    model = "models/Items/357ammobox.mdl",
    price = 100,
    amountGiven = 20
    })

    DarkRP.createAmmoType("m9k_ammo_smg", {
    name = "SMG Ammo",
    model = "models/Items/357ammobox.mdl",
    price = 150,
    amountGiven = 20
    })

    DarkRP.createAmmoType("m9k_ammo_sniper_rounds", {
    name = "Sniper Ammo",
    model = "models/Items/357ammobox.mdl",
    price = 200,
    amountGiven = 20
    })

    this here for example doesnt work aswell
     
    Last edited: Jul 8, 2019
  4. FireWolf

    FireWolf Member

    You've clearly not done anything I said, apart from adding "M9K" to "357 ammo", which won't work because that's not the actual ammo name. It's true name is "M9K 357". The way I knew this is because I went to the q menu, right clicked the 357 ammo, and copied it's true name (more correct term would be entity id, iirc) and put it after "name =".

    What I think is happening is you are trying to get ammo which don't exist, thus causing a lua error which means none of your ammo will show. Fix this simple issue and everything will be fine.

    Side Note: You need to make sure you're copying the M9K ammo names.
     
  5. Tried those from what I understood from your answer:

    DarkRP.createAmmoType("m9k_ammo_357", {
    name = "M9K 357",
    model = "models/Items/357ammobox.mdl",
    price = 100,
    amountGiven = 20
    })

    DarkRP.createAmmoType("m9k_ammo_357", {
    name = "m9k_ammo_357",
    model = "models/Items/357ammobox.mdl",
    price = 150,
    amountGiven = 20
    })

    DarkRP.createAmmoType("357", {
    name = "M9K 357",
    model = "models/Items/357ammobox.mdl",
    price = 100,
    amountGiven = 20
    })

    DarkRP.createAmmoType("357", {
    name = "m9k_ammo_357",
    model = "models/Items/357ammobox.mdl",
    price = 150,
    amountGiven = 20
    })

    But still nothing shows up. But as I said, I just have to add a space, remove it and upload it again without restarting and they suddenly pop up in the ammo tab and I can spawn them and they work, so the server definetly can find it, otherwise I wouldn't be able to spawn them. The problem I am facing is that when I restart the server, it's gone again. I have to manually add a space somewhere, remove it and then upload it again and it works perfectly like it should.
     
  6. FireWolf

    FireWolf Member

    DarkRP.createAmmoType("357", {
    name = "M9K 357",
    model = "models/Items/357ammobox.mdl",
    price = 30,
    amountGiven = 20,
    })

    Oh dear. Does it work with THIS ONLY in the ammo.lua file?
     
  7. Sadly no :(, if I however add a space and remove it and then upload it again on filezilla its there and it works perfectly.
     
  8. FireWolf

    FireWolf Member

    Is there any error in the server console? If so, please give the first one.
     
  9. Sadly there is none
    --- Double Post Merged, Jul 8, 2019 ---
    There is this one after I reupload the ammo file to the server without restarting.


    Unhandled Lua Refresh: [NAME:darkrp_customthings/ammo.lua] [TYPE:!UNKNOWN]

    It works after this one though
     
  10. FireWolf

    FireWolf Member

    Ah. Ngl, being retarded on this cause it's been ages since I did it. Confused name with type.

    My code looks like this:

    DarkRP.createAmmoType("357", {
    name = "M9K 357",
    model = "models/Items/357ammobox.mdl",
    price = 30,
    amountGiven = 20,
    color = Color( 12, 219, 121, 255 )
    })
    DarkRP.createAmmoType("ar2", {
    name = "M9K Rifle",
    model = "models/Items/BoxMRounds.mdl",
    price = 30,
    amountGiven = 30,
    color = Color( 240, 209, 192, 255 )
    })
    DarkRP.createAmmoType("buckshot", {
    name = "M9K Shotgun",
    model = "models/Items/BoxBuckshot.mdl",
    price = 20,
    amountGiven = 8,
    color = Color( 254, 209, 233, 255 )
    })
    DarkRP.createAmmoType("pistol", {
    name = "M9K Pistol",
    model = "models/Items/BoxSRounds.mdl",
    price = 10,
    amountGiven = 20,
    color = Color( 60, 147, 230, 255 )
    })
    DarkRP.createAmmoType("smg1", {
    name = "M9K SMG",
    model = "models/Items/BoxMRounds.mdl",
    price = 20,
    amountGiven = 30,
    color = Color( 197, 72, 181, 255 )
    })
    DarkRP.createAmmoType("SniperPenetratedRound", {
    name = "M9K Sniper",
    model = "models/Items/BoxMRounds.mdl",
    price = 40,
    amountGiven = 10,
    color = Color( 22, 61, 98, 255 )
    })

    And so I confused name with the entity id, because I'm special. I have no idea what your problem is btw. You could try copy-paste my thing to see if it works, but I still believe there should be a serverside lua error showing on the web console.
     
  11. Ive checked it a few dozen of times now, I really cant find any error. What I am concerned about is why its not working and why its working after I reupload it once more without any changes.

    HHMMMMMMMMMMM.... I know thats never the best solution but would it be possible to like somehow automaticly reupload that damn ding or maybe trigger a hook or whatever?
    --- Double Post Merged, Jul 8, 2019 ---
    ps I tried your code and nothing BUT after refreshing it it worked
    --- Double Post Merged, Jul 8, 2019 ---
    Unhandled Lua Refresh: [NAME:darkrp_customthings/ammo.lua] [TYPE:!UNKNOWN]

    This is the only thing popping up (Keep in mind its after I refresh/reupload it)
     

Share This Page