1. Post #1
    cloudwolf's Avatar
    February 2007
    50 Posts
    So as the title says my entity is unable to be colided with as in i can simply walk through it. Also i am unable to press use on it. The walking throuhg it doesn't bug me as much as it not registering my use as i need it to register that for my gamemode to work how i intend it to.

    init.lua
    AddCSLuaFile("cl_init.lua")
    AddCSLuaFile("shared.lua")
    
    include("shared.lua")
    
    function ENT:Initialize()
    	self.Entity:SetModel("models/weapons/w_357.mdl")
    	self.Entity:PhysicsInit(SOLID_VPHYSICS)
    	self.Entity:SetMoveType(MOVETYPE_VPHYSICS)
    	self.Entity:SetSolid(SOLID_VPHSYICS)
    		local phys= self.Entity:GetPhysicsObject()
    		if (phys:IsValid()) then
    			phys:Wake()
    			print("its awake")
    		else
    			print("its dead jim")
    		end
    	self.Entity:GetPhysicsObject():EnableGravity(false)
    	timer.Simple(.01,function() self.Entity:SetPos(self.Entity:GetPos()+Vector(0,0,32)) end)
    	timer.Create("spinit"..self.Entity:EntIndex(),.01,0,function() self.Entity:SetAngles(self.Entity:GetAngles()+Angle(0,1,0)) end)
    end
    
    function ENT:use(acti, caller)
    local samecount= 0
    	for k,v in pairs(acti:GetWeapons()) do
    	if v:GetClass() == "better_pistol" then
    		samecount= samecount+1
    	end
    	end
    	if samecount>=1 then
    		acti:GiveAmmo(100,"Pistol",true)
    	elseif #acti:GetWeapons()<2 then
    		acti:Give("decent_pistol")
    	else
    		acti:StripWeapon(acti:GetActiveWeapon():GetClass())
    		acti:Give("decent_pistol")
    	end
    	timer.Remove("spinit"..self.Entity:EntIndex())
    	self.Entity:Remove()
    end
    
    function ENT:Think()
    end

    cl_init.lua
    include("shared.lua")
    
    function ENT:Draw()
    	self.Entity:DrawModel()
    end

    and last but not least shared.lua
    ENT.Type= "anim"
    ENT.Base= "base_gmodentity"
    
    ENT.PrintName = "spinning starter pistol"
    ENT.Author = "cloudwolf"
    ENT.Contact= "not provided"
    ENT.Purpose="give people weapons and looking cool"
    ENT.Instructions ="f*ck the instructions"

    Btw the ent flaots how high i want it and spins how i want it. It doesn't give me any errors in console and i have no idea why its not working.

  2. Post #2
    cloudwolf's Avatar
    February 2007
    50 Posts
    Please some one help? this realy puts a hampering on my gamemode.

  3. Post #3

    July 2009
    62 Posts
    You misspelled "SOLID_VPHYSICS" on line 10 of init.lua and "Use" needs to be capitalized on line 23. It will work once you correct these errors.

  4. Post #4
    cloudwolf's Avatar
    February 2007
    50 Posts
    ers35. Thank you it figures that i skipped over some small spelling errors. I hate typing physics i keep doing phsyics... That's what i get for typing to fast. And I completely spaced over that capital. Thank you so much.

  5. Post #5
    Emz
    Gold Member
    Emz's Avatar
    October 2008
    2,317 Posts
    Do you use Notepad++ by any chance? If so download the Lua Syntax Highlighter Plugin. It is great for detecting typos if certain key words aren't highlighted.

    Syntax highlighter can be found here: http://www.facepunch.com/showthread.php?t=477505

    Looks like this:

  6. Post #6
    cloudwolf's Avatar
    February 2007
    50 Posts
    I use NP++ but i have the gmod syntax highlighter but it keeps telling me it doesn't work with my version of NP++ so unless the verison you ilnked is compatable with 5.4.3

  7. Post #7
    Emz
    Gold Member
    Emz's Avatar
    October 2008
    2,317 Posts
    Well I use v5.4.2 and it works fine for me on that version. I checked about for some links and couldn't find a newer version of the highlighter sorry. Try it and see if it works?