mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 05:43:46 +03:00
Upload
This commit is contained in:
128
gamemodes/helix/plugins/tempspawns/sh_plugin.lua
Normal file
128
gamemodes/helix/plugins/tempspawns/sh_plugin.lua
Normal file
@@ -0,0 +1,128 @@
|
||||
--[[
|
||||
| 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 or {}
|
||||
|
||||
PLUGIN.name = "TempSpawns"
|
||||
PLUGIN.author = "Gr4Ss"
|
||||
PLUGIN.description = "Ajoute des points d'apparition temporaires qui ne sont pas enregistrés, sont faciles à déplacer et peuvent être utilisés pour rassembler des joueurs"
|
||||
|
||||
PLUGIN.tempspawns = PLUGIN.tempspawns or {}
|
||||
|
||||
CAMI.RegisterPrivilege({
|
||||
Name = "Helix - Manage TempSpawns",
|
||||
MinAccess = "admin"
|
||||
})
|
||||
|
||||
ix.util.Include("sv_plugin.lua")
|
||||
|
||||
do
|
||||
ix.command.Add("TempspawnAdd", {
|
||||
description = "@cmdTemspawnAdd",
|
||||
privilege = "Manage TempSpawns",
|
||||
OnRun = function(self, client, color, text)
|
||||
local trace = client:GetEyeTraceNoCursor()
|
||||
PLUGIN:AddTempspawn(trace.HitPos + Vector(0, 0, 10))
|
||||
end
|
||||
})
|
||||
|
||||
ix.command.Add("TempspawnRemove", {
|
||||
description = "@cmdTempspawnRemove",
|
||||
privilege = "Manage TempSpawns",
|
||||
arguments = {bit.bor(ix.type.bool, ix.type.optional)},
|
||||
argumentsNames = {"all"},
|
||||
OnRun = function(self, client, all)
|
||||
if (!all) then
|
||||
PLUGIN:RemoveTempspawn(client)
|
||||
else
|
||||
PLUGIN:RemoveTempspawns()
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
ix.command.Add("TempspawnAll", {
|
||||
description = "@cmdTempspawnAll",
|
||||
privilege = "Manage TempSpawns",
|
||||
OnRun = function(self, client)
|
||||
if (#PLUGIN.tempspawns == 0) then
|
||||
client:NotifyLocalized("tempspawnsNoSet")
|
||||
end
|
||||
|
||||
PLUGIN:TempSpawnAll(client)
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
ix.lang.AddTable("english", {
|
||||
optTempspawnESP = "Activer TempSpawn ESP",
|
||||
optdTempspawnESP = "Si les spawns temporaires doivent apparaître dans l'ESP Observer.",
|
||||
tempSpawn = "TempSpawn",
|
||||
tempspawnsNoSet = "Il n'y a pas encore de spawns temporaires !",
|
||||
tempspawnsRemovedAll = "Vous avez supprimé tous les spawns temporaires!",
|
||||
tempspawnsNoNearLooking = "Il n'y a pas d'apparitions temporaires près de l'endroit où vous regardez!",
|
||||
tempspawnsRespawnOne = "Vous avez remplacé 1 joueur.",
|
||||
tempspawnsRespawnNumber = "Vous avez réapparu %d joueurs.",
|
||||
cmdTempspawnAll = "Téléporte tous les joueurs vivants vers un spawn temporaire.",
|
||||
cmdTempspawnRemove = "Supprimez un spawn temporaire près de l'endroit où vous regardez ou tous les spawns temporaires.",
|
||||
cmdTemspawnAdd = "Ajoutez un spawn temporaire là où vous regardez."
|
||||
})
|
||||
|
||||
ix.lang.AddTable("french", {
|
||||
optTempspawnESP = "Activer TempSpawn ESP",
|
||||
optdTempspawnESP = "Si les spawns temporaires doivent apparaître dans l'ESP Observer.",
|
||||
tempSpawn = "TempSpawn",
|
||||
tempspawnsNoSet = "Il n'y a pas encore de spawns temporaires !",
|
||||
tempspawnsRemovedAll = "Vous avez supprimé tous les spawns temporaires!",
|
||||
tempspawnsNoNearLooking = "Il n'y a pas d'apparitions temporaires près de l'endroit où vous regardez!",
|
||||
tempspawnsRespawnOne = "Vous avez remplacé 1 joueur.",
|
||||
tempspawnsRespawnNumber = "Vous avez réapparu %d joueurs.",
|
||||
cmdTempspawnAll = "Téléporte tous les joueurs vivants vers un spawn temporaire.",
|
||||
cmdTempspawnRemove = "Supprimez un spawn temporaire près de l'endroit où vous regardez ou tous les spawns temporaires.",
|
||||
cmdTemspawnAdd = "Ajoutez un spawn temporaire là où vous regardez."
|
||||
})
|
||||
|
||||
ix.lang.AddTable("spanish", {
|
||||
cmdTempspawnRemove = "Quita un spawn temporal cerca de donde estés mirando o quita todo los spawns temporales.",
|
||||
cmdTempspawnAll = "Teletransporta a todos los jugadores vivos a un spawn temporal.",
|
||||
cmdTemspawnAdd = "Añade un spawn temporal en donde estás mirando.",
|
||||
tempspawnsNoSet = "¡Aún no se han establecido los spawns temporales!",
|
||||
tempspawnsRespawnNumber = "Has resucitado a %d jugadores.",
|
||||
tempspawnsRespawnOne = "Has resucitado a 1 jugador.",
|
||||
tempspawnsRemovedAll = "¡Has eliminado todo los spawns temporales!",
|
||||
optTempspawnESP = "Activar TempSpawn ESP",
|
||||
tempSpawn = "TempSpawn",
|
||||
tempspawnsNoNearLooking = "¡No hay tempspawns cerca de donde estás mirando!"
|
||||
})
|
||||
|
||||
if (CLIENT) then
|
||||
ix.option.Add("tempspawnESP", ix.type.bool, true, {
|
||||
category = "Observateur",
|
||||
hidden = function()
|
||||
return !CAMI.PlayerHasAccess(LocalPlayer(), "Helix - Observer", nil)
|
||||
end
|
||||
})
|
||||
|
||||
function PLUGIN:DrawPointESP(points)
|
||||
local text = L("tempSpawn")
|
||||
if (ix.option.Get("tempspawnESP")) then
|
||||
for _, v in ipairs(self.tempspawns) do
|
||||
points[#points + 1] = {v, text}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
net.Receive("TempspawnsData", function(len)
|
||||
PLUGIN.tempspawns = {}
|
||||
local max = net.ReadUInt(16)
|
||||
for _ = 1, max do
|
||||
PLUGIN.tempspawns[#PLUGIN.tempspawns + 1] = net.ReadVector()
|
||||
end
|
||||
end)
|
||||
end
|
||||
128
gamemodes/helix/plugins/tempspawns/sv_plugin.lua
Normal file
128
gamemodes/helix/plugins/tempspawns/sv_plugin.lua
Normal file
@@ -0,0 +1,128 @@
|
||||
--[[
|
||||
| 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
|
||||
util.AddNetworkString("TempspawnsData")
|
||||
|
||||
function PLUGIN:TempSpawnAll(client)
|
||||
local players = player.GetAll()
|
||||
local amount = 0
|
||||
|
||||
for _, ply in pairs(players) do
|
||||
if (!ply:GetCharacter() or ply:GetMoveType() == MOVETYPE_NOCLIP or !ply:Alive()) then
|
||||
continue
|
||||
end
|
||||
|
||||
if (!ix.faction.Get(ply:Team()).useTempSpawns) then
|
||||
continue
|
||||
end
|
||||
|
||||
if (IsValid(ply.ixRagdoll)) then
|
||||
ply:SetRagdolled(false)
|
||||
end
|
||||
|
||||
amount = amount + 1
|
||||
local index = amount % #self.tempspawns
|
||||
local pos = self.tempspawns[index + 1]
|
||||
if amount > #self.tempspawns then
|
||||
local a = 1 / 8
|
||||
local b = a * (amount - index) / #self.tempspawns
|
||||
pos = pos + Vector(
|
||||
(b <= a*3 and -50) or (b > a*4 and b <= a*7 and 50) or 0,
|
||||
(b <= a*1 and -50) or (b > a*2 and b <= a*5 and 50) or (b > a*6 and -50) or 0,
|
||||
10
|
||||
)
|
||||
end
|
||||
|
||||
ply:SetPos(pos)
|
||||
end
|
||||
|
||||
if (amount == 1) then
|
||||
client:NotifyLocalized("tempspawnsRespawnOne")
|
||||
else
|
||||
client:NotifyLocalized("tempspawnsRespawnNumber", amount)
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:SendTempspawns(client)
|
||||
net.Start("TempspawnsData")
|
||||
net.WriteUInt(#self.tempspawns, 16)
|
||||
for _, v in ipairs(self.tempspawns) do
|
||||
net.WriteVector(v)
|
||||
end
|
||||
if (client) then
|
||||
net.Send(client)
|
||||
else
|
||||
net.Broadcast()
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:PostPlayerLoadout(client)
|
||||
if (ix.faction.Get(client:GetCharacter():GetFaction()).useTempSpawns) then
|
||||
if (#self.tempspawns > 0) then
|
||||
client:SetPos(self.tempspawns[math.random(#self.tempspawns)])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:PlayerInitialSpawn(client)
|
||||
self:SendTempspawns(client)
|
||||
end
|
||||
|
||||
function PLUGIN:RemoveTempspawns(client)
|
||||
if (#self.tempspawns == 0) then
|
||||
client:NotifyLocalized("tempspawnsNoSet")
|
||||
end
|
||||
|
||||
self.tempspawns = {}
|
||||
self:SendTempspawns()
|
||||
|
||||
client:NotifyLocalized("tempspawnsRemovedAll")
|
||||
end
|
||||
|
||||
function PLUGIN:RemoveTempspawn(client)
|
||||
local trace = client:GetEyeTraceNoCursor()
|
||||
local pos = trace.HitPos + Vector(0, 0, 10)
|
||||
local index = nil
|
||||
local minDistanceSqr = nil
|
||||
|
||||
for k, point in ipairs(self.tempspawns) do
|
||||
local dist = point:DistToSqr(pos)
|
||||
if (!index or dist < minDistanceSqr) then
|
||||
index = k
|
||||
minDistanceSqr = dist
|
||||
end
|
||||
end
|
||||
|
||||
if (!index) then
|
||||
client:NotifyLocalized("tempspawnsNoSet")
|
||||
return
|
||||
elseif (index and minDistanceSqr > 40000) then
|
||||
client:NotifyLocalized("tempspawnsNoNearLooking")
|
||||
return
|
||||
end
|
||||
|
||||
PLUGIN:UpdateTempspawn(index)
|
||||
end
|
||||
|
||||
function PLUGIN:UpdateTempspawn(index, newValue)
|
||||
if (!newValue) then
|
||||
table.remove(self.tempspawns, index)
|
||||
else
|
||||
self.tempspawns[index] = newValue
|
||||
end
|
||||
self:SendTempspawns()
|
||||
end
|
||||
|
||||
function PLUGIN:AddTempspawn(tempspawn)
|
||||
table.insert(self.tempspawns, tempspawn)
|
||||
self:SendTempspawns()
|
||||
end
|
||||
Reference in New Issue
Block a user