function Isowner(ply) return ply:IsUserGroup("owner") end
The function from admincc.lua :
local function ccSetMoney(ply, cmd, args)
if not tonumber(args[2]) then ply:PrintMessage(HUD_PRINTCONSOLE, "Invalid arguments") return end
if !Isowner(ply) then
ply:PrintMessage(2, DarkRP.getPhrase("need_sadmin", "rp_setmoney"))
return
end
local amount = math.floor(tonumber(args[2]))
if args[3] then
amount = args[3] == "-" and math.Max(0, ply:getDarkRPVar("money") - amount) or ply:getDarkRPVar("money") + amount
end
local target = GAMEMODE:FindPlayer(args[1])
if target then
local nick = ""
DB.StoreMoney(target, amount)
target:SetDarkRPVar("money", amount)
if ply:EntIndex() == 0 then
print("Set " .. target:Nick() .. "'s money to: " .. GAMEMODE.Config.currency .. amount)
nick = "Console"
else
ply:PrintMessage(2, "Set " .. target:Nick() .. "'s money to: " .. GAMEMODE.Config.currency .. amount)
nick = ply:Nick()
end
target:PrintMessage(2, nick .. " set your money to: " .. GAMEMODE.Config.currency .. amount)
if ply:EntIndex() == 0 then
DB.Log("Console set "..target:SteamName().."'s money to "..GAMEMODE.Config.currency..amount, nil, Color(30, 30, 30))
else
DB.Log(ply:Nick().." ("..ply:SteamID()..") set "..target:SteamName().."'s money to "..GAMEMODE.Config.currency..amount, nil, Color(30, 30, 30))
end
else
if ply:EntIndex() == 0 then
print("Could not find player: " .. args[1])
else
ply:PrintMessage(2, "Could not find player: " .. args[1])
end
return
end
end
I realy dont understand what the problem here.
When I do the command from Rcon its doesnt working
sometimes I dont have access to VIP jobs in my darkrp server…
So this may happen when ply is not a player. Try to put print(ply:GetClass()) efore this function to figure out what class is it, then if it “player” try call here FindMetaTable(“Player”) table, and see what is in here.
If you want the command to work for RCON, then you must disregard sending ply:Notify/notifications. Use print/MsgC/Msg/MsgN if RCON, or notify the player if not rcon.
In sometimes I dont have access to Isadmin or Isowner or ISuperAdmin
Of to custom jobs in darkrp
I got this job its only for vip or admins :
TEAM_Rapist = AddExtraTeam("Rapist", {
color = Color(0, 0, 0, 0),
model = {"models/player/Group01/Male_09.mdl"},
description = [[If you want rape peoples!]],
weapons = {"weapon_mad_fists","weapon_rape", "swep_pickpocketvip"},
command = "rapist",
max = 2,
salary = 20,
admin = 0,
vote = false,
hasLicense = false,
customCheck = function(ply) return CLIENT or ply:IsUserGroup("supporter") or ply:IsUserGroup("supervisor") or ply:IsUserGroup("owner") or ply:IsUserGroup("moderator") or ply:IsUserGroup("superadmin") or ply:IsUserGroup("admin") or ply:IsUserGroup("trusted_admin") or ply:IsUserGroup("helper") end,
CustomCheckFailMsg = "You need to be an Supporter/VIP to become a Rapist"
})
Sometimes the access broken to supporter group and I need to restart the server.
When supporter try to be this job it say : “You need to be an Supporter/VIP to become a Rapist”
And after I need to restart the server and after its work fine.
I want to find the problem of this bug…
I realy dont understand why its happen.
Example : When I got this bug when I am on owner job I dont have access to rp_setmoney (configured on the files to be only able to owner group)
and after I restart the map I got the access to the command.
function IsVIP(ply) return ply:IsUserGroup("owner") or ply:IsUserGroup("superadmin") or ply:IsUserGroup("trusted_admin") or ply:IsUserGroup("admin") or ply:IsUserGroup("moderator") or ply:IsUserGroup("supporter") end
function IsHelper(ply) return ply:IsUserGroup("helper") end
function IsModerator(ply) return ply:IsUserGroup("owner") or ply:IsUserGroup("superadmin") or ply:IsUserGroup("moderator") or ply:IsUserGroup("admin") or ply:IsUserGroup("trusted_admin") end
function IsAdmin(ply) return ply:IsUserGroup("owner") or ply:IsUserGroup("superadmin") or ply:IsUserGroup("admin") or ply:IsUserGroup("trusted_admin") end
function IsSuperAdmin(ply) return ply:IsUserGroup("owner") or ply:IsUserGroup("superadmin") end
function Isowner(ply) return ply:IsUserGroup("owner") end
This is honestly how I would have done it with a table of all ranks etc, and then use meta functions instead of what you’re currently doing.
local Groups = {};
Groups["owner"] = {
Vip = true,
Mod = true,
Admin = true,
SA = true,
Owner = true
};
Groups["superadmin"] = {
Vip = true,
Mod = true,
Admin = true,
SA = true
};
Groups["trusted_admin"] = {
Vip = true,
Mod = true,
Admin = true
};
Groups["admin"] = {
Vip = true,
Mod = true,
Admin = true
};
Groups["moderator"] = {
Vip = true,
Mod = true
};
Groups["supporer"] = {
Vip = true
};
Groups["helper"] = {
Helper = true
};
local meta = FindMetaTable("Player");
function meta:IsVIP()
local group = self:GetUserGroup();
if (Groups[group] && Groups[group].Vip) then return true; end
return false;
end
function meta:IsHelper()
local group = self:GetUserGroup();
if (Groups[group] && Groups[group].Helper) then return true; end
return false;
end
function meta:IsMod()
local group = self:GetUserGroup();
if (Groups[group] && Groups[group].Mod) then return true; end
return false;
end
local isadmin = meta.IsAdmin
function meta:IsAdmin()
if (self:isadmin()) then return true; end
local group = self:GetUserGroup();
if (Groups[group] && Groups[group].Admin) then return true; end
return false;
end
local issa = meta.IsSuperAdmin
function meta:IsAdmin()
if (self:issa()) then return true; end
local group = self:GetUserGroup();
if (Groups[group] && Groups[group].SA) then return true; end
return false;
end
function meta:IsOwner()
local group = self:GetUserGroup();
if (Groups[group] && Groups[group].Owner) then return true; end
return false;
end
EDIT: Stupid FP parsing. Anyways, I hope I overrode those functions right, I’ve never actually done it
ULX groups are case sensitive (sometimes, dont ask why it just is :P) Try making sure your string “owner” matches up case for case with your usergroup.