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.

Limiting the Number of Times You Can Buy an Entity per Life

Discussion in 'DarkRP Modding Questions & Help' started by SaberOne, Oct 2, 2019.

  1. SaberOne

    SaberOne New Member

    Im a rookie just starting to learn my way around dark RP coding. I apologize if this question may have been asked already but I tried my best looking through the archives with no luck. So, to get to the point:

    I'm looking to add an entity to the F4 menu. What I would like is to limit the number of times a player can buy the entity per life. The entity is a HL2 Suit battery and I was hoping to limit it to 5 max every time they spawn. I used a generator to get the entity this far (pastebin link). (incase Im not allowed to post links I'll copy and paste below) Any help would be greatly appreciated.

    below is the coding for those who dont trust links
    DarkRP.createEntity("Battery", {
    ent = "item_battery",
    model = "models/Items/battery.mdl",
    price = 1,
    max = 5,
    cmd = "buybatt",
    category = "Ammo",
    customCheck = function(ply) return
    CustomCheckFailMsg = "",

    below is the generator I used initially
    Generated using: DarkRP | Entity Generator

    Last edited: Oct 2, 2019

Share This Page