Is there a Taser that does not ragdoll but just freeze/slow.
4 replies, posted
I was wondering about this because when you taze a player, they loose their weapons ect and overall just having the Taser to ragdoll someone is a OP advantage.
So I was wondering has anyone came across a Taser that freezes or Slows the player temporarily?
Has someone here maybe made one that does it?
Just edit the taser that ragdolls to slow the player using SetWalkSpeed().
Uhh sorry I am a Noob at Lua...where exactly should I replace it?
[QUOTE]function SWEP:PrimaryAttack()
if ( !self:CanPrimaryAttack() ) then return end
local eyetrace = self.Owner:GetEyeTrace()
if !eyetrace.Entity:IsPlayer() then return end
if eyetrace.Entity:IsFrozen() then
ULib.tsayError( self.Owner, eyetrace.Entity:Nick() .. " is frozen!", true )
return
end
local dist = self.Owner:EyePos():Distance(eyetrace.Entity:GetPos())
--[[
If the distance between the taser owner and the target is above the maximum,
returns nothing and create a message in the HUD, what will make the weapon doesn't shoot.
]]
if dist > Distance:GetFloat() and not self.Owner:TaserAdmin() then
self.Owner:PrintMessage( HUD_PRINTCENTER, "Too Far Away")
return
end
if (!SERVER) then return end
if eyetrace.Entity:IsPlayer() then
self:EmitSound( "Weapon_StunStick.Activate" )
self:tasePlayer(eyetrace.Entity, self.Owner)
end
end
function SWEP:tasePlayer(ply, shooter)
local logtext = shooter:Nick().." tased "..ply:Nick().."\n"
local eyetrace = self.Owner:GetEyeTrace()
if eyetrace.Entity:TaserAdmin() and self.Owner:IsCP() then
self.Owner:PrintMessage( HUD_PRINTCENTER, AdminText:GetString())
return end
if self.Owner:IsCP() and eyetrace.Entity:IsCP() then
self.Owner:PrintMessage( HUD_PRINTCENTER, CopText:GetString())
return end
-- create ragdoll
local rag = ents.Create( "prop_ragdoll" )
if not rag:IsValid() then return end
-- Logs the taze to every possible place
DB.Log(logtext)
ServerLog(logtext)
Msg(logtext)
ulx.fancyLogAdmin( shooter, "#A tased #P", ply )
rag:SetModel( ply:GetModel() )
rag:SetPos( ply:GetPos())
rag:SetAngles(ply:GetAngles())
-- player vars
rag.taseredply = ply
rag.taseredplyhp = ply:Health()
rag.taseredplyarmor = ply:Armor()
rag.taseredplymodel = ply:GetModel()
rag.taseredplyweps = {}
ply:DisallowNoclip( true )
ply:DisallowMoving( true )
ply:DisallowSpawning( true )
ply:DisallowVehicles( true )
table.insert(taseredrags, rag)
-- "remove" player
ply:DrawViewModel(false)
ply:DrawWorldModel(false)
ply:Spectate(OBS_MODE_CHASE)
ply:SpectateEntity(rag)
rag:CPPISetOwner(ply)
for k,v in pairs(ply:GetWeapons()) do
local class = v:GetClass()
ply:StripWeapon(v:GetClass())
table.insert(rag.taseredplyweps, {v:GetClass(), ply:GetAmmoCount(v:GetPrimaryAmmoType()),
v:GetPrimaryAmmoType(), ply:GetAmmoCount(v:GetSecondaryAmmoType()), v:GetSecondaryAmmoType(),
v:Clip1(), v:Clip2()})
end
-- Damage player while down
local function DamageTasereds(ent, dmginfo)
local amount = dmginfo:GetDamage()
local attacker = dmginfo:GetAttacker()
local v = ent.taseredply
if attacker == game.GetWorld() then return end
v:SetHealth(v:Health() - amount)
ent.taseredplyhp = v:Health()
if v:Health() <= 0 and v:Alive() then
v:DisallowNoclip( false )
v:DisallowMoving( false )
v:DisallowSpawning( false )
v:DisallowVehicles( false )
v:SetParent()
v:UnSpectate()
ent:Remove()
v:SetPos(ent:GetPos())
v:Kill()
timer.Destroy("taseredrags"..v:SteamID())
hook.Remove("EntityTakeDamage", "Tasedamage")
end
end
hook.Add("EntityTakeDamage", "Tasedamage", DamageTasereds)
-- finalize ragdoll
rag:Spawn()
rag:Activate()
rag:DisallowMoving( true )
rag:SetCollisionGroup( COLLISION_GROUP_WEAPON )
-- make ragdoll fall
rag:GetPhysicsObject():SetVelocity(4*ply:GetVelocity())
-- bring the motherfucker back
timer.Create("taseredrags"..ply:SteamID(), Timer:GetFloat(), 0, function() self:taserevive(rag) end)
if not self.Owner:TaserAdmin() then
self:SetNextPrimaryFire( CurTime() + Delay:GetFloat() )
end [/QUOTE]
If it hurts the player, fine. I just need him to slow down heaps. Also maybe to make it that he does not loose his weapons (As ragdolling does that..)
Change
ents.Create( "prop_ragdoll" )
to it
Here is all of the code:
[code]
function SWEP:PrimaryAttack()
if ( !self:CanPrimaryAttack() ) then return end
local eyetrace = self.Owner:GetEyeTrace()
if !eyetrace.Entity:IsPlayer() then return end
if eyetrace.Entity:IsFrozen() then
ULib.tsayError( self.Owner, eyetrace.Entity:Nick() .. " is frozen!", true )
return
end
local dist = self.Owner:EyePos():Distance(eyetrace.Entity:GetPos())
--[[
If the distance between the taser owner and the target is above the maximum,
returns nothing and create a message in the HUD, what will make the weapon doesn't shoot.
]]
if dist > Distance:GetFloat() and not self.Owner:TaserAdmin() then
self.Owner:PrintMessage( HUD_PRINTCENTER, "Too Far Away")
return
end
if (!SERVER) then return end
if eyetrace.Entity:IsPlayer() then
self:EmitSound( "Weapon_StunStick.Activate" )
self:tasePlayer(eyetrace.Entity, self.Owner)
end
end
function SWEP:tasePlayer(ply, shooter)
local logtext = shooter:Nick().." tased "..ply:Nick().."\n"
local eyetrace = self.Owner:GetEyeTrace()
if eyetrace.Entity:TaserAdmin() and self.Owner:IsCP() then
self.Owner:PrintMessage( HUD_PRINTCENTER, AdminText:GetString())
return end
if self.Owner:IsCP() and eyetrace.Entity:IsCP() then
self.Owner:PrintMessage( HUD_PRINTCENTER, CopText:GetString())
return end
-- Logs the taze to every possible place
DB.Log(logtext)
ServerLog(logtext)
Msg(logtext)
ulx.fancyLogAdmin( shooter, "#A tased #P", ply )
-- player vars
ply:DisallowNoclip( true )
ply:DisallowMoving( true )
ply:DisallowSpawning( true )
ply:DisallowVehicles( true )
ply:SetWalkSpeed(50) -- Sets the speed to 1/2 of the normal run/walk speed
-- bring the motherfucker back
timer.Create("taseredrags"..ply:SteamID(), Timer:GetFloat(), 0, function() self:SetWalkSpeed(100) end)
if not self.Owner:TaserAdmin() then
self:SetNextPrimaryFire( CurTime() + Delay:GetFloat() )
end
function SWEP:taserevive()
end
function SWEP:SecondaryAttack()
end
local playerMeta = FindMetaTable("Player")
function playerMeta:TaserAdmin()
if not IsValid(self) then return false end
return self:Team()==TEAM_STAFF or self:Team()==TEAM_ADMIN or self:Team()==TEAM_OWNER or self:Team()==TEAM_MOD
end
[/code]
Set's the players walk speed to 50, when the tazer time is up it will set it back to 100.
Replace everything in the shared.lua with this. Untested, should work though.
Sorry, you need to Log In to post a reply to this thread.