ULX

Author Topic: Physgun freeze player  (Read 3526 times)

0 Members and 1 Guest are viewing this topic.

Offline BobTheDuck69

  • Newbie
  • *
  • Posts: 33
  • Karma: 1
Physgun freeze player
« on: March 12, 2015, 12:56:01 PM »
Would it be possible to make a version of the code i found here tell admins that an admin has frozen someone with it?
Code: [Select]
function FGod( ply, dmginfo )
if(ply:GetNetworkedVar("FGod") == 1) then
dmginfo:ScaleDamage( 0 )
end
end
hook.Add("EntityTakeDamage", "FGod", FGod)

hook.Add("PhysgunDrop", "ply_physgunfreeze", function(pl, ent)
hook.Remove( "PhysgunDrop", "ulxPlayerDrop" ) --This hook from ULX seems to break this script that's why we are removing it here.

ent._physgunned = false

if( ent:IsPlayer() ) then             
-- predicted?
ent:SetMoveType(pl:KeyDown(IN_ATTACK2) and MOVETYPE_NOCLIP or MOVETYPE_WALK)

if(pl:KeyDown(IN_ATTACK2)) then
ent:Freeze(true)
ent:SetNetworkedVar("FGod", 1)
else
ent:Freeze(false)
ent:SetNetworkedVar("FGod", 0)
end
   
if SERVER then
-- NO UUUU FKR
if !ent:Alive() then
ent:Spawn()
self:PlayerSpawn(ent)
ent:SetPos(pl:GetEyeTrace().HitPos)
end
end

return --self.BaseClass:PhysgunDrop( pl , ent )   
end
end)

hook.Add( "PhysgunPickup", "ply_physgunned", function(pl, ent)
ent._physgunned = true
end)

function playerDies( pl, weapon, killer )
if(pl._physgunned) then
return false
else
return true
end
end
hook.Add( "CanPlayerSuicide", "playerNoDeath", playerDies )
~The friendly neighborhood duckie~

Offline Bytewave

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 718
  • Karma: 116
  • :)
    • My Homepage
Re: Physgun freeze player
« Reply #1 on: March 12, 2015, 01:01:18 PM »
I assume you're looking to tell the frozen player they've been frozen?
If so, Player:ChatPrint() is your friend in this case.
bw81@ulysses-forums ~ % whoami
Homepage

Offline BobTheDuck69

  • Newbie
  • *
  • Posts: 33
  • Karma: 1
Re: Physgun freeze player
« Reply #2 on: March 12, 2015, 01:02:30 PM »
I need it to display globally is that how it works?
~The friendly neighborhood duckie~

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given