• F4 Menu Code Error
    3 replies, posted
[B][U]Here's the code that I'm getting the error from:[/U][/B] function PANEL:Refresh() if self.holder.Items[3] and not GAMEMODE.CivilProtection[ LocalPlayer():Team() ] then self.holder.Items[3]:Remove() end if self.holder.Items[4] and not RPExtraTeams[ LocalPlayer():Team() ].mayor then self.holder.Items[4]:Remove() end if RPExtraTeams[ LocalPlayer():Team() ].mayor then if not self.holder.Items[3] then self.holder:AddItem( CreateOptions( "Police" ) ) end if not self.holder.Items[4] then self.holder:AddItem( CreateOptions( "Mayor" ) ) end elseif GAMEMODE.CivilProtection[ LocalPlayer():Team() ] then if not self.holder.Items[3] then self.holder:AddItem( CreateOptions( "Police" ) ) end end end [B][U]Here's the error: [/U][/B] [DarkRP] addons/darkrpmodification-master/lua/darkrp_modules/modernf4menu/cl_cmdtab.lua:227: attempt to index field 'CivilProtection' (a nil value) 1. Refresh - addons/darkrpmodification-master/lua/darkrp_modules/modernf4menu/cl_cmdtab.lua:227 [B][U]This is not mine I got this off of coderhire but ever since I bought it it always gave me this error. The creator of the menu never responded to me.. ever! So here I am trying to fix it. Please help me I really want this.[/U][/B]
Add [code]GAMEMODE.CivilProtection = { [TEAM_POLICE] = true, [TEAM_CHIEF] = true, [TEAM_MAYOR] = true, }[/code] to the top of your file.
[B][U]It does the same thing but now I get this error:[/U][/B] [DarkRP] addons/darkrpmodification-master/lua/darkrp_modules/modernf4menu/cl_cmdtab.lua:232: attempt to index field 'CivilProtection' (a nil value) 1. Refresh - addons/darkrpmodification-master/lua/darkrp_modules/modernf4menu/cl_cmdtab.lua:232 2. Init - addons/darkrpmodification-master/lua/darkrp_modules/modernf4menu/cl_cmdtab.lua:214 3. Create - lua/includes/extensions/client/panel/scriptedpanels.lua:153 4. Init - addons/darkrpmodification-master/lua/darkrp_modules/modernf4menu/cl_frame.lua:134 5. Create - lua/includes/extensions/client/panel/scriptedpanels.lua:153 6. Create - lua/includes/extensions/client/panel/scriptedpanels.lua:142 7. openF4Menu - addons/darkrpmodification-master/lua/darkrp_modules/modernf4menu/cl_init.lua:11 8. Call - addons/darkrpmodification-master/lua/darkrp_modules/modernf4menu/cl_init.lua:24 9. unknown - gamemodes/darkrp/gamemode/modules/base/cl_gamemode_functions.lua:46 [editline]6th September 2014[/editline] My code: [url]http://pastebin.com/wHjLqary[/url]
Change all instances of GAMEMODE.CivilProtection to just CivilProtection in that file.
Sorry, you need to Log In to post a reply to this thread.