• Find metatable (I think problem)
    7 replies, posted
Hey guys, I did this but I don't really know what is wrong with it can someone help me ? [CODE] local plyMeta = FindMetaTable("Player") function plyMeta:IsInAdminGroup() if ply:IsValid() then if ply:GetUserGroup() == "admin" then return true end end end; function plyMeta:IsInModeratorGroup() if ply:IsValid() then if ply:GetUserGroup() == "operator" or "moderator" then return true end end end; function plyMeta:IsInSuperAdminGroup() if ply:IsValid() then if ply:GetUserGroup() == "superadmin" or "fondateur" then return true end end end; function plyMeta:IsInUserGroup() if ply:IsValid() then if ply:GetUserGroup() == "user" then return true end end end; local function RemoveThoseShittyTabs() local UserTabsToRemove = { language.GetPhrase("spawnmenu.category.npcs"), language.GetPhrase("spawnmenu.category.entities"), language.GetPhrase("spawnmenu.category.weapons"), language.GetPhrase("spawnmenu.category.dupes"), language.GetPhrase("spawnmenu.category.saves"), language.GetPhrase("spawnmenu.category.vehicules") } local AdminTabsToRemove = { language.GetPhrase("spawnmenu.category.entities"), language.GetPhrase("spawnmenu.category.weapons"), language.GetPhrase("spawnmenu.category.dupes"), language.GetPhrase("spawnmenu.category.saves") } if !LocalPlayer():IsInSuperAdminGroup then if LocalPlayer():IsInUserGroup or LocalPlayer():IsInModeratorGroup for k, v in pairs( g_SpawnMenu.CreateMenu.Items ) do if table.HasValue(AdminTabsToRemove, v.Tab:GetText()) then g_SpawnMenu.CreateMenu:CloseTab( v.Tab, true ) RemoveThoseShittyTabs() end end end elseif LocalPlayer():IsInAdminGroup then for k, v in pairs( g_SpawnMenu.CreateMenu.Items ) do if table.HasValue(AdminTabsToRemove, v.Tab:GetText()) then g_SpawnMenu.CreateMenu:CloseTab( v.Tab, true ) RemoveThoseShittyTabs() end end end end end hook.Add("spawnMenuOpen", "RemoveThoseUselessTabs", RemoveThoseShittyTabs)[/CODE]
Help you with what exactly? What is the problem?
Well it doesn't work so Yeah any ideas ? it says that the argument line 45 is unexpected near then
[QUOTE=DJlive34;49023890]Well it doesn't work so Yeah any ideas ? it says that the argument line 45 is unexpected near then[/QUOTE] When using elseif, you do not need an end above it. Remove the end above elseif and it will work. EDIT: Actually, I'm not even sure. This indenting is terrible.
Well post the error next time. [code] if !LocalPlayer():IsInSuperAdminGroup then if LocalPlayer():IsInUserGroup or LocalPlayer():IsInModeratorGroup[/code] This is the incorrect part as far as I can tell. This is not how you call your functions. if !LocalPlayer():IsInSuperAdminGroup() then -- This is how you do it. I believe you can figure out how to fix the rest of your code.
Replace [B]ply[/B] with [B]self[/B]
That too. [editline]1st November 2015[/editline] In the meta: functions
-- Snip --
Sorry, you need to Log In to post a reply to this thread.