
Untitled
By: a guest on
May 12th, 2012 | syntax:
None | size: 1.04 KB | hits: 18 | expires: Never
AddChatCommand("/toggleownable", SetDoorOwnable)
local time3 = false
local function SetDoorGroupOwnable(ply, arg)
if time3 then return "" end
time3 = true
timer.Simple(0.1, function() time3 = false end)
local trace = ply:GetEyeTrace()
if not ValidEntity(trace.Entity) then return "" end
local ent = trace.Entity
if not ply:IsSuperAdmin() or (not ent:IsDoor() and not ent:IsVehicle()) or ply:GetPos():Distance(ent:GetPos()) > 115 then return end
if not RPExtraTeamDoors[arg] and arg ~= "" then GAMEMODE:Notify(ply, 1, 10, "Door group does not exist!") return "" end
if ValidEntity( trace.Entity:GetDoorOwner() ) then
trace.Entity:UnOwn( trace.Entity:GetDoorOwner() )
end
ent.DoorData = ent.DoorData or {}
ent.DoorData.TeamOwn = nil
ent.DoorData.GroupOwn = arg
if arg == "" then ent.DoorData.GroupOwn = nil ent.DoorData.TeamOwn = nil end
GAMEMODE:Notify(ply, 0, 8, "Door group set successfully")
-- Save it for future map loads
DB.StoreGroupDoorOwnability(ent)
ent:UnOwn()
ply.LookingAtDoor = nil
return ""
end