Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DC_CORE=DC_CORE or{}if not ix then CreateConVar("dc_drawhelp","1",FCVAR_ARCHIVE,"Отображать подсказки сервера?",0,1)end local a={}local b={}for class,l in pairs(scripted_ents.GetList())do if l.t and l.t.helptext then a[class]=true end end hook.Add("OnEntityCreated","DC_OnEntityCreatedHelp",function(l)if l.helptext and a[class]==nil then a[l:GetClass()]=true end end)local c=ix and ix.config.Get("color")or Color(0,255,0)local d=color_white local e={}local f=ix and"ixItemBoldFont"or PIXEL.Scale(24).." Capture It"local g=false local function h()if g or GetConVar("dc_drawhelp"):GetInt()~=1 then return end for l,m in pairs(e)do if m then local n=m.IsValid and m:IsValid()and m:GetPos()or m.pos+Vector(0,0,10)local o=m.IsValid and m:IsValid()and m.helptext or m.text if LocalPlayer():GetPos():DistToSqr(n)>250000 then continue end if m.IsValid and m:IsValid()then hook.Add("PreDrawHalos","DC_DrawHalos",function()halo.Add({m},c,5,5,4,false,true)end)end local p,q=ScrW(),ScrH()hook.Add("HUDPaint","DC_DrawHelpText",function()local r=m.IsValid and m:IsValid()and m:GetPos()+m:OBBCenter()or n local s=r:ToScreen()if s.x>p then s.x=p*0.9 elseif s.x<100 then s.x=100 end if s.y>q then s.y=q*0.9 elseif s.y<100 then s.y=100 end PIXEL.DrawText(o,f,s.x,s.y,d,TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER)end)if ix then LocalPlayer():Notify("У вас новая подсказка! Отключить можно в TAB")else LocalPlayer():Notify("У вас новая подсказка! Отключить можно написав в консоль dc_drawhelp 0")end g=true timer.Simple(15,function()e[l]=nil table.ClearKeys(e)hook.Remove("PreDrawHalos","DC_DrawHalos")hook.Remove("HUDPaint","DC_DrawHelpText")g=false end)break end end end function DC_CORE:AddHelpText(l,m)table.insert(a,{pos=l,text=m})end local function i(l)if l==nil then l=true end if l then timer.Create("dc_helpertext",1,0,function()if not IsValid(LocalPlayer())then return end if not LocalPlayer():Alive()then return end if ix and not LocalPlayer():GetCharacter()then return end h()for n,o in ipairs(ents.FindInSphere(LocalPlayer():GetPos(),300))do if o and o:IsValid()and a[o:GetClass()]then a[o:GetClass()]=false e[#e+1]=o end end local m=LocalPlayer():GetPos()for n,o in pairs(a)do if o and istable(o)and m:DistToSqr(o.pos)<=250000 then e[#e+1]=o a[n]=false end end end)else timer.Remove("dc_helpertext")end end if ix then ix.option.Add("helpText",ix.type.bool,true,{category="Остальное",description="helpText",OnChanged=function(l,m)i(m)end})i(ix.option.Get("helpText",true))else cvars.AddChangeCallback("dc_drawhelp",function(l,m,n)i(n==1)end)i(GetConVar("dc_drawhelp"):GetInt()==1)end file.CreateDir("dc_core")file.CreateDir("dc_core/hints")file.CreateDir("dc_core/hints/"..GetGlobalString("d_serverid","stalkerrp"))local j="dc_core/hints/"..GetGlobalString("d_serverid","stalkerrp")local k={}if file.Exists(j.."/hints.txt","DATA")then k=pon.decode(file.Read(j.."/hints.txt","DATA")or"[}")end function DC_CORE:ShowHint(l,m)if k[l]then return end k[l]=true file.Write(j.."/hints.txt",pon.encode(k))local n=DC_CORE:GetPhrase(l)if not m then m=math.Round(utf8.len(n)/1.5)end notification.AddLegacy(DC_CORE:GetPhrase(l),NOTIFY_HINT,m)end timer.Simple(1,function()netstream.Hook("dc_hint_message",function(l,m,...)local n=DC_CORE:GetPhrase(l,...)if not m then m=math.Round(utf8.len(n)/1.5)end DC_CORE:ShowHint(n,m)end)end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement