So I’m using this tutorial from the GMod Wiki on how to make a chair throwing gun. I don’t want my SWEP to shoot chairs, because my friend and I have an inside joke about the TF2 Ambulance and we spam a bunch of ambulances, while saying “SPAMBULANCE”, so I want an ambulance throwing gun. If someone could tell where the TF2 Ambulance model is located in GMod’s C: folder, that’d be greatly appreciated. Thanks in advance!
When I tried editing the original post nothing changed, so I’ll just leave it here in the replies. I lazily want the model of the gun to be the SMG from Half-Life 2. Any idea where that is, too? Thanks, again.
The model of the gun is defined in SWEP.WorldModel and SWEP.ViewModel
I’m not sure about your ambulance question. You say you like to spam a bunch of ambulances, how are you doing this already? If it’s just using the spawn menu, right click the icon and copy it to clipboard. it should copy the path you need for that model.
Thank you for replying. I want a SWEP that can shoot out ambulances without using the spawn menu. Edit: THANK YOU. I just did Ctrl + V and it said models/ambulance.mdl!
Oh, didn’t see that last post.
Well, I guess since I can’t use my SWEP in GMod even though it’s in my addons folder, there must be something wrong. Here it is:
SWEP.PrintName = “Spambulance Gun”
SWEP.Author = “MrVinceDiggity”
SWEP.Instructions = “Left-click to unleash the storm!”
SWEP.Spawnable = false
SWEP.AdminOnly = true
SWEP.Primary.ClipSize = 45
SWEP.Primary.DefaultClip = 30
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = 155
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = “none”
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.Slot = 5
SWEP.SlotPos = 2
SWEP.DrawAmmo = true
SWEP.DrawCrosshair = true
SWEP.ViewModel = “models/weapons/v_pistol.mdl”
SWEP.WorldModel = “models/weapons/w_pistol.mdl”
-- This weapon is 'automatic'. This function call below defines -- the rate of fire. Here we set it to shoot every 0.5 seconds. self.Weapon:SetNextPrimaryFire( CurTime() + 0.1 ) -- Call 'SPAMBULANCE' on self with this model self:ThrowChair( "models/ambulance.mdl" )
self:Spambulance( "models/ambulance.mdl" )
function SWEP:Spambulance( model_file )
self:EmitSound( ShootSound ) if ( CLIENT ) then return end local ent = ents.Create( "prop_physics" ) if ( !IsValid( ent ) ) then return end ent:SetModel( model_file ) ent:SetPos( self.Owner:EyePos() + ( self.Owner:GetAimVector() * 16 ) ) ent:SetAngles( self.Owner:EyeAngles() ) ent:Spawn() local phys = ent:GetPhysicsObject() if ( !IsValid( phys ) ) then ent:Remove() return end local velocity = self.Owner:GetAimVector() velocity = velocity * 600
I haven’t published it on the workshop yet as gmpublish keeps closing as soon as it opens.
Please use [ lua ] and [ /lua ] to paste your code (without spaces, of course!)
Just changed it, thanks!
[editline]23rd July 2013[/editline]
Someone told me to run gmpublish from the Command Line. His/her comment got deleted or edited, but I’ve only used Command Prompt about twice. And by Command Line, do you mean the Run program? How do you open gmpublish or another similar Command Prompt program using Command Line? Sorry that I’m asking a load of questions.
Your code was missing an ‘end’ at the end, is it really missing?
No, I don’t think so, it just didn’t copy/paste all the way, I guess. Here’s the last bit of code:
velocity = velocity + ( VectorRand() * 10 ) – a random element
phys:ApplyForceCenter( velocity )
cleanup.Add( self.Owner, "props", ent ) undo.Create( "Spambulance" ) undo.AddEntity( ent ) undo.SetPlayer( self.Owner ) undo.Finish()