hey guys so i need a bit of help.
my class selection menu uses this code for group restriction. but the problem is that i dont know how to make it so it works with other ranks too. i tried adding like ,("superadmin"), ("owner"), ("admin") but didnt work. please help me.
[CODE]function meta:SetPlayerClass( num )
if num == CLASS_SWAT then
if self:CheckGroup("vip") then
self.Class = num
else
self:NoticeOnce("Only VIP and higher ranks can access to SWAT class.", GAMEMODE.Colors.Red)
end
else
self.Class = num
end
end[/CODE]
Wheres the error...
paste the error
What line.
Paste the line...
And yah... maybe we will be able to help.
theres no errors. that code works . i just need to figure out how to make it so other ranks than vip can access the class too.
Check out this code:
[code]if self:CheckGroup("vip") then[/code]
I believe you know what to do.
[QUOTE=Robotboy655;45557111]Check out this code:
[code]if self:CheckGroup("vip") then[/code]
I believe you know what to do.[/QUOTE]
i tried if self:CheckGroup("vip", "admin", "superadmin") then but didnt work.
That's not how coding works.
self:CheckGroup("vip") or self:CheckGroup("admin") or self:CheckGroup("superadmin")
thanks ! that part works but i still have other part of the code in other .lua file and its like
if k == CLASS_SWAT and !LocalPlayer():CheckGroup("vip") then
how i add other ranks to that :/ sorry im new to lua :(
He literally put that in his example. Use the "or" operator along with the checkgroup method, refer to robots post for help.
if k == CLASS_SWAT and !LocalPlayer():CheckGroup("vip") or !LocalPlayer():Checkgroup("owner") then
i tried that it didnt work <.<
Lua is case sensitive. You need to rename Checkgroup("owner") to CheckGroup("owner")
i did that but it still didnt work. is the Localplayer required? or can i do or CheckGroup(owner)
Well you shouldn't be using LocalPlayer() at all if your not running this client-side. Also as it appears you're running this in a meta function, you really should be doing self:CheckGroup(blah) as self is the player.
button.OnMousePressed = function()
if k == CLASS_SWAT and !LocalPlayer():CheckGroup("vip") or !LocalPlayer():CheckGroup("owner") then
RunConsoleCommand( "changeclass", k )
else
RunConsoleCommand( "changeclass", k ) RunConsoleCommand( "changeteam", TEAM_ARMY ) self:Remove()
end
end
[editline]1st August 2014[/editline]
i tried that but it didnt work idk why :/ please help
Try this, Suchipi gave me this so it should work, I forget if this works or not.
[CODE]
hook.Add( "PrePACEditorOpen", "RestrictToSuperadmin", function( ply )
if not ply:GetUserGroup("donor") then
chat.AddText("Only Donors can use PAC3")
return false
end
end )
hook.Add("PrePACConfigApply", "donators only", function(ply, outfit_data)
if not ply:GetUserGroup("donor") then
chat.AddText("Only Donors can use PAC3")
return false
end
end)
[/CODE]
[QUOTE=LUModder;45559156]Try this, Suchipi gave me this so it should work, I forget if this works or not.
[CODE]
hook.Add( "PrePACEditorOpen", "RestrictToSuperadmin", function( ply )
if not ply:GetUserGroup("donor") then
chat.AddText("Only Donors can use PAC3")
return false
end
end )
hook.Add("PrePACConfigApply", "donators only", function(ply, outfit_data)
if not ply:GetUserGroup("donor") then
chat.AddText("Only Donors can use PAC3")
return false
end
end)
[/CODE][/QUOTE]
thx but this isnt related to pac XD
[QUOTE=arcticdx;45562071]thx but this isnt related to pac XD[/QUOTE]
Then why does the title have PAC in it, unless you're talking about the anti-cheat, be mroe specific next time...
Sorry, you need to Log In to post a reply to this thread.