Discord
Steam
/
Garry's Mod
/
Developers
/
Entity not sho..
Login/Join
Event Log
Entity not showing
1 replies, posted
Search
In This Thread
So, I recently made an entity but currently it's not working. Here is the init.lua file. [CODE]AddCSLuaFile("cl_init.lua") include("shared.lua") function ENT:Initialize() self:SetModel("models/props_wasteland/laundry_washer003.mdl") --The model self:PhysicsInit(SOLID_VPHYSICS) self:SetMoveType(MOVETYPE_VPHYSICS) self:SetSolid(SOLID_VPHYSICS) self:SetUseType( SIMPLE_USE ) self:DrawShadow( true ) self.isTouching = false end function ENT:Use( activator, caller ) --When you press E on the generator self:Remove() if ( activator:IsPlayer() ) then if SERVER then AddCSLuaFile() util.AddNetworkString("CraftingMenu") hook.Add("PlayerSay", "Crafting", function ( ply ) net.Start( "CraftingMenu" ) net.Send( ply ) end) concommand.Add( "CraftWeapon", function( ply, cmd, args, argStr ) --Metal Shard + ShardList( args[1] ) if ( ShardList[args[2] <= CurrentPlayerShards ) then --If the amount of shards needed is less than or equal too the current amount, then give the weapon ply:Give( WeaponList[ tonumber( args[1] ) ] ) else print("You do not have enough shards!") end ) elseif CLIENT then ----------------------------------------------------------- --Weapons List config, config to your will, my friend!----- ----------------------------------------------------------- local WeaponList = {} WeaponList[1] = "m9k_intervention" --Intervention WeaponList[2] = "m9k_dbarrel" --Double Barrel Shotgun WeaponList[3] = "m9k_browningauto5" --Browning Auto 5 WeaponList[4] = "m9k_m60" --M60 WeaponList[5] = "m9k_val" --AS Val WeaponList[6] = "m9k_m16a4_acog" --M16A4 ACOG WeaponList[7] = "m9k_famas" --Famas WeaponList[8] = "m9k_ak47" --Ak-47 WeaponList[9] = "m9k_winchester73" --Winchester-73 WeaponList[10] = "m9k_m4a1" --M4A1 WeaponList[11] = "m9k_glock" --Glock WeaponList[12] = "m9k_deagle" --Deagle WeaponList[13] = "m9k_ragingbull" --Raging Bull ----------------------------------------------------------- ----------------------------------------------------------- ----------------------------------------------------------- ----------------------------------------------------------- --# o/ Shard List config, config to your will, my friend!-- ----------------------------------------------------------- local ShardList = {} ShardList[1] = 5 --Intervention ShardList[2] = 4 --Double Barrel Shotgun ShardList[3] = 3 --Browning Auto 5 ShardList[4] = 6 --M60 ShardList[5] = 2 --AS Val ShardList[6] = 2 --M16A4 ACOG ShardList[7] = 2 --Famas ShardList[8] = 3 --Ak-47 ShardList[9] = 4 --Winchester-73 ShardList[10] = 2 --M4A1 ShardList[11] = 1 --Glock ShardList[12] = 2 --Deagle ShardList[13] = 2 --Raging Bull ----------------------------------------------------------- ----------------------------------------------------------- ----------------------------------------------------------- local blurmat = Material( "pp/blurscreen" ) local function LayerBlur( panel, layers, density, alpha ) local x, y = panel:LocalToScreen(0, 0) surface.SetDrawColor( 255, 255, 255, alpha ) surface.SetMaterial( blurmat ) for i = 1, 3 do blurmat:SetFloat( "$blur", ( i / layers ) * density ) blurmat:Recompute() render.UpdateScreenEffectTexture() surface.DrawTexturedRect( -x, -y, ScrW(), ScrH() ) end end local DermaBG = vgui.Create( "DFrame" ) DermaBG:SetSize( ScrW(), ScrH() ) DermaBG:SetPos( 0, 0 ) DermaBG:SetTitle( "" ) DermaBG:SetDraggable( false ) DermaBG:MakePopup() DermaBG:Hide() DermaBG:ShowCloseButton( false ) function DermaBG:Paint( w, h ) LayerBlur( self, 10, 20, 255 ) end local DermaPanel = vgui.Create( "DFrame", DermaBG ) DermaPanel:SetSize( ScrW()*0.70, ScrH()*0.70 ) DermaPanel:SetPos( ScrW()/2 - DermaPanel:GetWide()/2, ScrH()/2 - DermaPanel:GetTall()/2 ) DermaPanel:SetTitle( "Craftable Weapons" ) DermaPanel:SetDraggable( false ) DermaPanel:MakePopup() DermaPanel:ShowCloseButton( false ) local function HidePanel() DermaBG:Hide() end local function ShowPanel() surface.PlaySound( "buttons/button1.wav" ) DermaBG:Show() end local DButton = vgui.Create( "DButton", DermaPanel) DButton:SetPos( 0, 0 ) DButton:SetText( "Close" ) DButton:SetSize( DermaPanel:GetWide(), DermaPanel:GetTall()*0.03 ) DButton.DoClick = function() HidePanel() end local AppList = vgui.Create( "DListView", DermaPanel ) AppList:SetSize(DermaPanel:GetWide(), DermaPanel:GetTall()*0.97) AppList:SetPos( 0, DermaPanel:GetTall()*0.03) AppList:SetMultiSelect( false ) AppList:AddColumn( "Weapons" ) AppList:AddLine("Intervention") AppList:AddLine("Double Barrel Shotgun") AppList:AddLine("Browning Auto 5") AppList:AddLine("M60") AppList:AddLine("AS Val") AppList:AddLine("M16A4 ACOG") AppList:AddLine("Famas") AppList:AddLine("Ak-47") AppList:AddLine("Winchester-73") AppList:AddLine("M4A1") AppList:AddLine("Glock") AppList:AddLine("Deagle") AppList:AddLine("Raging Bull") function AppList:DoDoubleClick( lineID, line ) -- lineID = the line you doubleclick on surface.PlaySound( "buttons/lever4.wav" ) LocalPlayer():ConCommand( "CraftWeapon " .. lineID ) LocalPlayer():removePocketItem( ShardList( args[1] ) ) AppList:AddColumn( "Metal Shards" ) AppList:AddLine("5") --Intervention AppList:AddLine("4") --Double Barrel Shotgun AppList:AddLine("3") --Browning Auto 5 AppList:AddLine("6") --M60 AppList:AddLine("2") --AS Val AppList:AddLine("2") --M16A4 ACOG AppList:AddLine("2") --Famas AppList:AddLine("3") --Ak-47 AppList:AddLine("4") --Winchester-73 AppList:AddLine("2") --M4A1 AppList:AddLine("1") --Glock AppList:AddLine("2") --Deagle AppList:AddLine("2") --Raging Bull end net.Receive( "CraftingMenu", function() ShowPanel() end) end end end function ENT:PhysicsCollide( data, phys ) if ( data.Speed > 25 ) then self:EmitSound( Sound( "physics/concrete/boulder_impact_hard1.wav" ) ) end end[/CODE] Here is the shared.lua file [CODE]ENT.Type = "anim" ENT.PrintName = "Gun Generator" ENT.Author = "{ON} Gigi The Kitty Boss" ENT.Spawnable = true meta = FindMetaTable( "Player" ) function meta:GetShards( shard ) return self:SetNWString( "Shards", self:GetShards() .. "&" .. shard ) end function meta:AddShards( shard ) return self:SetNWString( "Shards", self:GetShards() .. "&" .. shard ) end function meta:CurrentPlayerShards() return string.Explode( "&", self:GetNWString( "Shards" ), false ) end[/CODE] And lastly, here is the cl_init.lua file [CODE]include("shared.lua") function ENT:Draw() self.Entity:DrawModel() end[/CODE] [editline]3rd April 2016[/editline] Bump
[LUA] function ENT:Draw() self.Entity:DrawModel() end [/LUA] should be [LUA] function ENT:Draw() self:DrawModel() end [/LUA]
Sorry, you need to
Log In
to post a reply to this thread.