Hey, I'm trying to figure out why the code is not allowing the certain groups to enter the group, the only one that can access it is superadmin, could anyone help?
[B]Player.lua[/B]
[CODE]function meta:ChangeTeam(t, force)
if t == TEAM_MOD then
if !self:IsSuperAdmin() and !self:IsUserGroup("moderator") then
GAMEMODE:Notify( self, 1, 4, "Moderator's access only!")
return false
end
end
if t == TEAM_MOD then
if !self:IsSuperAdmin() and !self:IsUserGroup("trialmoddonator") then
GAMEMODE:Notify( self, 1, 4, "Moderator's access only!")
return false
end
end
if t == TEAM_MOD then
if !self:IsSuperAdmin() and !self:IsUserGroup("moddonator") then
GAMEMODE:Notify( self, 1, 4, "Moderator's access only!")
return false
end
end
if t == TEAM_ADMIN then
if !self:IsSuperAdmin() and !self:IsUserGroup("admin") then
GAMEMODE:Notify( self, 1, 4, "Admin access only!")
return false
end
end
if t == TEAM_ADMIN then
if !self:IsSuperAdmin() and !self:IsUserGroup("admindonator") then
GAMEMODE:Notify( self, 1, 4, "Admin access only!")
return false
end
end
if t == TEAM_HOOK then
if !self:IsSuperAdmin() and !self:IsUserGroup("moddonator") then
GAMEMODE:Notify( self, 1, 4, "Donator access only!")
return false
end
end
if t == TEAM_HOOK then
if !self:IsSuperAdmin() and !self:IsUserGroup("admindonator") then
GAMEMODE:Notify( self, 1, 4, "Donator access only!")
return false
end
end
if t == TEAM_HOOK then
if !self:IsSuperAdmin() and !self:IsUserGroup("donator") then
GAMEMODE:Notify( self, 1, 4, "Donator access only!")
return false
end
end
if t == TEAM_HOOK then
if !self:IsSuperAdmin() and !self:IsUserGroup("trialmoddonator") then
GAMEMODE:Notify( self, 1, 4, "Donator access only!")
return false
end
end
if t == TEAM_ASSAS then
if !self:IsSuperAdmin() and !self:IsUserGroup("donator") then
GAMEMODE:Notify( self, 1, 4, "You have to be a donator to access this class!")
return false
end
end
if t == TEAM_ASSAS then
if !self:IsSuperAdmin() and !self:IsUserGroup("moddonator") then
GAMEMODE:Notify( self, 1, 4, "You have to be a donator to access this class!")
return false
end
end
if t == TEAM_ASSAS then
if !self:IsSuperAdmin() and !self:IsUserGroup("admindonator") then
GAMEMODE:Notify( self, 1, 4, "You have to be a donator to access this class!")
return false
end
end
if t == TEAM_ASSAS then
if !self:IsSuperAdmin() and !self:IsUserGroup("trialmoddonator") then
GAMEMODE:Notify( self, 1, 4, "You have to be a donator to access this class!")
return false
end
end
if t == TEAM_PRO then
if !self:IsSuperAdmin() and !self:IsUserGroup("donator") then
GAMEMODE:Notify( self, 1, 4, "You have to be a donator to access this class!")
return false
end
end
if t == TEAM_PRO then
if !self:IsSuperAdmin() and !self:IsUserGroup("moddonator") then
GAMEMODE:Notify( self, 1, 4, "You have to be a donator to access this class!")
return false
end
end
if t == TEAM_PRO then
if !self:IsSuperAdmin() and !self:IsUserGroup("admindonator") then
GAMEMODE:Notify( self, 1, 4, "You have to be a donator to access this class!")
return false
end
end
if t == TEAM_PRO then
if !self:IsSuperAdmin() and !self:IsUserGroup("trialmoddonator") then
GAMEMODE:Notify( self, 1, 4, "You have to be a donator to access this class!")
return false
end
end
if self:isArrested() and not force then
GAMEMODE:Notify(self, 1, 4, DarkRP.getPhrase("unable", team.GetName(t), ""))
return false
end[/CODE]
[B]Shared.lua[/B]
[CODE]TEAM_MOD = AddExtraTeam("Mod on Duty", {
color = Color(255, 0, 255, 255),
model = "models/player/combine_super_soldier.mdl",
description = [[Do your fucking job!]],
weapons = {"arrest_stick","unarrest_stick","lockpick","stunstick", "weapon_fists"},
command = "mod",
max = 5,
salary = 200,
admin = 0,
vote = false,
hasLicense = true,
function(ply) return ply:IsUserGroup("superadmin") == "superadmin" or ply:GetNWString("moderator") == "moderator" or ply:GetNWString("moddonator") end,
CustomCheckFailMsg = "You must be a Moderator to access this job!"
})
TEAM_ADMIN = AddExtraTeam("Admin on Duty", {
color = Color(255, 0, 255, 255),
model = "models/player/combine_super_soldier.mdl",
description = [[Do your fucking job!]],
weapons = {"arrest_stick","unarrest_stick","lockpick","stunstick", "weapon_fists"},
command = "madmin",
max = 3,
salary = 400,
admin = 1,
vote = false,
hasLicense = true,
function(ply) return ply:IsUserGroup("superadmin") == "superadmin" or ply:GetNWString("admindonator") == "admindonator" or ply:GetNWString("admin") == "admin" end,
CustomCheckFailMsg = "You must be a Admin to access this job!"
})
TEAM_ASSAS = AddExtraTeam("Assasin", {
color = Color(76, 0, 103, 255),
model = "models/player/arctic.mdl",
description = [[DONATOR CLASS ONLY: As a Assasin, you can kill people, for a price, of course.]],
weapons = {"weapon_fists", "spiderman's_swep", "bb_css_knife", "m9k_glock"},
command = "assasin",
max = 3,
salary = 95,
admin = 0,
vote = false,
hasLicense = true,
function(ply) return ply:IsUserGroup("superadmin") == "superadmin" or ply:GetNWString("donator") == "donator" or ply:GetNWString("moddonator") == "moddonator" or ply:GetNWString("admindonator") == "admindonator" or ply:GetNWString("trialmoddonator") == "trialmoddonator" end,
CustomCheckFailMsg = "You must be a donator to access this job!"
})
TEAM_PRO = AddExtraTeam("Pro Thief", {
color = Color(0, 51, 102, 255),
model = "models/player/phoenix.mdl",
description = [[DONATOR CLASS ONLY: You have learned the ways of the thiefs, and have overcomed your journey, to a better theif.]],
weapons = {"weapon_fists", "pro_lockpick", "keypad_cracker", "m9k_model3russian"},
command = "protheif",
max = 3,
salary = 95,
admin = 0,
vote = false,
hasLicense = true,
function(ply) return ply:IsUserGroup("superadmin") == "superadmin" or ply:GetNWString("donator") == "donator" or ply:GetNWString("moddonator") == "moddonator" or ply:GetNWString("admindonator") == "admindonator" or ply:GetNWString("trialmoddonator") == "trialmoddonator" end,
CustomCheckFailMsg = "You must be a donator to access this job!"
})
TEAM_HOOK = AddExtraTeam("Hooker", {
color = Color(255, 204, 229, 255),
model = "models/player/alyx.mdl",
description = [[DONATOR CLASS ONLY: You walk around on the streets, and make money by selling your body to strangers.]],
weapons = {"weapon_fists", "weapon_rape"},
command = "hook",
max = 2,
salary = 35,
admin = 0,
vote = false,
hasLicense = true,
function(ply) return ply:IsUserGroup("superadmin") == "superadmin" or ply:GetNWString("donator") == "donator" or ply:GetNWString("moddonator") == "moddonator" or ply:GetNWString("admindonator") == "admindonator" or ply:GetNWString("trialmoddonator") == "trialmoddonator" end,
CustomCheckFailMsg = "You must be a donator to access this j
This will make the classes visible to everyone:
[CODE]customCheck = function(ply) return CLIENT or ply:GetUserGroup()=="GROUPNAME" or ply:GetUserGroup()=="GROUPNAME2" end,
CustomCheckFailMsg = "You need to be a groupname to use this class."[/CODE]
This will make them visible to only those who can use it:
[CODE]customCheck = function(ply) return ply:GetUserGroup()=="GROUPNAME" or ply:GetUserGroup()=="GROUPNAME2" [/CODE]
I know, but it's only allowing people from the superadmin class to access the group, not the actual donator class.
[QUOTE=Matt555;42186723]I know, but it's only allowing people from the superadmin class to access the group, not the actual donator class.[/QUOTE]
What it is:
[CODE] ply:IsUserGroup("superadmin") == "superadmin"[/CODE]
What it should be:
[CODE]ply:GetUserGroup()=="superadmin"[/CODE]
Look closely next time.
Alright, changed the sequence,
Here's my code.
[CODE] function(ply) return ply:GetUserGroup()=="superadmin" or ply:GetUserGroup()=="moddonator" or ply:GetUserGroup()=="donator" or ply:GetUserGroup()=="admindonator" end,[/CODE]
And it's still saying that it's a donators class only.
[B]EDIT:[/B]
I've just tested it, when I've removed all access from me, and I think something with this is causing the problem.
[CODE]
if t == TEAM_PRO then
if !self:IsSuperAdmin() and !self:GetUserGroup("trialmoddonator") then
GAMEMODE:Notify( self, 1, 4, "You have to be a donator to access this class!")
return false
end
end
[/CODE]
I've changed !self:GetUserGroup, and it was originaly !self:IsUserGroup
I'm pretty sure you have to use
[code] if !self:IsSuperAdmin() and !self:IsUserGroup("trialmoddonator") then[/code]
if you want it to return true, or false. If I'm correct, GetUserGroup only returns what usergroup they are in.
Yeah that works man, thanks, you've really helped me out guys.
Sorry, you need to Log In to post a reply to this thread.