• Enitity physgun pickup ?
    10 replies, posted
Hello, I'm very new a lua coding and I have some very simple code for spawning an entity but was wondering how I make it so I can pick it up with my physgun. Here are the 3 files: init: [url]http://pastebin.com/89yKa0Nk[/url] shared: [url]http://pastebin.com/Y2ctjpkN[/url] cl_init: [url]http://pastebin.com/mCJEMvsv[/url]
whats the name of the entity?
The folder is just called prop. In the shared.lua the print name is called Just an entity.
[url]https://wiki.garrysmod.com/page/GM/PhysgunPickup[/url]
Wait what do you think I want to do ? xD
Do you have FPP installed?
No ... I just want to know what I need to do to be able to physgun my entity. ;p
[url]https://wiki.garrysmod.com/page/GM/PhysgunPickup[/url]
So I could just do: function PlayerPickup( ply, ent ) return true end hook.Add( "PhysgunPickup", "Allow Player Pickup", PlayerPickup )
You're missing ENT.Category, ENT:Draw() and ENT:SpawnFunction() other than that the ent is working fine. You don't really need a folder, just save this as prop.lua [code] ENT.Type = "anim" ENT.Base = "base_anim" ENT.PrintName = "Just an entity" ENT.Author = "Skash" ENT.Category = "My test entity"; ENT.Spawnable = true ENT.AdminOnly = false ENT.Model = "models/props_c17/FurnitureWashingmachine001a.mdl" if( SERVER ) then AddCSLuaFile( ) function ENT:SpawnFunction( ply, tr, class ) local SpawnPos = tr.HitPos + tr.HitNormal * 16 local ent = ents.Create( class ) ent:SetPos( SpawnPos ) ent:SetAngles( ply:GetAngles() ) ent:Spawn() ent:Activate() return ent end function ENT:Initialize() self:SetModel( self.Model ) self:PhysicsInit( SOLID_VPHYSICS ) self:SetMoveType( MOVETYPE_VPHYSICS ) self:SetSolid( SOLID_VPHYSICS ) self:SetColor( Color( 0, 255, 0, 255 ) ) end end if( CLIENT ) then function ENT:Initialize() end function ENT:Draw() self:DrawModel() end end [/code]
Well it's in my darkrp test server so I need the folder. xP But I'll give it a try and get back to you! [editline]20th December 2015[/editline] I guess my anti virus put it in a virus vault but I got it back.
Sorry, you need to Log In to post a reply to this thread.