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 Questions

Discussion in 'DarkRP Modding Questions & Help' started by TipsiTurtle, Aug 5, 2018.

  1. TipsiTurtle

    TipsiTurtle New Member

    Hey,

    So I've been fiddling around with custom checks for certain jobs, particularly the donator ones. I'd rather not have to create a Donator Admin etc for donators that are staff. How would you code it so that a job checks for both the persons rank and Steam ID?

    Would something like this work?

    Code (Text):
    customCheck = function(ply) return CLIENT or
            table.HasValue({"donator"}, ply:GetNWString("usergroup")),
                OR,
            function(ply) return ply:SteamID() == "STEAM ID"
        end,
     
  2. Bo98

    Bo98 Moderator Staff Member Contributor

    Code (Lua):
    customCheck = function(ply) return CLIENT or table.HasValue({"donator"}, ply:GetNWString("usergroup")) or ply:SteamID() == "STEAM ID" end,
     
    # VALERY likes this.
  3. TipsiTurtle

    TipsiTurtle New Member

    You're an absolute legend, thank you.
    --- Double Post Merged, Aug 7, 2018 ---
    Cheers for the comment but I've found an issue. Multiple steam ID's don't work. Maybe I'm an idiot or there's an issue. most likely the former

    Works VVV

    Code (Text):
    customCheck = function(ply) return CLIENT or table.HasValue({"vip", "premium", "mystic", "headadministrator", "superadmin"}, ply:GetNWString("usergroup")) or ply:SteamID() == "STEAM_0:1:51624498" end,

    Doesn't VVV

    Code (Text):
    customCheck = function(ply) return CLIENT or table.HasValue({"vip", "premium", "mystic", "headadministrator", "superadmin"}, ply:GetNWString("usergroup")) or ply:SteamID() == "STEAM_0:1:51624498", "STEAM_0:1:51624498", "STEAM_0:1:51624498" end,
    I really hope I'm not an idiot right now.
     
    Last edited: Aug 7, 2018
  4. # VALERY

    # VALERY Member

    First check is a table, in that {} case it will check for multiply values - table.HasValue({"usergroup1", "usergroup2"}, ply.GetNWString("usergroup"))
    But second func doesn't point on multilply values so I guess it will be somethings like

    Code (Lua):

    customCheck = function(ply) return table.HasValue({"vip", "premium", "mystic", "headadministrator", "superadmin"}, ply:GetNWString("usergroup")) or table.HasValue({"steamid1", "steamid2"}, ply:GetNWString("SteamID"))
     
     
    Last edited: Aug 7, 2018
  5. TipsiTurtle

    TipsiTurtle New Member

    Hello again, VALERY.

    I tried your code but still the same problem, multiple steam ID's doesn't work.

    Any other code?
     
  6. Bo98

    Bo98 Moderator Staff Member Contributor

    Code (Lua):
    customCheck = function(ply) return CLIENT or table.HasValue({"vip", "premium", "mystic", "headadministrator", "superadmin"}, ply:GetNWString("usergroup")) or table.HasValue({"STEAM_0:1:51624498", "STEAM_0:1:51624498", "STEAM_0:1:51624498"}, ply:SteamID()) end,
     
  7. TipsiTurtle

    TipsiTurtle New Member

    Here's the job itself, just in case I'm screwing anything up.

    Code (Text):
    TEAM_DOG = DarkRP.createJob("Dog", {
        color = Color(179, 97, 162, 255),
        model = {
            "models/doge_player/doge_player.mdl"
        },
        description = [[You are a simple dog. You can go a stray or find an owner.]],
        weapons = {},
        command = "dog",
        max = 3,
        salary = 0,
        admin = 0,
        vote = false,
        hasLicense = false,
        candemote = false,
        category = "Other",
        PlayerSpawn = function(ply)
            ply:SetWalkSpeed(200)
            ply:SetRunSpeed(325)
            ply:SetHealth(75)
        end,
        customCheck = function(ply) return CLIENT or table.HasValue({"vip", "premium", "mystic", "headadministrator", "superadmin"}, ply:GetNWString("usergroup")) or table.HasValue({"STEAM_0:1:51624498", "STEAM_0:0:83455157"}, ply:GetNWString("SteamID"))
        end,
        CustomCheckFailMsg = "This job is donator only!",
    })
    --- Double Post Merged, Aug 7, 2018 ---
    Oh!

    I just tried what you sent then, Bo98 and it worked flawlessly.

    Cheers for helping a noob out, guys!
     

Share This Page