• Trouble with my timer, and with GetEyeTrace.
    0 replies, posted
Okay this is only bits of the code, so if you see what I'm doing wrong or need more info, let me know. First of all, the timers don't seem to be working. Second of all, the tazedPlayer:ConCommand("pp_motionblur 1") also blurs me. Nothing else happens to me like the hud print, only the motion blur. [lua] eyeTrace = self.Owner:GetEyeTrace() if !eyeTrace.Entity:IsPlayer() then return end [/lua] ------------------------------------------------------------------------------------------------------------- [lua] if eyeTrace.Entity:IsPlayer() then self.Weapon:EmitSound("Weapon_StunStick.Activate") self:tasePlayer(eyeTrace.Entity) self.BaseClass.ShootEffects(self) SetGlobalInt("reloadTimer",CurTime()+10) SetGlobalInt("tazedTimer",CurTime()+5) tazedPlayer = eyeTrace.Entity oldModel = eyeTrace.Entity:GetMaterial() end [/lua] ------------------------------------------------------------------------------------------------------------- [lua] function SWEP:tasePlayer(tazedPlayer) if ( CurTime() < GetGlobalInt("tazedTimer") ) then tazedPlayer:SetMoveType(MOVETYPE_NONE) tazedPlayer:ConCommand("pp_motionblur 1") tazedPlayer:PrintMessage(HUD_PRINTCENTER, "You got tased bro.") tazedPlayer:SetMaterial( "models/alyx/emptool_glow" ) end if ( CurTime() > GetGlobalInt("tazedTimer") ) then tazedPlayer:SetMoveType(MOVETYPE_WALK) tazedPlayer:ConCommand("pp_motionblur 0") tazedPlayer:SetMaterial( oldModel ) end end [/lua]
Sorry, you need to Log In to post a reply to this thread.