if-Condition inside disguiserShootFX handler fails terribly.

master
Icedream 2013-12-21 00:16:59 +01:00
parent 6a537cd924
commit 88e00c13e1
2 changed files with 6 additions and 3 deletions

View File

@ -26,14 +26,16 @@
*/ */
usermessage.Hook("disguiserShootFX", function(um) usermessage.Hook("disguiserShootFX", function(um)
print("[Disguiser] Received disguiserShootFX")
local hitpos = um:ReadVector() local hitpos = um:ReadVector()
local hitnormal = um:ReadVectorNormal() local hitnormal = um:ReadVectorNormal()
local entity = um:ReadEntity() local entity = um:ReadEntity()
local physbone = um:ReadLong() local physbone = um:ReadLong()
local bFirstTimePredicted = um:ReadBool() local bFirstTimePredicted = um:ReadBool()
// Player and weapon valid? // Can we trigger shoot effect yet?
if !IsValid(LocalPlayer()) || !IsValid(LocalPlayer():GetActiveWeapon()) || !!LocalPlayer():GetActiveWeapon().DoShootEffect then return false end if !LocalPlayer():GetActiveWeapon().DoShootEffect then return false end
// Render shoot effect // Render shoot effect
LocalPlayer():GetActiveWeapon("disguiser"):DoShootEffect( LocalPlayer():GetActiveWeapon("disguiser"):DoShootEffect(

View File

@ -115,7 +115,8 @@ end
function SWEP:DoShootEffect(hitpos, hitnormal, entity, physbone, bFirstTimePredicted) function SWEP:DoShootEffect(hitpos, hitnormal, entity, physbone, bFirstTimePredicted)
if SERVER then if SERVER then
umsg.Start("disguiserShootFX") print("[Disguiser] Triggering disguiserShootFX on client " .. self.Owner:Name())
umsg.Start("disguiserShootFX", self.Owner)
umsg.Vector(hitpos) umsg.Vector(hitpos)
umsg.VectorNormal(hitnormal) umsg.VectorNormal(hitnormal)
umsg.Entity(entity) umsg.Entity(entity)