Is there any way to cancel firing while drawing the weapon? I'm trying to make it work by adding a timer to the SWEP:Deploy function that makes fire primary return false during half a second or so but it doesn't work.
Is there any way to draw a crosshair when you press right click?
And the gun muzzle flash is not showing, what could be the problem?
(BTW I'm using the default SWEP base)
SWEP:DrawHUD ....
// TAKEN FROM CS BASE
if(self.Owner:KeyDown(IN_ATTACK2) then // I JUST ONLY ADDED THAT CONDITION MAN
surface.SetDrawColor( 0, 255, 0, 255 )
// Draw an awesome crosshair
local gap = 40 * scale
local length = gap + 20 * scale
surface.DrawLine( x - length, y, x - gap, y )
surface.DrawLine( x + length, y, x + gap, y )
surface.DrawLine( x, y - length, x, y - gap )
surface.DrawLine( x, y + length, x, y + gap )
end
This is for crosshair. CUSTOM CROSSHAIR. If you want disable/enable default crosshair use self.DrawCrosshair variable
Recoil:
// Punch the crosshair
if ( (game.SinglePlayer() && SERVER) || ( !game.SinglePlayer() && CLIENT && IsFirstTimePredicted() ) ) then
local eyeang = self.Owner:EyeAngles() else
eyeang.pitch = eyeang.pitch - self.Primary.RecoilX // just add these two variables.. try with some values
eyeang.yaw = eyeang.yaw - self.Primary.RecoilY // JUST COPIED FROM MY SWEP and you have something to learn
end
self.Owner:SetEyeAngles( eyeang )
end
For rest of your questions find on forum, there are answers. For muzzle flash find for "custom muzzle flash swep" or something similiar. You will find the right answer.
For canceling primary attack just add in deploy function: self:SetNextPrimaryFire(CurTime() + any number here)
Thank you very much for helping!
Sorry, you need to Log In to post a reply to this thread.