mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 13:53:45 +03:00
Upload
This commit is contained in:
44
gamemodes/ixhl2rp/plugins/nicknames/cl_plugin.lua
Normal file
44
gamemodes/ixhl2rp/plugins/nicknames/cl_plugin.lua
Normal 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
|
||||
|
||||
function PLUGIN:PopulateImportantCharacterInfo(targClient, targCharacter, container)
|
||||
local nicknameText = self:GetTargClientNickname(targClient)
|
||||
|
||||
if (nicknameText) then
|
||||
local nickname = container:AddRow("nicknameText")
|
||||
nickname:SetText("Pseudonim: "..nicknameText)
|
||||
nickname:SetBackgroundColor(Color(150, 150, 150, 255))
|
||||
nickname:SizeToContents()
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:GetTargClientNickname(targClient)
|
||||
local nickNames = LocalPlayer():GetCharacter():GetNickNames()
|
||||
if !nickNames or (nickNames and !istable(nickNames)) then return false end
|
||||
local targChar = targClient:GetCharacter()
|
||||
local targCharID = targChar:GetID()
|
||||
if !targCharID then return false end
|
||||
if targClient:GetNetVar("ixMaskEquipped") then
|
||||
return false
|
||||
end
|
||||
|
||||
if targClient:GetNetVar("combineMaskEquipped") then
|
||||
return false
|
||||
end
|
||||
|
||||
if nickNames[targChar:GetID()] then
|
||||
return nickNames[targChar:GetID()]
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
51
gamemodes/ixhl2rp/plugins/nicknames/sh_plugin.lua
Normal file
51
gamemodes/ixhl2rp/plugins/nicknames/sh_plugin.lua
Normal file
@@ -0,0 +1,51 @@
|
||||
--[[
|
||||
| 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 = "Nicknames"
|
||||
PLUGIN.author = "Fruity"
|
||||
PLUGIN.description = "Implements nicknames possible for unmasked/unhidden individuals."
|
||||
|
||||
ix.util.Include("sv_plugin.lua")
|
||||
ix.util.Include("cl_plugin.lua")
|
||||
|
||||
ix.char.RegisterVar("nickNames", {
|
||||
field = "nickNames",
|
||||
default = {},
|
||||
isLocal = true,
|
||||
bNoDisplay = true
|
||||
})
|
||||
|
||||
ix.config.Add("maxNicknameLength", 40, "The max amount of characters for an assigned nickname.", nil,
|
||||
{data = {min = 1, max = 60}, category = "Nicknames"}
|
||||
)
|
||||
|
||||
ix.command.Add("SetNickname", {
|
||||
description = "Ustawia pseudonim dla niezamaskowanej osoby.",
|
||||
arguments = {
|
||||
ix.type.string
|
||||
},
|
||||
OnRun = function(self, client, nickname)
|
||||
if (SERVER) then
|
||||
PLUGIN:SetNickName(client, nickname)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
ix.command.Add("RemoveNickname", {
|
||||
description = "Usuwa pseudonim nadany niezamaskowanej osobie.",
|
||||
OnRun = function(self, client)
|
||||
if (SERVER) then
|
||||
PLUGIN:SetNickName(client, nil)
|
||||
end
|
||||
end
|
||||
})
|
||||
53
gamemodes/ixhl2rp/plugins/nicknames/sv_plugin.lua
Normal file
53
gamemodes/ixhl2rp/plugins/nicknames/sv_plugin.lua
Normal file
@@ -0,0 +1,53 @@
|
||||
--[[
|
||||
| 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:SetNickName(client, nickname)
|
||||
if (nickname) then
|
||||
if string.len(nickname) <= 1 then
|
||||
client:Notify("Ten pseudonim jest za krótki!")
|
||||
return
|
||||
end
|
||||
|
||||
if string.len(nickname) > ix.config.Get("maxNicknameLength", 40) then
|
||||
client:Notify("Ten pseudonim jest za długi!")
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
local target = client:GetEyeTraceNoCursor().Entity
|
||||
if (!IsValid(target) or !(target:IsPlayer() or target:GetClass() == "prop_ragdoll")) then
|
||||
client:Notify("Musisz patrzeć na prawidłowy cel!")
|
||||
return
|
||||
end
|
||||
|
||||
if target:GetNetVar("ixMaskEquipped") then
|
||||
client:Notify("Nie można przypisywać pseudonimów do zamaskowanych osób!")
|
||||
return false
|
||||
end
|
||||
|
||||
if target:GetNetVar("combineMaskEquipped") then
|
||||
client:Notify("Nie można przypisywać pseudonimów do zamaskowanych osób!")
|
||||
return false
|
||||
end
|
||||
|
||||
local localChar = client:GetCharacter()
|
||||
local targCharacter = (target.GetCharacter and target:GetCharacter() or false)
|
||||
if !targCharacter or !localChar then return false end
|
||||
|
||||
local targetCharID = targCharacter:GetID()
|
||||
local nickNames = localChar:GetNickNames()
|
||||
nickNames[targetCharID] = nickname
|
||||
localChar:SetNickNames(nickNames)
|
||||
|
||||
client:Notify((nickname and "Przypisano" or "Usunięto").." pseudonim "..(!nickname and "" or "'"..nickname.."'")..(nickname and " dla" or "od").." tej postaci.")
|
||||
end
|
||||
Reference in New Issue
Block a user