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.

Custom check for entities

Discussion in 'DarkRP Modding Questions & Help' started by Aron, Jun 17, 2015.

  1. Aron

    Aron New Member

    this one works but want to add more ranks to the one string how do i do that
    customCheck = function(ply) return ply:IsUserGroup("vip") end

    so rather than vip can only spawn it in id want it to be able to be spawned in all ranks appart from vip

    superadmin
    owner
    co-owner
    s-admin
    admin
    trial-moderator
    moderator
    vip not allowed to spawn in the item but all other ranks can so how do i add to the above custom check
    user

    is it like this

    customCheck = function(ply) return ply:IsUserGroup("superadmin") or ply:IsUserGroup("owner") or ply:IsUserGroup("co-owner") or ply:IsUserGroup("s-admin") or ply:IsUserGroup("admin") or ply:IsUserGroup("trial-moderator") or ply:IsUserGroup("moderator") or ply:IsUserGroup("user") end

    so the above groups in my custom check if correct i want the to be able to have them appart from vip if there is a easier way please say or correct me

    Thank You
     
  2. Matryan

    Matryan Well-Known Member

    Try:
    Code (Text):
    customCheck = function(ply) return table.HasValue({"rank1", "rank2", "rank3",}, ply:Team()) end
     
  3. Aron

    Aron New Member

    ha ha lol are you the only 1 on here thanks
     
  4. Matryan

    Matryan Well-Known Member

    No. I've just been available recently.
    Other people would've answered eventually.
     
  5. Aron

    Aron New Member

    MATRYAN

    THIS is what im trying to do but says im not allowed to spawn it the vip works but standard does not


    DarkRP.createEntity("Health Charger", {
    ent = "health_recharger",
    model = "models/props_c17/consolebox03a.mdl",
    price = 2500,
    max = 1,
    cmd = "health_recharger",
    customCheck = function(ply) return table.HasValue({"superadmin", "owner", "co-owner", "s-admin", "admin", "trial-moderator", "moderator","user"}, ply:Team()) end
    })

    ^^^^ no errors for the custom check but does say you are not allowed to buy this item i just dont want vips to spwan in standard ents^^^^

    DarkRP.createEntity("VIP Health Charger", {
    ent = "vip_health_recharger",
    model = "models/props_lab/reciever01a.mdl",
    price = 3000,
    max = 1,
    cmd = "vip_health_recharger",
    customCheck = function(ply) return ply:IsUserGroup("vip") end
    })



    also same here



    DarkRP.createEntity("Platinum Printer", {
    ent = "6th_printer",
    model = "models/props_c17/consolebox01a.mdl",
    price = 60000,
    max = 1,
    cmd = "buyplatinummoneyprinter"
    })
    ^^ how do i make it so all ranks can spawn it appart from vip ^^ this u sent does not seem to work customCheck = function(ply) return table.HasValue({"rank1", "rank2", "rank3",}, ply:Team()) end



    DarkRP.createEntity("Sapphire Printer [VIP]", {
    VIPOnly = true, this vip only line does not work that is why i asked for a custom check from u
    ent = "1st_vipprinter",
    model = "models/props_c17/consolebox01a.mdl",
    price = 35000,
    max = 2,
    cmd = "buysapphiremoneyprinter",
    customCheck = function(ply) return ply:IsUserGroup("vip") end
    }) ^^ works fine only vip can use em
     
  6. Tomelyr

    Tomelyr Active Member

    customCheck = function(ply) return !ply:IsUserGroup("vip") end
     
  7. Matryan

    Matryan Well-Known Member

    Sorry, replace ply:Team with ply:GetUserGroup()
     
  8. Aron

    Aron New Member

    so the text in blue is now correct so i change ply:Team()) end to ply:GetUserGroup() and now should work if im correct


    DarkRP.createEntity("Amour Charger", {
    ent = "armor_recharger",
    model = "models/props_c17/consolebox03a.mdl",
    price = 2500,
    max = 1,
    cmd = "armor_recharger",
    customCheck = function(ply) return table.HasValue({"superadmin", "owner", "co-owner", "s-admin", "admin", "trial-moderator", "moderator"}, ply:GetUserGroup() end
    })

    DarkRP.createEntity("Health Charger", {
    ent = "health_recharger",
    model = "models/props_c17/consolebox03a.mdl",
    price = 2500,
    max = 1,
    cmd = "health_recharger",
    customCheck = function(ply) return table.HasValue({"superadmin", "owner", "co-owner", "s-admin", "admin", "trial-moderator", "moderator"}, ply:GetUserGroup() end
    })

    DarkRP.createEntity("Money Printer Battery", {
    ent = "printer_battery",
    model = "models/props_lab/reciever01a.mdl",
    price = 2500,
    max = 20,
    cmd = "buymoneyprinterbattery"
    customCheck = function(ply) return table.HasValue({"superadmin", "owner", "co-owner", "s-admin", "admin", "trial-moderator", "moderator", "vip", "user"}, ply:GetUserGroup() end
    })

    DarkRP.createEntity("Normal Printer", {
    ent = "1st_printer",
    model = "models/props_c17/consolebox01a.mdl",
    price = 10000,
    max = 2,
    cmd = "buynormalmoneyprinter"
    customCheck = function(ply) return table.HasValue({"superadmin", "owner", "co-owner", "s-admin", "admin", "trial-moderator", "moderator"}, ply:GetUserGroup() end
    })

    DarkRP.createEntity("Bronze Printer", {
    ent = "2nd_printer",
    model = "models/props_c17/consolebox01a.mdl",
    price = 15000,
    max = 2,
    cmd = "buybronzemoneyprinter"
    customCheck = function(ply) return table.HasValue({"superadmin", "owner", "co-owner", "s-admin", "admin", "trial-moderator", "moderator"}, ply:GetUserGroup() end
    })

    DarkRP.createEntity("Iron Printer", {
    ent = "3rd_printer",
    model = "models/props_c17/consolebox01a.mdl",
    price = 25000,
    max = 2,
    cmd = "buyironmoneyprinter"
    customCheck = function(ply) return table.HasValue({"superadmin", "owner", "co-owner", "s-admin", "admin", "trial-moderator", "moderator"}, ply:GetUserGroup() end
    })

    DarkRP.createEntity("Silver Printer", {
    ent = "4th_printer",
    model = "models/props_c17/consolebox01a.mdl",
    price = 35000,
    max = 2,
    cmd = "buysilvermoneyprinter"
    customCheck = function(ply) return table.HasValue({"superadmin", "owner", "co-owner", "s-admin", "admin", "trial-moderator", "moderator"}, ply:GetUserGroup() end
    })

    DarkRP.createEntity("Gold Printer", {
    ent = "5th_printer",
    model = "models/props_c17/consolebox01a.mdl",
    price = 45000,
    max = 1,
    cmd = "buygoldmoneyprinter"
    customCheck = function(ply) return table.HasValue({"superadmin", "owner", "co-owner", "s-admin", "admin", "trial-moderator", "moderator"}, ply:GetUserGroup() end
    })

    DarkRP.createEntity("Platinum Printer", {
    ent = "6th_printer",
    model = "models/props_c17/consolebox01a.mdl",
    price = 60000,
    max = 1,
    cmd = "buyplatinummoneyprinter"
    customCheck = function(ply) return table.HasValue({"superadmin", "owner", "co-owner", "s-admin", "admin", "trial-moderator", "moderator"}, ply:GetUserGroup() end
    })



    ones below this line the custom check works fine its just vip can spawn ones above this line I don't want that



    DarkRP.createEntity("Sapphire Printer [VIP]", {
    VIPOnly = true,
    ent = "1st_vipprinter",
    model = "models/props_c17/consolebox01a.mdl",
    price = 35000,
    max = 2,
    cmd = "buysapphiremoneyprinter",
    customCheck = function(ply) return ply:IsUserGroup("vip") end these work fine
    })

    DarkRP.createEntity("Emerald Printer [VIP]", {
    VIPOnly = true,
    ent = "2nd_vipprinter",
    model = "models/props_c17/consolebox01a.mdl",
    price = 45000,
    max = 2,
    cmd = "buyemeraldmoneyprinter",
    customCheck = function(ply) return ply:IsUserGroup("vip") end these work fine
    })

    DarkRP.createEntity("Ruby Printer [VIP]", {
    VIPOnly = true,
    ent = "3rd_vipprinter",
    model = "models/props_c17/consolebox01a.mdl",
    price = 55000,
    max = 2,
    cmd = "buyrubymoneyprinter",
    customCheck = function(ply) return ply:IsUserGroup("vip") end these work fine
    })

    DarkRP.createEntity("Diamond Printer [VIP]", {
    VIPOnly = true,
    ent = "4th_vipprinter",
    model = "models/props_c17/consolebox01a.mdl",
    price = 65000,
    max = 1,
    cmd = "buydiamondmoneyprinter",
    customCheck = function(ply) return ply:IsUserGroup("vip") end these work fine
    })

    DarkRP.createEntity("Super Printer [VIP]", {
    VIPOnly = true,
    ent = "5th_vipprinter",
    model = "models/props_c17/consolebox01a.mdl",
    price = 75000,
    max = 1,
    cmd = "buysupermoneyprinter",
    customCheck = function(ply) return ply:IsUserGroup("vip") end these work fine
    })

    DarkRP.createEntity("Uber Printer [VIP]", {
    VIPOnly = true,
    ent = "6th_vipprinter",
    model = "models/props_c17/consolebox01a.mdl",
    price = 85000,
    max = 1,
    cmd = "buyubermoneyprinter",
    customCheck = function(ply) return ply:IsUserGroup("vip") end these work fine
    })

    DarkRP.createEntity("THE MILLION MAKER! [VIP]", {
    VIPOnly = false,
    ent = "7th_vipprinter",
    model = "models/props_c17/consolebox01a.mdl",
    price = 200000,
    max = 1,
    cmd = "buytmmmoneyprinter",
    customCheck = function(ply) return ply:IsUserGroup("vip") end these work fine
    })

    DarkRP.createEntity("VIP Amour Charger", {
    ent = "vip_armor_recharger",
    model = "models/props_c17/consolebox03a.mdl",
    price = 3000,
    max = 1,
    cmd = "vip_armor_recharger",
    customCheck = function(ply) return ply:IsUserGroup("vip") end
    })

    DarkRP.createEntity("VIP Health Charger", {
    ent = "vip_health_recharger",
    model = "models/props_lab/reciever01a.mdl",
    price = 3000,
    max = 1,
    cmd = "vip_health_recharger",
    customCheck = function(ply) return ply:IsUserGroup("vip") end
     
  9. Matryan

    Matryan Well-Known Member

    Take VIP out of the list for the top ones if you don't want them to be able to spawn them.
     
  10. Aron

    Aron New Member

    this is what i got when i did the normal printers as in not vip and armour chargers


    [ERROR] addons/darkrpmodification-master/lua/darkrp_customthings/entities.lua:42: ')' expected near 'end'
    1. unknown - addons/darkrpmodification-master/lua/darkrp_customthings/entities.lua:0
     
  11. Aron

    Aron New Member

    so the text in blue is now correct so i change ply:Team()) end to ply:GetUserGroup() and now should work if im correct


    DarkRP.createEntity("Amour Charger", {
    ent = "armor_recharger",
    model = "models/props_c17/consolebox03a.mdl",
    price = 2500,
    max = 1,
    cmd = "armor_recharger",
    customCheck = function(ply) return table.HasValue({"superadmin", "owner", "co-owner", "s-admin", "admin", "trial-moderator", "moderator"},ply:GetUserGroup() end
    })

    DarkRP.createEntity("Health Charger", {
    ent = "health_recharger",
    model = "models/props_c17/consolebox03a.mdl",
    price = 2500,
    max = 1,
    cmd = "health_recharger",
    customCheck = function(ply) return table.HasValue({"superadmin", "owner", "co-owner", "s-admin", "admin", "trial-moderator", "moderator"},ply:GetUserGroup() end
    })

    DarkRP.createEntity("Money Printer Battery", {
    ent = "printer_battery",
    model = "models/props_lab/reciever01a.mdl",
    price = 2500,
    max = 20,
    cmd = "buymoneyprinterbattery"
    customCheck = function(ply) return table.HasValue({"superadmin", "owner", "co-owner", "s-admin", "admin", "trial-moderator", "moderator", "vip", "user"},ply:GetUserGroup() end
    }) EVERY GROUP CAN SPAWN THIS SO CAN I JUST REMOVE CUSTOM CHECK

    DarkRP.createEntity("Normal Printer", {
    ent = "1st_printer",
    model = "models/props_c17/consolebox01a.mdl",
    price = 10000,
    max = 2,
    cmd = "buynormalmoneyprinter"
    customCheck = function(ply) return table.HasValue({"superadmin", "owner", "co-owner", "s-admin", "admin", "trial-moderator", "moderator"},ply:GetUserGroup() end
    })WHAT I WANT IS ANY OTHER ENTITY APPART FROM MONEY PRINTER BATTERY BLACKLISTING FROM VIP SO THEY CANT SPAWN EM

    DarkRP.createEntity("Bronze Printer", {
    ent = "2nd_printer",
    model = "models/props_c17/consolebox01a.mdl",
    price = 15000,
    max = 2,
    cmd = "buybronzemoneyprinter"
    customCheck = function(ply) return table.HasValue({"superadmin", "owner", "co-owner", "s-admin", "admin", "trial-moderator", "moderator"},ply:GetUserGroup() end
    })

    DarkRP.createEntity("Iron Printer", {
    ent = "3rd_printer",
    model = "models/props_c17/consolebox01a.mdl",
    price = 25000,
    max = 2,
    cmd = "buyironmoneyprinter"
    customCheck = function(ply) return table.HasValue({"superadmin", "owner", "co-owner", "s-admin", "admin", "trial-moderator", "moderator"},ply:GetUserGroup() end
    })

    DarkRP.createEntity("Silver Printer", {
    ent = "4th_printer",
    model = "models/props_c17/consolebox01a.mdl",
    price = 35000,
    max = 2,
    cmd = "buysilvermoneyprinter"
    customCheck = function(ply) return table.HasValue({"superadmin", "owner", "co-owner", "s-admin", "admin", "trial-moderator", "moderator"},ply:GetUserGroup() end
    })

    DarkRP.createEntity("Gold Printer", {
    ent = "5th_printer",
    model = "models/props_c17/consolebox01a.mdl",
    price = 45000,
    max = 1,
    cmd = "buygoldmoneyprinter"
    customCheck = function(ply) return table.HasValue({"superadmin", "owner", "co-owner", "s-admin", "admin", "trial-moderator", "moderator"},ply:GetUserGroup() end
    })

    DarkRP.createEntity("Platinum Printer", {
    ent = "6th_printer",
    model = "models/props_c17/consolebox01a.mdl",
    price = 60000,
    max = 1,
    cmd = "buyplatinummoneyprinter"
    customCheck = function(ply) return table.HasValue({"superadmin", "owner", "co-owner", "s-admin", "admin", "trial-moderator", "moderator"},ply:GetUserGroup() end
    })
     
    Last edited: Jun 21, 2015
  12. Aron

    Aron New Member

    so what do i put in this custom check ranks that can or cant spawn
     
  13. Matryan

    Matryan Well-Known Member

    You've accidentally gotten rid of an ending bracket. Add a close bracket after ply:GetUserGroup(), like so:
    ply:GetUserGroup())
     
  14. Aron

    Aron New Member

    cheers will try that hang on thanks
     
  15. Aron

    Aron New Member

    this is what im about to try

    customCheck = function(ply) return table.HasValue({"superadmin", "owner", "co-owner", "s-admin", "admin", "trial-moderator", "moderator", "user"},ply:GetUserGroup()) end
     
  16. Aron

    Aron New Member

    now this after adding it


    [ERROR] Lua is unable to understand file "darkrp_modules/customizablemoneyprinters/sh_init.lua" because its author made a mistake around line number 35.
    The best help I can give you is this:

    There is an opening '{' bracket at line 29, but this bracket is never closed or not closed in time. It was expected to be closed before the 'customCheck' at line 35.

    Hints:
    - Did you forget a comma?
    - All open brackets ({, (, [) must have a matching closing bracket. Are you sure it's there?
    - Brackets must be opened and closed in the right order. This will work: ({}), but this won't: ({)}.

    ------- End of Simplerr error -------

    1. error - [C]:-1
    2. unknown - gamemodes/darkrp/gamemode/libraries/simplerr.lua:467
    3. doInclude - gamemodes/darkrp/gamemode/libraries/fn.lua:80
    4. loadModules - gamemodes/darkrp/gamemode/libraries/modificationloader.lua:84
    5. Call - gamemodes/darkrp/gamemode/libraries/modificationloader.lua:141
    6. unknown - gamemodes/darkrp/gamemode/init.lua:81

    Couldn't Load Init Script: 'darkrp/gamemode/init.lua'

    this is after i added the bracket
     
    Last edited: Jun 21, 2015
  17. Tomelyr

    Tomelyr Active Member

     
  18. Aron

    Aron New Member

    custom check so only vip cannot spawn it but all other ranks can that looks exactly like only vip can spawn what u sent above
    superadmin (can spawn)
    owner (can spawn)
    co-owner (can spawn)
    s-admin (can spawn)
    admin (can spawn)
    trial-moderator (can spawn)
    moderator (can spawn)
    vip (cannot spawn)
    user (can spawn)


    DarkRP.createEntity("Amour Charger", {
    ent = "armor_recharger",
    model = "models/props_c17/consolebox03a.mdl",
    price = 2500,
    max = 1,
    cmd = "armor_recharger",
    })

    DarkRP.createEntity("Health Charger", {
    ent = "health_recharger",
    model = "models/props_c17/consolebox03a.mdl",
    price = 2500,
    max = 1,
    cmd = "health_recharger",
    })

    DarkRP.createEntity("Normal Printer", {
    ent = "1st_printer",
    model = "models/props_c17/consolebox01a.mdl",
    price = 10000,
    max = 2,
    cmd = "buynormalmoneyprinter"
    })

    DarkRP.createEntity("Bronze Printer", {
    ent = "2nd_printer",
    model = "models/props_c17/consolebox01a.mdl",
    price = 15000,
    max = 2,
    cmd = "buybronzemoneyprinter"
    })

    DarkRP.createEntity("Iron Printer", {
    ent = "3rd_printer",
    model = "models/props_c17/consolebox01a.mdl",
    price = 25000,
    max = 2,
    cmd = "buyironmoneyprinter"
    })

    DarkRP.createEntity("Silver Printer", {
    ent = "4th_printer",
    model = "models/props_c17/consolebox01a.mdl",
    price = 35000,
    max = 2,
    cmd = "buysilvermoneyprinter"
    })

    DarkRP.createEntity("Gold Printer", {
    ent = "5th_printer",
    model = "models/props_c17/consolebox01a.mdl",
    price = 45000,
    max = 1,
    cmd = "buygoldmoneyprinter"
    })

    DarkRP.createEntity("Platinum Printer", {
    ent = "6th_printer",
    model = "models/props_c17/consolebox01a.mdl",
    price = 60000,
    max = 1,
    cmd = "buyplatinummoneyprinter"
    })
     
  19. Matryan

    Matryan Well-Known Member

     
    Tomelyr likes this.
  20. Aron

    Aron New Member

Share This Page