Guns floating in air!?

Hey… Recently I updated all my SWEP’s and also renamed the file names from jb_<gunname> to weapon_<gunname> so the guns spawn in the armory on a map without having to plot down cords on a txt files for every single gun. But the bottom of guns offend get stuck in the walls when spawning and you can’t even shoot them to move them. With guns that don’t get stuck they can be shot around the place and also don’t float in air. Is there a way I can make the guns un-stuck them selfs?

It has nothing to do with missing CSS content so don’t even go there.

have you tried changing the file names back to jb_<gunname>?

No I don’t want to do that… But… With the original swep pack even if they were stuck in something they would fly around, un-stuck themselfs and bang on the walls then fall to the ground. Then it would be fine. But these ones just stay stuck. Is there like a script I could use to make them unstuck themselfs.

You never included whether these are custom models, Half-Life 2 Models, or CS:S.

Did you ever stop to think that MAYBE the server doesn’t have the models and that it thinks of them as errors; which would give them no physics thus making them appear to float to clients who can see the models.

This is what’s causing your problem.

No as you see I did say I have CS:S installed meaning that I am only using CS models… Also if you read it properly I said that the same gun sometimes floats depending on where I pick it up. It only happens if the gun spawned with the tail in the ground or something. I just need to know how I can make it so the guns push them selfs out and fly around

Nobody know?

Can you spawn and use CS:S gun models in sandbox on your server?
There might be coding in jb gamemode that freezes all guns at all times, so they don’t fall to ground out of weapon racks, etc.

I have been havng this problem on ttt guns running on a custom bsae. They have propper physics models and we certainly have CSS mounted, but every once and a while they just float in the air and their reload animations break. It’s as if CSS isn’t mounted, but I ask my host’s tech support and they say that is"

I have CSS. Its just with when I change my sweps! My JB Sweps used to unstuck them selfs by being pushed out of stuck places. If these have come off of a wall and they were probably slightly stuck into it then they float! On maps that spawn them in when clicking E and the object, they dont.

Adding more exclamation points isn’t going to help the problem get solved.

Did I ask for your personal opinion on how I write sometimes?

I have actually ran into this exact problem, so here’s the fix for ya. Somewhere in your SWEP base, or in each individual weapon, there should be a function called SWEP:AcceptInput. It’s serverside. If there isn’t just copy my code. So you want to have this code inside your SWEP to fix that:



function SWEP:AcceptInput( name, activator, caller, data )
	if ( name == "ConstraintBroken" && self:HasSpawnFlags( 1 ) ) then
		local phys = self:GetPhysicsObject()
		if ( IsValid( phys ) ) then phys:Sleep() end
	
		local newflags = bit.band( self:GetSpawnFlags(), bit.bnot( 1 ) )
		self:SetKeyValue("spawnflags", newflags)

	end
	-- Whatever other code you have in this function
end

It worked! Thanks man!