This commit is contained in:
lifestorm
2024-08-04 23:12:27 +03:00
parent 0e770b2b49
commit ba1fc01b16
7084 changed files with 2173495 additions and 14 deletions

View File

@@ -0,0 +1,95 @@
--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
local PLUGIN = PLUGIN
function PLUGIN:F1MenuCreated(panel, mainFrame, leftFrame, rightFrame)
local notes = vgui.Create("DButton", rightFrame)
notes:SetFont("MenuFontNoClamp")
notes:SetText("Notatki Osobiste")
notes:Dock(TOP)
notes:DockMargin(0, 0, 0, 0 - SScaleMin(1 / 3))
notes:SetSize(rightFrame:GetWide(), SScaleMin(30 / 3))
notes.Paint = function(self, w, h)
surface.SetDrawColor(Color(0, 0, 0, 50))
surface.DrawRect(0, 0, w, h)
surface.SetDrawColor(Color(100, 100, 100, 150))
surface.DrawOutlinedRect(0, 0, w, h)
end
notes.DoClick = function (btn)
PLUGIN:CreateNotesTab()
end
mainFrame:SetTall(mainFrame:GetTall() + notes:GetTall())
end
function PLUGIN:CreateNotesTab(characterId, charNotes)
local maxLen = ix.config.Get("notesMaxLen")
local dataKey = "notes-"..string.gsub(game.GetIPAddress(), "%p", "").."-"..LocalPlayer():GetCharacter():GetID()
local frame = vgui.Create("DFrame")
frame:SetSize(ScrW() * 0.4, ScrH() * 0.4)
frame:SetTitle(characterId != nil and "Notatki Admina" or "Notatki Osobiste")
frame:Center()
frame:MakePopup()
local textEntry = vgui.Create("DTextEntry", frame)
textEntry:Dock(FILL)
textEntry:SetMultiline(true)
textEntry.OnTextChanged = function(self)
local txt = self:GetValue()
local amt = string.utf8len(txt)
if amt > maxLen then
self:SetText(self.oldText)
self:SetValue(self.oldText)
else
self.oldText = txt
end
end
local text
if (characterId != nil) then
text = charNotes
else
text = ix.data.Get(dataKey, "", true, true)
end
if (!text) then
frame:Remove()
LocalPlayer():Notify("Nie można otworzyć notatek postaci")
return
end
textEntry:SetValue(text)
local submitButton = vgui.Create("DButton", frame)
submitButton:Dock(BOTTOM)
submitButton:SetText("Zapisz")
submitButton.DoClick = function(self)
if (characterId) then
netstream.Start("ixNotesSet", characterId, utf8.sub(textEntry:GetValue(), 1, maxLen))
else
ix.data.Set(dataKey, textEntry:GetValue(), true, true)
LocalPlayer():Notify("Notatki zostały pomyślnie zapisane.")
end
end
end
netstream.Hook("ixNotes", function(characterId, charNotes)
PLUGIN:CreateNotesTab(characterId, charNotes)
end)

View File

@@ -0,0 +1,44 @@
--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
local PLUGIN = PLUGIN
PLUGIN.name = "Notes"
PLUGIN.author = "AleXXX_007"
PLUGIN.description = "Adds clientside notes for players and admin-only notes for characters."
ix.config.Add("notesMaxLen", 2048, "Max length for notes", nil, {
data = {min = 64, max = 5096},
category = "Other"
})
ix.util.Include("sv_plugin.lua")
ix.util.Include("cl_plugin.lua")
ix.char.RegisterVar("notes", {
field = "notes",
fieldType = ix.type.string,
default = "",
isLocal = true,
bNoDisplay = true,
bNetworked = true
})
ix.command.Add("CharNotes", {
description = "Set character's notes that only admins can see",
privilege = "Helix - Basic Admin Commands",
arguments = {
ix.type.character
},
OnRun = function(self, client, target)
netstream.Start(client, "ixNotes", target:GetID(), target:GetNotes())
end
})

View File

@@ -0,0 +1,27 @@
--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
local PLUGIN = PLUGIN
netstream.Hook("ixNotesSet", function(client, characterId, text)
if (CAMI.PlayerHasAccess(client, "Helix - Basic Admin Commands")) then
local character = ix.char.loaded[characterId]
if (character) then
character:SetNotes(text)
client:Notify("Notatki zostały pomyślnie zapisane.")
else
client:Notify("Nie znaleziono postaci.")
end
else
client:Notify("Nie masz do tego uprawnień.")
end
end)