А как группы добавлятьПо дефолту надписи на дверях в DarkRP не существуют, ты можешь поставить этот аддон - LUA - 3D2D Door Display
Не мой скрипт, не знаю. Вероятнее всего по дефолту - в F2/RА как группы добавлять
local Door = {
["prop_door_rotating"] = true,
["func_door"] = true,
["func_door_rotating"] = true,
}
local function GetDrawPosAng(door)
local dimens = door:OBBMaxs() - door:OBBMins()
local center = door:OBBCenter()
local min, j
local lpos, lang
for i=1, 3 do
if not min or dimens[i] <= min then
j = i
min = dimens[i]
end
end
local norm = Vector()
norm[j] = 1
local lang = Angle( 0, norm:Angle().y + 90, 90 )
if door:GetClass() == "prop_door_rotating" then
lpos = Vector( center.x, center.y, center.z + 25 ) + lang:Up() * (min / 8)
else
lpos = center + Vector( 0, 0, 20 ) + lang:Up() * ((min / 2) - 0.1)
end
local ang = door:LocalToWorldAngles( lang )
local dot = ang:Up():Dot( LocalPlayer():GetShootPos() - door:WorldSpaceCenter() )
if dot < 0 then
lang:RotateAroundAxis( lang:Right(), 180 )
if door:GetClass() == "prop_door_rotating" then
lpos = Vector( center.x - min/6 - 0.1, center.y, center.z + 25 ) + lang:Up() * (min / 10^9)
else
lpos = center + Vector( 0, 0, 20 ) + lang:Up() * ((min / 2) - 0.1)
end
ang = door:LocalToWorldAngles( lang )
end
local pos = door:LocalToWorld( lpos )
local scale = 0.05
return pos, ang, scale
end
hook.Add("PostDrawTranslucentRenderables", "HUD.Identity:DoorHUD", function()
local ShouldDraw = hook.Call("HUDShouldDraw", GAMEMODE, "HUD.Identity:DoorHUD")
if ShouldDraw == false or not DarkRP then return end
for k, v in pairs( ents.GetAll() ) do
if Door[v:GetClass()] and LocalPlayer():GetPos():DistToSqr(v:GetPos()) < 50000 then
cam.Start3D2D(GetDrawPosAng(v))
v:drawDoorInfo()
cam.End3D2D()
end
end
end)
local Entity = FindMetaTable("Entity")
function Entity:drawDoorInfo()
local ply = LocalPlayer()
local blocked = self:getKeysNonOwnable()
local superadmin = ply:IsSuperAdmin()
local doorTeams = self:getKeysDoorTeams()
local doorGroup = self:getKeysDoorGroup()
local playerOwned = self:isKeysOwned() or table.GetFirstValue(self:getKeysCoOwners() or {}) ~= nil
local owned = playerOwned or doorGroup or doorTeams
local doorInfo = {}
local title = self:getKeysTitle()
if title then
surface.SetFont("HUD.Identity.DoorHUD.Title")
local w = surface.GetTextSize(title) + 10
--HUD.DrawRect(-w/2,50,w,150)
draw.SimpleText(title, "HUD.Identity.DoorHUD.Title", 0, 50+150/2, Color(255,255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
end
if owned then
table.insert(doorInfo, DarkRP.getPhrase("keys_owned_by"))
end
if playerOwned then
if self:isKeysOwned() then table.insert(doorInfo, self:getDoorOwner():Nick()) end
for k in pairs(self:getKeysCoOwners() or {}) do
local ent = Player(k)
if not IsValid(ent) or not ent:IsPlayer() then continue end
table.insert(doorInfo, ent:Nick())
end
local allowedCoOwn = self:getKeysAllowedToOwn()
if allowedCoOwn and not fn.Null(allowedCoOwn) then
table.insert(doorInfo, DarkRP.getPhrase("keys_other_allowed"))
for k in pairs(allowedCoOwn) do
local ent = Player(k)
if not IsValid(ent) or not ent:IsPlayer() then continue end
table.insert(doorInfo, ent:Nick())
end
end
elseif doorGroup then
table.insert(doorInfo, doorGroup)
elseif doorTeams then
for k, v in pairs(doorTeams) do
if not v or not RPExtraTeams[k] then continue end
table.insert(doorInfo, RPExtraTeams[k].name)
end
elseif not blocked then
table.insert(doorInfo, HUD.GetLanguage("Unowned"))
end
local text = table.concat(doorInfo, "\n")
surface.SetFont("HUD.Identity.DoorHUD.Text")
local w = surface.GetTextSize(text) + 10
local h = table.Count(doorInfo) * 80
if #doorInfo > 0 then
--HUD.DrawRect(-w/2,200 + 10,w,h)
draw.DrawNonParsedText(text, "HUD.Identity.DoorHUD.Text", 0 , 200 + 10 , Color(255,255,255,255), TEXT_ALIGN_CENTER)
end
end
local open = HUD.Settings.DoorUnLockIcon
local close = HUD.Settings.DoorLockIcon
hook.Add("HUDDrawDoorData", "HUD.Identity:RemoveDoorHUD", function(ent)
local ShouldDraw = hook.Call("HUDShouldDraw", GAMEMODE, "HUD.Identity:DoorStateHUD")
if ShouldDraw == false then return HUD.Settings.DefaultDoorHUD end
local ply = LocalPlayer()
local Team = ply:Team()
local group = ent:getKeysDoorGroup()
local teamOwn = ent:getKeysDoorTeams()
local doorData = ent:getDoorData()
if ent:isKeysOwnedBy(ply) or (group and table.HasValue(RPExtraTeamDoors[group] or {}, Team)) or (teamOwn and teamOwn[Team]) then
local icon = doorData.islock and close or open
HUD.DrawIconInfo(ScrW()/2 - 42/2, ScrH()/1.1, 42, 42, icon)
end
if ent:getKeysNonOwnable() and LocalPlayer():IsSuperAdmin() then
draw.DrawNonParsedText(DarkRP.getPhrase("keys_allow_ownership"), "TargetID", ScrW()/2, ScrH()/1.1, Color(255,255,255,255), 1)
end
return HUD.Settings.DefaultDoorHUD
end)
сделай как тут
Apache:local Door = { ["prop_door_rotating"] = true, ["func_door"] = true, ["func_door_rotating"] = true, } local function GetDrawPosAng(door) local dimens = door:OBBMaxs() - door:OBBMins() local center = door:OBBCenter() local min, j local lpos, lang for i=1, 3 do if not min or dimens[i] <= min then j = i min = dimens[i] end end local norm = Vector() norm[j] = 1 local lang = Angle( 0, norm:Angle().y + 90, 90 ) if door:GetClass() == "prop_door_rotating" then lpos = Vector( center.x, center.y, center.z + 25 ) + lang:Up() * (min / 8) else lpos = center + Vector( 0, 0, 20 ) + lang:Up() * ((min / 2) - 0.1) end local ang = door:LocalToWorldAngles( lang ) local dot = ang:Up():Dot( LocalPlayer():GetShootPos() - door:WorldSpaceCenter() ) if dot < 0 then lang:RotateAroundAxis( lang:Right(), 180 ) if door:GetClass() == "prop_door_rotating" then lpos = Vector( center.x - min/6 - 0.1, center.y, center.z + 25 ) + lang:Up() * (min / 10^9) else lpos = center + Vector( 0, 0, 20 ) + lang:Up() * ((min / 2) - 0.1) end ang = door:LocalToWorldAngles( lang ) end local pos = door:LocalToWorld( lpos ) local scale = 0.05 return pos, ang, scale end hook.Add("PostDrawTranslucentRenderables", "HUD.Identity:DoorHUD", function() local ShouldDraw = hook.Call("HUDShouldDraw", GAMEMODE, "HUD.Identity:DoorHUD") if ShouldDraw == false or not DarkRP then return end for k, v in pairs( ents.GetAll() ) do if Door[v:GetClass()] and LocalPlayer():GetPos():DistToSqr(v:GetPos()) < 50000 then cam.Start3D2D(GetDrawPosAng(v)) v:drawDoorInfo() cam.End3D2D() end end end) local Entity = FindMetaTable("Entity") function Entity:drawDoorInfo() local ply = LocalPlayer() local blocked = self:getKeysNonOwnable() local superadmin = ply:IsSuperAdmin() local doorTeams = self:getKeysDoorTeams() local doorGroup = self:getKeysDoorGroup() local playerOwned = self:isKeysOwned() or table.GetFirstValue(self:getKeysCoOwners() or {}) ~= nil local owned = playerOwned or doorGroup or doorTeams local doorInfo = {} local title = self:getKeysTitle() if title then surface.SetFont("HUD.Identity.DoorHUD.Title") local w = surface.GetTextSize(title) + 10 --HUD.DrawRect(-w/2,50,w,150) draw.SimpleText(title, "HUD.Identity.DoorHUD.Title", 0, 50+150/2, Color(255,255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) end if owned then table.insert(doorInfo, DarkRP.getPhrase("keys_owned_by")) end if playerOwned then if self:isKeysOwned() then table.insert(doorInfo, self:getDoorOwner():Nick()) end for k in pairs(self:getKeysCoOwners() or {}) do local ent = Player(k) if not IsValid(ent) or not ent:IsPlayer() then continue end table.insert(doorInfo, ent:Nick()) end local allowedCoOwn = self:getKeysAllowedToOwn() if allowedCoOwn and not fn.Null(allowedCoOwn) then table.insert(doorInfo, DarkRP.getPhrase("keys_other_allowed")) for k in pairs(allowedCoOwn) do local ent = Player(k) if not IsValid(ent) or not ent:IsPlayer() then continue end table.insert(doorInfo, ent:Nick()) end end elseif doorGroup then table.insert(doorInfo, doorGroup) elseif doorTeams then for k, v in pairs(doorTeams) do if not v or not RPExtraTeams[k] then continue end table.insert(doorInfo, RPExtraTeams[k].name) end elseif not blocked then table.insert(doorInfo, HUD.GetLanguage("Unowned")) end local text = table.concat(doorInfo, "\n") surface.SetFont("HUD.Identity.DoorHUD.Text") local w = surface.GetTextSize(text) + 10 local h = table.Count(doorInfo) * 80 if #doorInfo > 0 then --HUD.DrawRect(-w/2,200 + 10,w,h) draw.DrawNonParsedText(text, "HUD.Identity.DoorHUD.Text", 0 , 200 + 10 , Color(255,255,255,255), TEXT_ALIGN_CENTER) end end local open = HUD.Settings.DoorUnLockIcon local close = HUD.Settings.DoorLockIcon hook.Add("HUDDrawDoorData", "HUD.Identity:RemoveDoorHUD", function(ent) local ShouldDraw = hook.Call("HUDShouldDraw", GAMEMODE, "HUD.Identity:DoorStateHUD") if ShouldDraw == false then return HUD.Settings.DefaultDoorHUD end local ply = LocalPlayer() local Team = ply:Team() local group = ent:getKeysDoorGroup() local teamOwn = ent:getKeysDoorTeams() local doorData = ent:getDoorData() if ent:isKeysOwnedBy(ply) or (group and table.HasValue(RPExtraTeamDoors[group] or {}, Team)) or (teamOwn and teamOwn[Team]) then local icon = doorData.islock and close or open HUD.DrawIconInfo(ScrW()/2 - 42/2, ScrH()/1.1, 42, 42, icon) end if ent:getKeysNonOwnable() and LocalPlayer():IsSuperAdmin() then draw.DrawNonParsedText(DarkRP.getPhrase("keys_allow_ownership"), "TargetID", ScrW()/2, ScrH()/1.1, Color(255,255,255,255), 1) end return HUD.Settings.DefaultDoorHUD end)
Лог ошибок должен быть в виде текста и 1 строкой.