Trying to find some help with SWEP's - searching isn't any help.

I’m trying to figure out how to do a couple things. How would I check to see if the player’s weapon is reloading, and how would I change deploy speed? “self:SetDeploySpeed( )” doesn’t seem to be working when I throw any number in it. (I’m also shoving it into my initialize code)

My best guess would be sticking a self.Reloading or whatever into the reload function and have a timer to reset it, then you can check for self.Reloading.
If I’m wrong well then feel free to rate me dumb and correct me.

Hey guys! I figured out a solution.

Create a SWEP.Reloading variable, and then in SWEP:Reload( ), throw in:


self.Reloading = ( CurTime( ) + self.Owner:GetViewModel():SequenceDuration() )

If you want to prevent something from running if the player is reloading, use this.


self.Reloading < CurTime( )

That’ll give you the core functionality, but if you would like a function for it, create the SWEP.Reloading variable, then do this:


function SWEP:IsReloading( )
	if self.Reloading > CurTime( ) then
		return true
	else
		return false
	end
end

SWEP:IsReloading( ) will return true if the reload animation is playing. I’m using this to prevent the player from running or aiming down sights if the player is reloading.

I would still like a way to stretch the deploy animation, if possible.

You can just do:
[lua]
return self.Reloading >= CurTime()
[/lua]

For the deploy speed you would use:
[lua]
–Use this inside SWEP:Initialize()
self:SetDeploySpeed(self.DeploySpeed)
[/lua]

Thanks dude. I found out that the stuff mentioned in this thread works for reload speed as well:

http://forum.facepunch.com/showthread.php?t=1087321

Marking this as solved!