Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 12th, 2012  |  syntax: None  |  size: 1.04 KB  |  hits: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. AddChatCommand("/toggleownable", SetDoorOwnable)
  2.  
  3. local time3 = false
  4. local function SetDoorGroupOwnable(ply, arg)
  5.         if time3 then return "" end
  6.         time3 = true
  7.         timer.Simple(0.1, function()  time3 = false end)
  8.         local trace = ply:GetEyeTrace()
  9.         if not ValidEntity(trace.Entity) then return "" end
  10.  
  11.         local ent = trace.Entity
  12.         if not ply:IsSuperAdmin() or (not ent:IsDoor() and not ent:IsVehicle()) or ply:GetPos():Distance(ent:GetPos()) > 115 then return end
  13.  
  14.         if not RPExtraTeamDoors[arg] and arg ~= "" then GAMEMODE:Notify(ply, 1, 10, "Door group does not exist!") return "" end
  15.         if ValidEntity( trace.Entity:GetDoorOwner() ) then
  16.                 trace.Entity:UnOwn( trace.Entity:GetDoorOwner() )
  17.         end
  18.  
  19.         ent.DoorData = ent.DoorData or {}
  20.         ent.DoorData.TeamOwn = nil
  21.         ent.DoorData.GroupOwn = arg
  22.         if arg == "" then ent.DoorData.GroupOwn = nil ent.DoorData.TeamOwn = nil end
  23.         GAMEMODE:Notify(ply, 0, 8, "Door group set successfully")
  24.         -- Save it for future map loads
  25.         DB.StoreGroupDoorOwnability(ent)
  26.  
  27.         ent:UnOwn()
  28.         ply.LookingAtDoor = nil
  29.         return ""
  30. end