General > Developers Corner

ULX Physgun

<< < (2/3) > >>

Joram:
Because we are using it now it's really usefull for grabbing a minge quickly and freeze them, But I would like to restrict ranks to it

Neku:
bind b "ulx freeze @"

That'll freeze whoever you're looking at.

Joram:
Waw didn't know about that one!

But I modified it (It's alot for me)
it's probally shitty but people may be worse then me so:


--- Code: ---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( "YourAdminGroupHere" ) or pl:IsUserGroup( "YourSecondAdminGroupHere" )) ) 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 )
--- End code ---

007section1:
which lua file folder should i do it in ive tried the gmod lua then the gmod ulib how do i do it im really stuck

LuaTenshi:
I have updated the code above, it should now work for everyone. Without even having to remove the hooks from ULX!

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version