Hi guys it drives me crazy when people are firing their weapons before the round starts. Is there a way to stop this from happening. Is there a little bit of code i can but in the base?
Thanks in advance guys you have always been really helpful.
-Matt
Put this into the weapon base, inside function SWEP:CanPrimaryAttack()
[code]
if GetRoundState() == ROUND_PREP then
self:DryFire(self.SetNextPrimaryFire)
return false
end
[/code]
[QUOTE=Yashirmare;49257200]Put this into the weapon base, inside function SWEP:CanPrimaryAttack()
[code]
if GetRoundState() == ROUND_PREP then
self:DryFire(self.SetNextPrimaryFire)
return false
end
[/code][/QUOTE]
If you use this, add a weapon check.
There's nothing wrong with people firing a crowbar, what if there's a breakable block on the map? It could kinda ruin the point of pre-round when misused.
Already checked, doesn't effect the crowbar.
wow guys thanks. ill give it a shot and report back.
[editline]7th December 2015[/editline]
I did this and it does not work. did i format wrong?
[CODE]--[[---------------------------------------------------------
Name: SWEP:CanPrimaryAttack( )
Desc: Helper function for checking for no ammo
-----------------------------------------------------------]]
function SWEP:CanPrimaryAttack()
if ( self.Weapon:Clip1() <= 0 ) then
self:EmitSound( "Weapon_Pistol.Empty" )
self:SetNextPrimaryFire( CurTime() + 0.2 )
self:Reload()
return false
end
if GetRoundState() == ROUND_PREP then
self:DryFire(self.SetNextPrimaryFire)
return false
end
return true
end[/CODE]
Put it directly below SWEP:CanPrimaryAttack().
Edit: Um, you've just put it in the weapon, you need to put it in the base (weapon_tttbase.lua)
do you know the file path for that file?
edit: the file path i but this in was garrysmod/gamemode/base/entities/weapons/weapon_base/shared.lua
Well you're editing ttt, so it'll be garrysmod/gamemodes/terrortown/entites/weapons/weapon_tttbase.lua
working perfect thanks guys.
Sorry, you need to Log In to post a reply to this thread.