Author Topic: Want someone to tell me how to re-write this code to work  (Read 1488 times)

0 Members and 1 Guest are viewing this topic.

Offline PwndKilled

  • Newbie
  • *
  • Posts: 19
  • Karma: -1
Want someone to tell me how to re-write this code to work
« on: February 12, 2015, 02:57:44 AM »
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() && ( pl:IsUserGroup( "superadmin" ) or pl:IsUserGroup( "admin" )) ) then     --If you want to insert another one insert "or pl:IsUserGroup( "YetAnotherGroup" )"       
-- predicted?

if(pl:KeyDown(IN_ATTACK2)) then
ent:Freeze(true)
ent:SetNetworkedVar("FGod", 1)
ent:SetMoveType(MOVETYPE_NOCLIP)
else
ent:Freeze(false)
ent:SetNetworkedVar("FGod", 0)
ent:SetMoveType(MOVETYPE_WALK)
end



if SERVER then
-- NO UUUU FKR
if !ent:Alive() then
ent:Spawn()
self:PlayerSpawn(ent)
ent:SetPos(pl:GetEyeTrace().HitPos)
end
end

else -- If it wasn't an admin in your defined groups then don't do anything
ent:Freeze(false)
ent:SetNetworkedVar("FGod", 0)
ent:SetMoveType(MOVETYPE_WALK)

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 )

I get error everytime i freeze somebody..it's annoying

source: http://forums.ulyssesmod.net/index.php?topic=6173.0
« Last Edit: February 12, 2015, 03:45:10 PM by JamminR »

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Want someone to tell me how to re-write this code to work
« Reply #1 on: February 12, 2015, 03:49:28 PM »
I modified your title, because it seems clear you don't want help so much as to have someone tell you how to code it.
First you bump another discussion in which 2 reasons are left why it's likely not working, then you double post the same question elsewhere.
If I weren't so tired right now that I'm worried my judgement is impaired, I'd be banning you a week for doing that just because of the annoyance factor.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming