Author Topic: help  (Read 1826 times)

0 Members and 1 Guest are viewing this topic.

Offline TheNoobKid

  • Newbie
  • *
  • Posts: 25
  • Karma: -1
help
« on: March 04, 2016, 08:55:41 PM »
Hello.

How can I do so only rank 'owner' and 'superadmin' can use this:

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 )

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
Re: help
« Reply #1 on: March 05, 2016, 05:35:50 AM »
At the top you can do like

If ply:GetUserGroup() ~= "owner" then return end

Offline Caustic Soda-Senpai

  • Sr. Member
  • ****
  • Posts: 469
  • Karma: 54
  • <Insert something clever here>
    • Steam Page
Re: help
« Reply #2 on: March 12, 2016, 04:44:22 AM »
assuming owner inherits from superadmin (which it should....even then...ew..owner..), you can easily do if ply:IsSuperAdmin()
Once you get to know me, you'll find you'll have never met me at all.