1. Post #1
    jdticer's Avatar
    March 2011
    63 Posts
    Ok So I coded a WorkBench Seavral more picks and axes and Iv put them all together and it seems In-Game It shows on the workbench, but it doesn't make it when you press make and I have the Required Resourses. It has to do with the workbench idk whats wrong with it.
    Heres The code I put in cl_init.lua
    include("shared.lua")
    
    --Called when it's time to draw the entity.
    --Return: Nothing
    function ENT:Draw()
             self.Entity:DrawModel()
    end
    
    --Called when the SENT is spawned
    --Return: Nothing
    function ENT:Initialize()
    end
    
    --Return true if this entity is translucent.
    --Return: Boolean
    function ENT:IsTranslucent()
    end
    
    --Called when a save-game is loaded.
    --Return: Nothing
    function ENT:OnRestore()
    end
    
    --Called when the SENT thinks.
    --Return: Nothing
    function ENT:Think()
    end
    
    init.lua
    AddCSLuaFile("cl_init.lua")
    AddCSLuaFile("shared.lua")
    
    include("shared.lua")
    
    --Called when an entity is no longer touching this SENT.
    --Return: Nothing
    function ENT:EndTouch(entEntity)
    end
    
    --Called when the SENT is spawned
    --Return: Nothing
    
    function ENT:Initialize()
    	 self.Entity:SetModel("models/props_wasteland/kitchen_counter001a.mdl")
    
     	 self.Entity:PhysicsInit( SOLID_VPHYSICS )
    	 self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
    	 self.Entity:SetSolid( SOLID_VPHYSICS )
    
    end
    
    function ENT:Use(ply)
             ply:OpenCombiMenu("AdvWeapons")
    end
    
    function ENT:AcceptInput(input, ply)
    end
    
    --Called when the entity key values are setup (either through calls to ent:SetKeyValue, or when the map is loaded).
    --Return: Nothing
    function ENT:KeyValue(k,v)
    end
    
    --Called when a save-game is loaded.
    --Return: Nothing
    function ENT:OnRestore()
    end
    
    --Called when something hurts the entity.
    --Return: Nothing
    function ENT:OnTakeDamage(dmiDamage)
    end
    
    --Controls/simulates the physics on the entity.
    --Return: (SimulateConst) sim, (Vector) linear_force and (Vector) angular_force
    function ENT:PhysicsSimulate(pobPhysics,numDeltaTime)
    end
    
    --Called when an entity starts touching this SENT.
    --Return: Nothing
    function ENT:StartTouch(entEntity)
    end
    
    --Called when the SENT thinks.
    --Return: Nothing
    function ENT:Think()
    end
    
    --Called when an entity touches this SENT.
    --Return: Nothing
    function ENT:Touch(entEntity)
    end
    
    --Called when: ?
    --Return: TRANSMIT_ALWAYS, TRANSMIT_NEVER or TRANSMIT_PVS
    function ENT:UpdateTransmitState(entEntity)
    end
    
    shared.lua
    ENT.Type = "Anim"
    ENT.Base = "base_gmodentity"
    
    ENT.PrintName = "stoneWorkbench" --The name of the SENT.
    ENT.Author = "jA_cOp" --Your name.
    ENT.Contact = "jakob_oevrum@hotmail.com" --EMail address.
    ENT.Purpose = "" --The purpose of this SENT.
    ENT.Instructions = "" --Instructions
    
    ENT.Spawnable = false --Can the clients spawn this SENT?
    ENT.AdminSpawnable = false --Can the admins spawn this SENT?
    
    --Called when the SENT is removed
    --Return: Nothing
    function ENT:OnRemove()
    end
    
    --Controls what a scripted entity does during a collison.
    --Return: Nothing
    --Notes: tblData contains: HitEntity (Entity), HitPos (Vector), OurOldVelocity (Vector), HitObject (PhysObj), DeltaTime (number), TheirOldVelocity (Vector), Speed (number?) and HitNormal (Vector).
    function ENT:PhysicsCollide(tblData)
    end
    
    --Called when physics are updated?
    --Return: Nothing
    function ENT:PhysicsUpdate(pobPhysics)
    end
    

  2. Post #2
    Best Gamemode Ever
    Deadman123's Avatar
    July 2011
    1,602 Posts
    use [lua] tags instead of code tags

  3. Post #3
    jdticer's Avatar
    March 2011
    63 Posts
    and this helps how?