• F4 Menu Issues
    6 replies, posted
I am making a DarkRP server and I downloaded a custom F4 menu. Everything works great except for the shops tab. I can buy ammo, and guns but the printers under the entities tab wont spawn when I click buy. Here is the code for the shop tab. [CODE] local TABINFO = TABINFO; -- TESTING PURPOSES ONLY. TABINFO.name = 'Jobs'; TABINFO.index = 1; local function check_CanJoinTeam( v ) -- check to make sure we're aloud. local nodude = true if v.admin == 1 and not LocalPlayer():IsAdmin() then nodude = false end if v.admin > 1 and not LocalPlayer():IsSuperAdmin() then nodude = false end if v.customCheck and not v.customCheck(LocalPlayer()) then nodude = false end if (type(v.NeedToChangeFrom) == "number" and LocalPlayer():Team() ~= v.NeedToChangeFrom) or (type(v.NeedToChangeFrom) == "table" and not table.HasValue(v.NeedToChangeFrom, LocalPlayer():Team())) then nodude = false end if nodude then return true; else return false; end end TABINFO.build = function( self, w, h ) local scroller = vgui.Create( 'DScrollPanel', self ); scroller:SetSize( self:GetSize() ); scroller:SetPos( 0, 0 ); -- MODIFY THE SCROLLBAR local scrollbar = scroller.VBar; local scrollbar_bg = Color( 255, 255, 255, 100 ); local scrollbar_grip = Color( 255, 255, 255, 20 ); function scrollbar:Paint( w, h ) end function scrollbar.btnGrip:Paint( w, h ) draw.RoundedBox( 4, 3, 0, w-6, h, scrollbar_grip ); end function scrollbar.btnUp:Paint() end function scrollbar.btnDown:Paint() end local List = vgui.Create( "DIconLayout", scroller ); List:SetPos( 2, 2 ); List:SetSize( self:GetWide() - 4, self:GetTall() - 4 ); List:SetSpaceY( 5 ) List:SetSpaceX( 5 ) self.scroller = scroller; self.list = List; end TABINFO.update = function( self, w, h ) local start = SysTime( ); local scroller, List = self.scroller, self.list; List:Clear( ); -- build the job icons. local itemH = (self:GetTall() - 4)/3 - 5; local itemW = itemH * 0.8; -- items are slightly narrower than they are tall. itemW = math.floor( self:GetWide() / math.floor( self:GetWide() / itemW ) - 5); for k,v in pairs( RPExtraTeams )do if( check_CanJoinTeam( v ) )then v.teamid = k; local icon = vgui.Create('pf4_jobicon'); icon:SetSize( itemW, itemH ); icon.clipper = scroller; icon:SetJob( v ); icon.TAB = TABINFO; List:Add( icon ); end end print("UPDATED JOBS TAB IN: ".. ( SysTime() - start )); return self; end [/CODE]
This happens when the entity isn't setup correctly. Post your entities (or whatever won't spawn) code.
[CODE]/*--------------------------------------------------------------------------- /*--------------------------------------------------------------------------- DarkRP custom entities --------------------------------------------------------------------------- This file contains your custom entities. This file should also contain entities from DarkRP that you edited. Note: If you want to edit a default DarkRP entity, first disable it in darkrp_config/disabled_defaults.lua Once you've done that, copy and paste the entity to this file and edit it. The default entities can be found here: <TODO: INSERT URL HERE> Add entities under the following line: ---------------------------------------------------------------------------*/ AddEntity("Coolant Cell", { ent = "money_coolant_cell", model = "models/Items/battery.mdl", price = 2000, max = 2, cmd = "/coolantcell" }) AddEntity("Printer Upgrade", { ent = "money_printer_upgrade", model = "models/props_lab/box01a.mdl", price = 2000, max = 2, cmd = "/printerupgrade" }) AddEntity("Normal Money Printer", { ent = "money_normal_printer", model = "models/props_lab/reciever01a.mdl", price = 500, max = 2, cmd = "/normalprinter" }) AddEntity("Coal Money Printer", { ent = "money_coal_printer", model = "models/props_lab/reciever01a.mdl", price = 1000, max = 2, cmd = "/coalprinter" }) AddEntity("Ruby Money Printer", { ent = "money_ruby_printer", model = "models/props_lab/reciever01a.mdl", price = 2500, max = 2, cmd = "/rubyprinter" }) AddEntity("Sapphire Money Printer", { ent = "money_sapphire_printer", model = "models/props_lab/reciever01a.mdl", price = 5000, max = 2, cmd = "/sapphireprinter" }) AddEntity("Emerald Money Printer", { ent = "money_emerald_printer", model = "models/props_lab/reciever01a.mdl", price = 10000, max = 2, cmd = "/emeraldprinter" }) AddEntity("Diamond Money Printer", { ent = "money_diamond_printer", model = "models/props_lab/reciever01a.mdl", price = 25000, max = 2, cmd = "/diamondprinter" }) AddEntity("Pearl Money Printer", { ent = "money_pearl_printer", model = "models/props_lab/reciever01a.mdl", price = 50000, max = 2, cmd = "/pearlprinter" }) AddEntity("Platinum Money Printer", { ent = "money_platinum_printer", model = "models/props_lab/reciever01a.mdl", price = 75000, max = 2, cmd = "/platinumprinter" }) AddEntity("Black Money Printer", { ent = "money_black_printer", model = "models/props_lab/reciever01a.mdl", price = 125000, max = 2, cmd = "/blackprinter" }) AddEntity("White Money Printer", { ent = "money_white_printer", model = "models/props_lab/reciever01a.mdl", price = 200000, max = 2, cmd = "/whiteprinter" })[/CODE] [editline]5th June 2014[/editline] Also note that when using the default F4 menu I can spawn printers.
If you're on 2.5 change all of the lines that say [lua]AddEntity[/lua] to [lua]DarkRP.createEntity[/lua] EDIT: This code should work if you're on 2.5 [lua]/*--------------------------------------------------------------------------- /*--------------------------------------------------------------------------- DarkRP custom entities --------------------------------------------------------------------------- This file contains your custom entities. This file should also contain entities from DarkRP that you edited. Note: If you want to edit a default DarkRP entity, first disable it in darkrp_config/disabled_defaults.lua Once you've done that, copy and paste the entity to this file and edit it. The default entities can be found here: <TODO: INSERT URL HERE> Add entities under the following line: ---------------------------------------------------------------------------*/ DarkRP.createEntity("Coolant Cell", { ent = "money_coolant_cell", model = "models/Items/battery.mdl", price = 2000, max = 2, cmd = "/coolantcell" }) DarkRP.createEntity("Printer Upgrade", { ent = "money_printer_upgrade", model = "models/props_lab/box01a.mdl", price = 2000, max = 2, cmd = "/printerupgrade" }) DarkRP.createEntity("Normal Money Printer", { ent = "money_normal_printer", model = "models/props_lab/reciever01a.mdl", price = 500, max = 2, cmd = "/normalprinter" }) DarkRP.createEntity("Coal Money Printer", { ent = "money_coal_printer", model = "models/props_lab/reciever01a.mdl", price = 1000, max = 2, cmd = "/coalprinter" }) DarkRP.createEntity("Ruby Money Printer", { ent = "money_ruby_printer", model = "models/props_lab/reciever01a.mdl", price = 2500, max = 2, cmd = "/rubyprinter" }) DarkRP.createEntity("Sapphire Money Printer", { ent = "money_sapphire_printer", model = "models/props_lab/reciever01a.mdl", price = 5000, max = 2, cmd = "/sapphireprinter" }) DarkRP.createEntity("Emerald Money Printer", { ent = "money_emerald_printer", model = "models/props_lab/reciever01a.mdl", price = 10000, max = 2, cmd = "/emeraldprinter" }) DarkRP.createEntity("Diamond Money Printer", { ent = "money_diamond_printer", model = "models/props_lab/reciever01a.mdl", price = 25000, max = 2, cmd = "/diamondprinter" }) DarkRP.createEntity("Pearl Money Printer", { ent = "money_pearl_printer", model = "models/props_lab/reciever01a.mdl", price = 50000, max = 2, cmd = "/pearlprinter" }) DarkRP.createEntity("Platinum Money Printer", { ent = "money_platinum_printer", model = "models/props_lab/reciever01a.mdl", price = 75000, max = 2, cmd = "/platinumprinter" }) DarkRP.createEntity("Black Money Printer", { ent = "money_black_printer", model = "models/props_lab/reciever01a.mdl", price = 125000, max = 2, cmd = "/blackprinter" }) DarkRP.createEntity("White Money Printer", { ent = "money_white_printer", model = "models/props_lab/reciever01a.mdl", price = 200000, max = 2, cmd = "/whiteprinter" })[/lua]
Thanks [editline]5th June 2014[/editline] Well I changed the code to that and it still doesn't work. I really don't think that its the entities because I can spawn the printers just fine with the default DarkRP Menu.
[QUOTE=GFHazard;45011092]Thanks [editline]5th June 2014[/editline] Well I changed the code to that and it still doesn't work. I really don't think that its the entities because I can spawn the printers just fine with the default DarkRP Menu.[/QUOTE] That code I supplied will only work with 2.5. Be sure you are on 2.5. Also are you using a custom F4 menu or default?
I was using a custom F4 menu but I got a different one and it works just fine now. Thanks though
Sorry, you need to Log In to post a reply to this thread.