add sborka

This commit is contained in:
2026-03-31 10:27:04 +03:00
commit f5e5f56c84
2345 changed files with 382127 additions and 0 deletions

View File

@@ -0,0 +1,220 @@
-- Клиентское меню строительства
local PLUGIN = PLUGIN
if CLIENT then
function DrawItems(items, panel, mode, main)
for i=1, #items do
if items[i].cat == mode then
local DButton = panel:Add( "DButton" )
DButton:SetHeight(60)
DButton:SetFont( "Font1" )
DButton:SetText( items[i].name .. " | Запас: " .. items[i].count )
DButton:SetIcon( items[i].icon )
DButton:Dock( TOP )
DButton:DockMargin( 0, 10, 0, 10 )
DButton.Paint = function(self, w, h)
draw.RoundedBox(5, 0, 0, w, h, Color(0, 0, 0, 255))
draw.RoundedBox(5, 2, 2, w-4, h-4, Color(200, 200, 200, 255))
end
DButton.DoClick = function()
if items[i].model != nil then
net.Start("buildtrench")
net.WriteInt(i, 13)
net.SendToServer()
main:Close()
end
if items[i].entity != nil then
net.Start("setentity")
net.WriteInt(i, 13)
net.SendToServer()
main:Close()
end
end
end
end
end
surface.CreateFont("Font3", {
font = "Arial",
extended = true,
weight = 900,
size = 24
})
surface.CreateFont("Font2", {
font = "Arial",
extended = true,
weight = 800,
size = 20
})
surface.CreateFont("Font", {
font = "Arial",
extended = true,
size = 20
})
surface.CreateFont("Font1", {
font = "Arial",
weight = 900,
extended = true,
size = 20
})
local faded_black = Color(100, 100, 100, 0)
net.Receive("openmenu", function(len, ply)
local alpha1 = 255
local alpha2 = 0
local alpha3 = 0
local alpha4 = 0
local catlabel
local DScrollPanel
local items = net.ReadTable()
local mode = 0
local main = vgui.Create("DFrame")
main:SetSize(500, 500)
main:Center()
main:SetTitle(" ")
main:SetDraggable(false)
main:ShowCloseButton(false)
main:MakePopup()
main.Paint = function(self, w, h)
draw.RoundedBox(5, 0, 0, w, h, faded_black)
end
local p = vgui.Create( "DPanel", main )
p:Dock( TOP )
p:DockMargin( 0, 0, 0, 0 )
p:SetHeight(40)
p.Paint = function(self, w, h)
draw.RoundedBox(5, 0, 0, w, h, Color(0, 0, 0, 255))
draw.RoundedBox(5, 2, 2, w-4, h-4, Color(150, 150, 150, 255))
end
local namelabel = vgui.Create( "DLabel", p )
namelabel:Dock( LEFT )
namelabel:DockMargin( 20, 0, 20, 0 )
namelabel:SetSize(200, 20)
namelabel:SetFont( "Font" )
namelabel:SetText( "Инженерный комплект" )
local closebutton = vgui.Create( "DButton", p )
closebutton:Dock( RIGHT )
closebutton:DockMargin( 20, 0, 20, 0 )
closebutton:SetText( " " )
closebutton:SetImage("entities/closebutton.png")
closebutton:SetSize( 40, 40 )
closebutton.Paint = function(self, w, h)
draw.RoundedBox(2, 0, 0, w, h, Color(150, 150, 150, 0))
end
closebutton.DoClick = function()
main:Close()
end
local ppp = vgui.Create( "DPanel", main )
ppp:Dock( TOP )
ppp:DockMargin( 0, 20, 0, 20 )
ppp:SetHeight(60)
ppp.Paint = function(self, w, h)
draw.RoundedBox(5, 0, 0, w, h, Color(0, 0, 0, 255))
draw.RoundedBox(5, 2, 2, w-4, h-4, Color(150, 150, 150, 255))
end
local entity = vgui.Create( "DButton", ppp )
entity:Dock( LEFT )
entity:DockMargin( 70, 10, 0, 10 )
entity:SetText( " " )
entity:SetImage("entities/entity.png")
entity:SetHeight(40)
entity:SetWidth(40)
entity.Paint = function(self, w, h)
draw.RoundedBox(5, 0, 0, w, h, Color(120, 120, 120, alpha1))
end
entity.DoClick = function()
DScrollPanel:GetCanvas():Clear()
DrawItems(items, DScrollPanel, 0, main)
catlabel:SetText( " Объекты" )
alpha1 = 255
alpha2 = 0
alpha3 = 0
alpha4 = 0
end
local tier1 = vgui.Create( "DButton", ppp )
tier1:Dock( LEFT )
tier1:DockMargin( 70, 10, 0, 10 )
tier1:SetText( " " )
tier1:SetImage("entities/tier1.png")
tier1:SetHeight(40)
tier1:SetWidth(40)
tier1.Paint = function(self, w, h)
draw.RoundedBox(5, 0, 0, w, h, Color(120, 120, 120, alpha2))
end
tier1.DoClick = function()
DScrollPanel:GetCanvas():Clear()
DrawItems(items, DScrollPanel, 1, main)
catlabel:SetText( "Легкие укрепления" )
alpha1 = 0
alpha2 = 255
alpha3 = 0
alpha4 = 0
end
local tier2 = vgui.Create( "DButton", ppp )
tier2:Dock( LEFT )
tier2:DockMargin( 70, 10, 0, 10 )
tier2:SetText( " " )
tier2:SetImage("entities/tier2.png")
tier2:SetHeight(40)
tier2:SetWidth(40)
tier2.Paint = function(self, w, h)
draw.RoundedBox(5, 0, 0, w, h, Color(120, 120, 120, alpha3))
end
tier2.DoClick = function()
DScrollPanel:GetCanvas():Clear()
DrawItems(items, DScrollPanel, 2, main)
catlabel:SetText( "Средние укрепления" )
alpha1 = 0
alpha2 = 0
alpha3 = 255
alpha4 = 0
end
local tier3 = vgui.Create( "DButton", ppp )
tier3:Dock( LEFT )
tier3:DockMargin( 70, 10, 0, 10 )
tier3:SetText( " " )
tier3:SetImage("entities/tier3.png")
tier3:SetHeight(40)
tier3:SetWidth(40)
tier3.Paint = function(self, w, h)
draw.RoundedBox(5, 0, 0, w, h, Color(120, 120, 120, alpha4))
end
tier3.DoClick = function()
DScrollPanel:GetCanvas():Clear()
DrawItems(items, DScrollPanel, 3, main)
catlabel:SetText( "Тяжелые укрепления" )
alpha1 = 0
alpha2 = 0
alpha3 = 0
alpha4 = 255
end
local pp = vgui.Create( "DPanel", main )
pp:Dock( TOP )
pp:DockMargin( 0, 0, 0, 20 )
pp:SetHeight(300)
pp.Paint = function(self, w, h)
draw.RoundedBox(5, 0, 0, w, h, Color(0, 0, 0, 255))
draw.RoundedBox(5, 2, 2, w-4, h-4, Color(150, 150, 150, 255))
end
catlabel = vgui.Create( "DLabel", pp )
catlabel:Dock( TOP )
catlabel:DockMargin( 170, 20, 0, 10 )
catlabel:SetSize(350, 20)
catlabel:SetFont( "Font" )
catlabel:SetText( " Объекты" )
DScrollPanel = vgui.Create( "DScrollPanel", pp )
DScrollPanel:Dock( TOP )
DScrollPanel:SetHeight(240)
DScrollPanel:DockMargin( 6, 6, 6, 6 )
DrawItems(items, DScrollPanel, 0, main)
end)
end

View File

@@ -0,0 +1,114 @@
-- Клиентская часть смены скинов
local PLUGIN = PLUGIN
local function OpenSkinMenu(ply, ent)
if not IsValid(ent) then return end
local frame = vgui.Create("DFrame")
frame:SetSize(250, 400)
frame:SetTitle("Выбор скина")
frame:Center()
frame:MakePopup()
local skinPanel = vgui.Create("DScrollPanel", frame)
skinPanel:SetSize(230, 350)
skinPanel:SetPos(10, 30)
net.Start("RequestSkinData")
net.WriteEntity(ent)
net.SendToServer()
net.Receive("ReceiveSkinData", function()
local totalSkins = net.ReadInt(8)
local skinNames = net.ReadTable()
for i = 0, totalSkins - 1 do
local skinName = skinNames[i] or "Скин " .. i
local button = vgui.Create("DButton", skinPanel)
button:SetText(skinName)
button:SetSize(210, 40)
button:SetPos(10, 10 + i * 50)
button.DoClick = function()
net.Start("ChangeEntitySkin")
net.WriteEntity(ent)
net.WriteInt(i, 8)
net.SendToServer()
end
end
end)
end
hook.Add("PlayerBindPress", "OpenSkinMenuOnUse", function(ply, bind, pressed)
local allowedGroups = {
owner = true,
admin = true,
["spec admin"] = true,
prem = true,
sponsor = true
}
if allowedGroups[ply:GetUserGroup()] then
if bind == "+use" and pressed then
local trace = ply:GetEyeTrace()
local ent = trace.Entity
if IsValid(ent) and trace.HitPos:Distance(ply:GetPos()) < 1000 then
local activeWeapon = ply:GetActiveWeapon()
if IsValid(activeWeapon) and activeWeapon:GetClass() == "weapon_hands" then
net.Start("CheckAllowedEntity")
net.WriteEntity(ent)
net.SendToServer()
net.Receive("EntityAllowed", function()
OpenSkinMenu(ply, ent)
end)
end
end
end
end
end)
concommand.Add("get_bodygroup_info", function(ply)
local trace = ply:GetEyeTrace()
local ent = trace.Entity
if not IsValid(ent) then
print("[Ошибка] Вы не смотрите на объект!")
return
end
local bodygroups = ent:GetBodyGroups()
print("========[ Bodygroup Info ]========")
print("Модель: " .. ent:GetModel())
for _, bg in ipairs(bodygroups) do
local currentValue = ent:GetBodygroup(bg.id)
print(string.format("Bodygroup: %s (ID: %d) | Выбрано: %d", bg.name, bg.id, currentValue))
end
local materials = ent:GetMaterials()
print("========[ Sub-Materials ]========")
for i = 0, #materials - 1 do
local mat = ent:GetSubMaterial(i)
if mat == "" then mat = "По умолчанию" end
print(string.format("SubMaterial ID: %d | Материал: %s", i, mat))
end
end)
concommand.Add("get_skin_info", function(ply)
local trace = ply:GetEyeTrace()
local ent = trace.Entity
if not IsValid(ent) then
print("[Ошибка] Вы не смотрите на объект!")
return
end
local totalSkins = ent:SkinCount() - 1
print("========[ Skin Info ]========")
print("Модель: " .. ent:GetModel())
print("Доступно скинов: " .. totalSkins)
for i = 0, totalSkins do
print(string.format("Skin ID: %d", i))
end
end)

View File

@@ -0,0 +1,9 @@
include("shared.lua")
function ENT:Draw()
self:DrawModel()
end
function ENT:IsTranslucent()
return true
end

View File

@@ -0,0 +1,58 @@
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
local StartPos
local StartAng
function ENT:Initialize()
self:SetMoveType(MOVETYPE_NONE)
StartPos = self:GetPos()
StartAng = self:GetAngles()
self:SetNWInt('MaxHp',self.hp)
end
function ENT:Think()
self:SetNWInt('Hp',self.hp)
if self:GetNWInt("Hp") > self:GetNWInt("MaxHp") then
self:SetNWInt('Hp',self:GetNWInt("MaxHp"))
end
if SERVER then
if self.poscoef == 0 and self.building then
self.Owner:Freeze(false)
self.Owner.building = false
self:PhysicsInitStatic(6)
self:SetCollisionGroup(0)
self.building = false
end
if self.building then
self.Owner.building = true
self.poscoef = self.poscoef + 1
self.Owner:Freeze(true)
self:SetAngles(StartAng)
self:SetPos(StartPos - self:GetAngles():Up() * -self.poscoef)
end
end
end
function ENT:OnRemove()
if self.HasIdle then
self:StopSound("TFA_INS2_RPG7.Loop")
self.HasIdle = false
end
end
function ENT:Use(activator, caller)
end
function ENT:OnTakeDamage( dmg )
if dmg:GetInflictor() == self or dmg:GetAttacker() == self then return end
if self.Exploded then return end
if self.hp > 0 and self.hp - dmg:GetDamage() <= 0 then
self.Exploded = true
self:Remove()
end
self.hp = self.hp - dmg:GetDamage()
dmg:SetAttacker(self)
dmg:SetInflictor(self)
self:TakePhysicsDamage( dmg )
end

View File

@@ -0,0 +1,8 @@
ENT.Type = "anim"
ENT.PrintName = "Contact Explosive"
ENT.Author = ""
ENT.Contact = ""
ENT.Purpose = ""
ENT.Instructions = ""
ENT.DoNotDuplicate = true
ENT.DisableDuplicator = true

View File

@@ -0,0 +1,9 @@
include("shared.lua")
function ENT:Draw()
self:DrawModel()
end
function ENT:IsTranslucent()
return true
end

View File

@@ -0,0 +1,58 @@
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
local StartPos
local StartAng
function ENT:Initialize()
self:SetMoveType(MOVETYPE_NONE)
StartPos = self:GetPos()
StartAng = self:GetAngles()
self:SetNWInt('MaxHp',self.hp)
end
function ENT:Think()
self:SetNWInt('Hp',self.hp)
if self:GetNWInt("Hp") > self:GetNWInt("MaxHp") then
self:SetNWInt('Hp',self:GetNWInt("MaxHp"))
end
if SERVER then
if self.poscoef == 0 and self.building then
self.Owner:Freeze(false)
self.Owner.building = false
self:PhysicsInitStatic(6)
self:SetCollisionGroup(0)
self.building = false
end
if self.building then
self.Owner.building = true
self.poscoef = self.poscoef + 1
self.Owner:Freeze(true)
self:SetAngles(StartAng)
self:SetPos(StartPos - self:GetAngles():Up() * -self.poscoef)
end
end
end
function ENT:OnRemove()
if self.HasIdle then
self:StopSound("TFA_INS2_RPG7.Loop")
self.HasIdle = false
end
end
function ENT:Use(activator, caller)
end
function ENT:OnTakeDamage( dmg )
if dmg:GetInflictor() == self or dmg:GetAttacker() == self then return end
if self.Exploded then return end
if self.hp > 0 and self.hp - dmg:GetDamage() <= 0 then
self.Exploded = true
self:Remove()
end
self.hp = self.hp - dmg:GetDamage()
dmg:SetAttacker(self)
dmg:SetInflictor(self)
self:TakePhysicsDamage( dmg )
end

View File

@@ -0,0 +1,8 @@
ENT.Type = "anim"
ENT.PrintName = "Contact Explosive"
ENT.Author = ""
ENT.Contact = ""
ENT.Purpose = ""
ENT.Instructions = ""
ENT.DoNotDuplicate = true
ENT.DisableDuplicator = true

View File

@@ -0,0 +1,29 @@
include("shared.lua")
surface.CreateFont( "PlayerTagFont", {
font = "Arial",
size = 72,
} )
function ENT:Draw()
self:DrawModel()
angle = self:GetAngles() + Angle(0,90,90)
pos = self:GetPos() + angle:Forward() * 0 + angle:Up() * 0 + angle:Right() * -30
cam.Start3D2D( pos, angle, 0.05 )
surface.SetFont( "PlayerTagFont" )
local tW, tH = surface.GetTextSize( self.DisplayName )
local padX = 20
local padY = 5
surface.SetDrawColor( 0, 0, 0, 200 )
surface.DrawRect( -tW / 2 - padX, -padY, tW + padX * 2, tH + padY * 2 )
draw.SimpleText( self.DisplayName, "PlayerTagFont", -tW / 2, 0, color_white )
cam.End3D2D()
end
function ENT:IsTranslucent()
return true
end

View File

@@ -0,0 +1,43 @@
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
ENT.hp = 500
function ENT:Initialize()
self:SetModel(self.Model)
self:PhysicsInit(6)
end
function ENT:Think()
end
function ENT:OnRemove()
end
function ENT:Use(activator, caller)
if activator:GetActiveWeapon():GetClass() == "engineertool" or "engineertoolfpv" or "engineertoolmines" then
print(activator:GetActiveWeapon().Structures)
activator:GetActiveWeapon().Structures[self.ItemId].count = activator:GetActiveWeapon().Structures[self.ItemId].count + self.ItemCount
net.Start('additem')
net.WriteInt(self.ItemId, 13)
net.WriteInt(self.ItemCount, 13)
net.Send(activator)
self:Remove()
end
end
function ENT:OnTakeDamage( dmg )
if dmg:GetInflictor() == self or dmg:GetAttacker() == self then return end
if self.Exploded then return end
if self.hp > 0 and self.hp - dmg:GetDamage() <= 0 then
self.Exploded = true
self:Remove()
end
self.hp = self.hp - dmg:GetDamage()
dmg:SetAttacker(self)
dmg:SetInflictor(self)
self:TakePhysicsDamage( dmg )
end

View File

@@ -0,0 +1,12 @@
ENT.Type = "anim"
ENT.PrintName = "Ящик с припасами"
ENT.Category = "Engineer Kit"
ENT.Author = ""
ENT.Contact = ""
ENT.Purpose = ""
ENT.Instructions = ""
ENT.Spawnable = true
ENT.Model = "models/Items/ammocrate_smg1.mdl"
ENT.ItemId = 1
ENT.ItemCount = 1
ENT.DisplayName = "ПТРК 'Корнет'"

View File

@@ -0,0 +1,251 @@
if CLIENT then
SWEP.WepSelectIcon = surface.GetTextureID("vgui/hud/weapon_doietoolus")
SWEP.DrawWeaponInfoBox = false
SWEP.BounceWeaponIcon = false
killicon.Add( "weapon_doietoolus", "vgui/hud/weapon_doietoolus", Color( 0, 0, 0, 255 ) )
end
SWEP.PrintName = "Entrenching Tool"
SWEP.Category = "Engiener Tools"
SWEP.Spawnable= true
SWEP.AdminSpawnable= true
SWEP.AdminOnly = false
SWEP.ViewModelFOV = 60
SWEP.ViewModel = "models/weapons/doi/v_etool_us.mdl"
SWEP.WorldModel = "models/weapons/doi/w_etool_us.mdl"
SWEP.ViewModelFlip = false
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.Slot = 0
SWEP.SlotPos = 0
SWEP.UseHands = true
SWEP.HoldType = "melee2"
SWEP.FiresUnderwater = false
SWEP.DrawCrosshair = false
SWEP.DrawAmmo = true
SWEP.Base = "weapon_base"
SWEP.CSMuzzleFlashes = true
SWEP.Sprint = 0
SWEP.Primary.ClipSize = 0
SWEP.Primary.DefaultClip = 0
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "none"
SWEP.Secondary.ClipSize = 0
SWEP.Secondary.DefaultClip = 0
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.Structures = {
{
name = "Мешки с песком",
icon = "entities/closebutton.png",
cat = 1,
hp = 10000,
model = "models/props_fortifications/sandbags_corner1.mdl",
count = 3,
corrangle = Angle(0,0,0)
},
{
name = "Большие мешки с песком",
icon = "entities/closebutton.png",
cat = 1,
hp = 20000,
model = "models/props_fortifications/sandbags_corner1_tall.mdl",
count = 2,
corrangle = Angle(0,0,0)
},
{
name = "Противотанковые ёжи",
icon = "entities/closebutton.png",
cat = 1,
hp = 50000,
model = "models/test_sborka_props/barricades/ezi_antitank_2.mdl",
count = 2,
corrangle = Angle(0,-90,0)
},
{
name = "Танковый окоп",
icon = "entities/closebutton.png",
cat = 2,
hp = 100000,
model = "models/trenches/prop/tank_cover/tank_cover.mdl",
count = 3,
corrangle = Angle(0,0,0)
},
}
function SWEP:Initialize()
self:SetWeaponHoldType( self.HoldType )
self:GetOwner().buildtime = 0
end
function SWEP:Deploy()
self:SetNextPrimaryFire( CurTime() + self.Owner:GetViewModel():SequenceDuration() )
self.Weapon:SendWeaponAnim( ACT_VM_DRAW )
Sprint = 0
end
function SWEP:Holster()
self.NextSecondaryAttack = 0
Sprint = 0
return true
end
function SWEP:PrimaryAttack()
if !(self.Weapon:GetNextPrimaryFire() < CurTime()) || not(Sprint == 0) then return end
self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
self.Owner:SetAnimation( PLAYER_ATTACK1 )
self:SetNextPrimaryFire( CurTime() + 1)
self:SetNextSecondaryFire( CurTime() + 1)
if SERVER then
net.Start("openmenu")
net.WriteTable(self.Structures)
net.Send(self:GetOwner())
end
end
function SWEP:SecondaryAttack()
end
function SWEP:Reload()
if SERVER then
local item = self:GetOwner():GetEyeTrace().Entity
if item:IsValid() then
if item.id != nil then
if item.Owner == self:GetOwner() then
if (item:GetClass() == self.Structures[item.id].entity) or (item:GetModel() == self.Structures[item.id].model) then
item:Remove()
self.Structures[item.id].count = self.Structures[item.id].count + 1
end
end
end
end
end
end
function SWEP:DrawHUDBackground()
if self:GetOwner().buildtime > 0 then
draw.RoundedBox( 20, ScrW()/2-150, ScrH()/2-30, 0+300-self:GetOwner().buildtime*15, 60, Color( 50, 50, 50 , 180) )
draw.RoundedBox( 20, ScrW()/2-145, ScrH()/2-25, 0+290-self:GetOwner().buildtime*14.5, 50, Color( 0, 255, 0 ,125) )
draw.DrawText( tostring(100 - self:GetOwner().buildtime*5) .. '%', "Font3", ScrW()/2-20, ScrH()/2-15, Color( 255, 255, 255 ,255), 0 )
end
end
local delay = 0.5
local nextOccurance = 0
local flag1 = true
if CLIENT then
function SWEP:RenderScreen()
if self.Owner.buildtime < 0 or Sprint == 2 then
self.Weapon:SendWeaponAnim(ACT_VM_IDLE)
end
if input.IsKeyDown(KEY_F) and flag1 then
net.Start("buildstop12")
net.SendToServer()
self.Owner.building = false
self.Owner.buildtime = -3
flag1 = false
timer.Simple(1, function() flag1 = true end)
end
local timeLeft = nextOccurance - CurTime()
if timeLeft < 0 and self:GetOwner().buildtime >= 0 then
self:GetOwner().buildtime = self:GetOwner().buildtime - 0.5
self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
self:GetOwner():SetAnimation( PLAYER_ATTACK1 )
self:SetNextPrimaryFire( CurTime() + delay)
nextOccurance = CurTime() + delay
end
net.Receive("buildanim", function(len, ply)
self:GetOwner().buildtime = 20
end)
end
end
if SERVER then
function SWEP:Think()
net.Receive("buildstop12", function(len, ply)
ply:Freeze(false)
if self.LastEnt:IsValid() then
self.Structures[self.LastEnt.id].count = self.Structures[self.LastEnt.id].count + 1
self.LastEnt:Remove()
end
end)
net.Receive("buildtrench", function(len, ply)
if ply:GetActiveWeapon():GetClass() != "engineertool" then return end
local id = net.ReadInt(13)
if (ply:GetEyeTrace().HitPos - ply:GetEyeTrace().StartPos):Length() <= 300 then
if self.Structures[id].count > 0 then
net.Start("buildanim")
net.WriteEntity(item)
net.Send(self:GetOwner())
local item = ents.Create("util_structure")
item:SetPos(ply:GetEyeTrace().HitPos)
item:SetAngles(ply:GetEyeTrace().HitNormal:Angle() + Angle(90,ply:EyeAngles().y,0))
item:SetModel(self.Structures[id].model)
item.hp = self.Structures[id].hp
item.id = id
item.poscoef = -100
item.building = true
item.Owner = self:GetOwner()
item:Spawn()
self.LastEnt = item
self.Structures[id].count = self.Structures[id].count - 1
end
end
end)
net.Receive("setentity", function(len, ply)
if ply:GetActiveWeapon():GetClass() != "engineertool" then return end
local id = net.ReadInt(13)
if (ply:GetEyeTrace().HitPos - ply:GetEyeTrace().StartPos):Length() <= 300 then
if self.Structures[id].count > 0 then
local item = ents.Create(self.Structures[id].entity)
item:SetPos(ply:GetEyeTrace().HitPos + ply:GetEyeTrace().HitNormal * 40)
item:SetAngles(ply:GetEyeTrace().HitNormal:Angle() + self.Structures[id].corrangle)
item.id = id
item.Owner = self:GetOwner()
item:Spawn()
self.LastEnt = item
self.Structures[id].count = self.Structures[id].count - 1
end
end
end)
if (Sprint == 0) then
if self.Owner:KeyDown(IN_SPEED) and (self.Owner:KeyDown(IN_FORWARD) || self.Owner:KeyDown(IN_BACK) || self.Owner:KeyDown(IN_MOVELEFT) || self.Owner:KeyDown(IN_MOVERIGHT)) then
Sprint = 1
end
end
if (Sprint == 1) then
self.Weapon:SendWeaponAnim(ACT_VM_SPRINT_IDLE)
Sprint = 2
end
if (Sprint == 2) then
if self.Owner:KeyReleased(IN_SPEED) then
self.Weapon:SendWeaponAnim(ACT_VM_IDLE)
Sprint = 0
end
end
end
end

View File

@@ -0,0 +1,231 @@
if CLIENT then
SWEP.WepSelectIcon = surface.GetTextureID("vgui/hud/weapon_doietoolus")
SWEP.DrawWeaponInfoBox = false
SWEP.BounceWeaponIcon = false
killicon.Add( "weapon_doietoolus", "vgui/hud/weapon_doietoolus", Color( 0, 0, 0, 255 ) )
end
SWEP.PrintName = "Entrenching Tool FPV"
SWEP.Category = "Engiener Tools"
SWEP.Spawnable= true
SWEP.AdminSpawnable= true
SWEP.AdminOnly = false
SWEP.ViewModelFOV = 60
SWEP.ViewModel = "models/weapons/doi/v_etool_us.mdl"
SWEP.WorldModel = "models/weapons/doi/w_etool_us.mdl"
SWEP.ViewModelFlip = false
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.Slot = 0
SWEP.SlotPos = 0
SWEP.UseHands = true
SWEP.HoldType = "melee2"
SWEP.FiresUnderwater = false
SWEP.DrawCrosshair = false
SWEP.DrawAmmo = true
SWEP.Base = "weapon_base"
SWEP.CSMuzzleFlashes = true
SWEP.Sprint = 0
SWEP.Primary.ClipSize = 0
SWEP.Primary.DefaultClip = 0
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "none"
SWEP.Secondary.ClipSize = 0
SWEP.Secondary.DefaultClip = 0
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.Structures = {
{
name = "FPV-дрон",
icon = "entities/entity.png",
cat = 0,
entity = "entity_drone_bomb",
count = 2,
id = 1,
corrangle = Angle(90,0,0)
},
{
name = "Разведывательный дрон",
icon = "entities/entity.png",
cat = 0,
entity = "entity_drone_base",
count = 1,
id = 2,
corrangle = Angle(90,0,0)
},
{
name = "РЭБ",
icon = "entities/entity.png",
cat = 0,
entity = "entity_dronejammer",
count = 1,
id = 3,
corrangle = Angle(90,0,0)
},
{
name = "Зарядная станция для дрона",
icon = "entities/entity.png",
cat = 0,
entity = "entity_dronepad",
count = 1,
id = 4,
corrangle = Angle(90,0,0)
},
}
function SWEP:Initialize()
self:SetWeaponHoldType( self.HoldType )
self:GetOwner().buildtime = 0
end
function SWEP:Deploy()
self:SetNextPrimaryFire( CurTime() + self.Owner:GetViewModel():SequenceDuration() )
self.Weapon:SendWeaponAnim( ACT_VM_DRAW )
Sprint = 0
end
function SWEP:Holster()
self.NextSecondaryAttack = 0
Sprint = 0
return true
end
function SWEP:PrimaryAttack()
if !(self.Weapon:GetNextPrimaryFire() < CurTime()) || not(Sprint == 0) then return end
self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
self.Owner:SetAnimation( PLAYER_ATTACK1 )
self:SetNextPrimaryFire( CurTime() + 1)
self:SetNextSecondaryFire( CurTime() + 1)
if SERVER then
net.Start("openmenu")
net.WriteTable(self.Structures)
net.Send(self:GetOwner())
end
end
function SWEP:SecondaryAttack()
end
function SWEP:Reload()
if SERVER then
local item = self:GetOwner():GetEyeTrace().Entity
if item:IsValid() then
local structure_id = item.structure_id
if structure_id != nil then
if item:GetOwner() == self:GetOwner() then
local struct = self.Structures[structure_id]
if (item:GetClass() == struct.entity) or (item:GetModel() == struct.model) then
item:Remove()
struct.count = struct.count + 1
end
end
end
end
end
end
function SWEP:DrawHUDBackground()
if self:GetOwner().buildtime > 0 then
draw.RoundedBox( 20, ScrW()/2-150, ScrH()/2-30, 0+300-self:GetOwner().buildtime*15, 60, Color( 50, 50, 50 , 180) )
draw.RoundedBox( 20, ScrW()/2-145, ScrH()/2-25, 0+290-self:GetOwner().buildtime*14.5, 50, Color( 0, 255, 0 ,125) )
draw.DrawText( tostring(100 - self:GetOwner().buildtime*5) .. '%', "Font3", ScrW()/2-20, ScrH()/2-15, Color( 255, 255, 255 ,255), 0 )
end
end
local delay = 0.5
local nextOccurance = 0
local flag1 = true
if CLIENT then
function SWEP:RenderScreen()
if self.Owner.buildtime < 0 or Sprint == 2 then
self.Weapon:SendWeaponAnim(ACT_VM_IDLE)
end
if input.IsKeyDown(KEY_F) and flag1 then
net.Start("buildstop12")
net.SendToServer()
self.Owner.building = false
self.Owner.buildtime = -3
flag1 = false
timer.Simple(1, function() flag1 = true end)
end
local timeLeft = nextOccurance - CurTime()
if timeLeft < 0 and self:GetOwner().buildtime >= 0 then
self:GetOwner().buildtime = self:GetOwner().buildtime - 0.5
self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
self:GetOwner():SetAnimation( PLAYER_ATTACK1 )
self:SetNextPrimaryFire( CurTime() + delay)
nextOccurance = CurTime() + delay
end
net.Receive("buildanim", function(len, ply)
self:GetOwner().buildtime = 20
end)
end
end
if SERVER then
function SWEP:Think()
net.Receive("buildstop12", function(len, ply)
ply:Freeze(false)
if self.LastEnt:IsValid() then
self.Structures[self.LastEnt.id].count = self.Structures[self.LastEnt.id].count + 1
self.LastEnt:Remove()
end
end)
net.Receive("setentity", function(len, ply)
if ply:GetActiveWeapon():GetClass() ~= "engineertoolfpv" then return end
local id = net.ReadInt(13)
local struct = self.Structures[id]
if struct and struct.count > 0 then
local trace = ply:GetEyeTrace()
if (trace.HitPos - trace.StartPos):Length() > 300 then return end
local item = ents.Create(struct.entity)
item:SetPos(trace.HitPos + trace.HitNormal * 10)
item:SetAngles(trace.HitNormal:Angle() + struct.corrangle)
item:Spawn()
struct.count = struct.count - 1
item.structure_id = id
if IsValid(ply) and ply:IsPlayer() then
item:SetOwner(ply)
end
end
end)
if (Sprint == 0) then
if self.Owner:KeyDown(IN_SPEED) and (self.Owner:KeyDown(IN_FORWARD) || self.Owner:KeyDown(IN_BACK) || self.Owner:KeyDown(IN_MOVELEFT) || self.Owner:KeyDown(IN_MOVERIGHT)) then
Sprint = 1
end
end
if (Sprint == 1) then
self.Weapon:SendWeaponAnim(ACT_VM_SPRINT_IDLE)
Sprint = 2
end
if (Sprint == 2) then
if self.Owner:KeyReleased(IN_SPEED) then
self.Weapon:SendWeaponAnim(ACT_VM_IDLE)
Sprint = 0
end
end
end
end

View File

@@ -0,0 +1,225 @@
if CLIENT then
SWEP.WepSelectIcon = surface.GetTextureID("vgui/hud/weapon_doietoolus")
SWEP.DrawWeaponInfoBox = false
SWEP.BounceWeaponIcon = false
killicon.Add( "weapon_doietoolus", "vgui/hud/weapon_doietoolus", Color( 0, 0, 0, 255 ) )
end
SWEP.PrintName = "Entrenching Tool MINES"
SWEP.Category = "Engiener Tools"
SWEP.Spawnable= true
SWEP.AdminSpawnable= true
SWEP.AdminOnly = false
SWEP.ViewModelFOV = 60
SWEP.ViewModel = "models/weapons/doi/v_etool_us.mdl"
SWEP.WorldModel = "models/weapons/doi/w_etool_us.mdl"
SWEP.ViewModelFlip = false
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.Slot = 0
SWEP.SlotPos = 0
SWEP.UseHands = true
SWEP.HoldType = "melee2"
SWEP.FiresUnderwater = false
SWEP.DrawCrosshair = false
SWEP.DrawAmmo = true
SWEP.Base = "weapon_base"
SWEP.CSMuzzleFlashes = true
SWEP.Sprint = 0
SWEP.Primary.ClipSize = 0
SWEP.Primary.DefaultClip = 0
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "none"
SWEP.Secondary.ClipSize = 0
SWEP.Secondary.DefaultClip = 0
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.Structures = {
{
name = "Мина 'ТМ-62'",
icon = "entities/entity.png",
cat = 0,
entity = "sw_mine_tm62_v3",
count = 10,
corrangle = Angle(90,0,0)
},
}
function SWEP:Initialize()
self:SetWeaponHoldType( self.HoldType )
self:GetOwner().buildtime = 0
end
function SWEP:Deploy()
self:SetNextPrimaryFire( CurTime() + self.Owner:GetViewModel():SequenceDuration() )
self.Weapon:SendWeaponAnim( ACT_VM_DRAW )
Sprint = 0
end
function SWEP:Holster()
self.NextSecondaryAttack = 0
Sprint = 0
return true
end
function SWEP:PrimaryAttack()
if !(self.Weapon:GetNextPrimaryFire() < CurTime()) || not(Sprint == 0) then return end
self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
self.Owner:SetAnimation( PLAYER_ATTACK1 )
self:SetNextPrimaryFire( CurTime() + 1)
self:SetNextSecondaryFire( CurTime() + 1)
if SERVER then
net.Start("openmenu")
net.WriteTable(self.Structures)
net.Send(self:GetOwner())
end
end
function SWEP:SecondaryAttack()
end
function SWEP:Reload()
if SERVER then
local item = self:GetOwner():GetEyeTrace().Entity
if item:IsValid() then
if item.id != nil then
if item.Owner == self:GetOwner() then
if (item:GetClass() == self.Structures[item.id].entity) or (item:GetModel() == self.Structures[item.id].model) then
item:Remove()
self.Structures[item.id].count = self.Structures[item.id].count + 1
end
end
end
end
end
end
function SWEP:DrawHUDBackground()
if self:GetOwner().buildtime > 0 then
draw.RoundedBox( 20, ScrW()/2-150, ScrH()/2-30, 0+300-self:GetOwner().buildtime*15, 60, Color( 50, 50, 50 , 180) )
draw.RoundedBox( 20, ScrW()/2-145, ScrH()/2-25, 0+290-self:GetOwner().buildtime*14.5, 50, Color( 0, 255, 0 ,125) )
draw.DrawText( tostring(100 - self:GetOwner().buildtime*5) .. '%', "Font3", ScrW()/2-20, ScrH()/2-15, Color( 255, 255, 255 ,255), 0 )
end
end
local delay = 0.5
local nextOccurance = 0
local flag1 = true
if CLIENT then
function SWEP:RenderScreen()
if self.Owner.buildtime < 0 or Sprint == 2 then
--print(1)
self.Weapon:SendWeaponAnim(ACT_VM_IDLE)
end
if input.IsKeyDown(KEY_F) and flag1 then
net.Start("buildstop12")
net.SendToServer()
self.Owner.building = false
self.Owner.buildtime = -3
flag1 = false
timer.Simple(1, function() flag1 = true end)
end
local timeLeft = nextOccurance - CurTime()
if timeLeft < 0 and self:GetOwner().buildtime >= 0 then
self:GetOwner().buildtime = self:GetOwner().buildtime - 0.5
self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
self:GetOwner():SetAnimation( PLAYER_ATTACK1 )
self:SetNextPrimaryFire( CurTime() + delay)
nextOccurance = CurTime() + delay
end
net.Receive("buildanim", function(len, ply)
print(2)
self:GetOwner().buildtime = 20
end)
end
end
if SERVER then
function SWEP:Think()
net.Receive("buildstop12", function(len, ply)
ply:Freeze(false)
if self.LastEnt:IsValid() then
self.Structures[self.LastEnt.id].count = self.Structures[self.LastEnt.id].count + 1
self.LastEnt:Remove()
end
end)
net.Receive("buildtrench", function(len, ply)
if ply:GetActiveWeapon():GetClass() != "engineertool" then return end
local id = net.ReadInt(13)
if (ply:GetEyeTrace().HitPos - ply:GetEyeTrace().StartPos):Length() <= 300 then
if self.Structures[id].count > 0 then
net.Start("buildanim")
net.WriteEntity(item)
net.Send(self:GetOwner())
local item = ents.Create("util_structure")
item:SetPos(ply:GetEyeTrace().HitPos)
item:SetAngles(ply:GetEyeTrace().HitNormal:Angle() + Angle(90,ply:EyeAngles().y,0))
item:SetModel(self.Structures[id].model)
item.hp = self.Structures[id].hp
item.id = id
item.poscoef = -100
item.building = true
item.Owner = self:GetOwner()
item:Spawn()
self.LastEnt = item
self.Structures[id].count = self.Structures[id].count - 1
end
end
end)
net.Receive("setentity", function(len, ply)
if ply:GetActiveWeapon():GetClass() != "engineertoolmines" then return end
local id = net.ReadInt(13)
if (ply:GetEyeTrace().HitPos - ply:GetEyeTrace().StartPos):Length() <= 300 then
if self.Structures[id].count > 0 then
local item = ents.Create(self.Structures[id].entity)
item:SetPos(ply:GetEyeTrace().HitPos + ply:GetEyeTrace().HitNormal * 40)
item:SetAngles(ply:GetEyeTrace().HitNormal:Angle() + self.Structures[id].corrangle)
item.id = id
item.Owner = self:GetOwner()
item:Spawn()
self.LastEnt = item
self.Structures[id].count = self.Structures[id].count - 1
end
end
end)
if (Sprint == 0) then
if self.Owner:KeyDown(IN_SPEED) and (self.Owner:KeyDown(IN_FORWARD) || self.Owner:KeyDown(IN_BACK) || self.Owner:KeyDown(IN_MOVELEFT) || self.Owner:KeyDown(IN_MOVERIGHT)) then
Sprint = 1
end
end
if (Sprint == 1) then
self.Weapon:SendWeaponAnim(ACT_VM_SPRINT_IDLE)
Sprint = 2
end
if (Sprint == 2) then
if self.Owner:KeyReleased(IN_SPEED) then
self.Weapon:SendWeaponAnim(ACT_VM_IDLE)
Sprint = 0
end
end
end
end

View File

@@ -0,0 +1,122 @@
if CLIENT then
SWEP.WepSelectIcon = surface.GetTextureID("vgui/hud/weapon_doietoolus")
SWEP.DrawWeaponInfoBox = false
SWEP.BounceWeaponIcon = false
killicon.Add( "weapon_doietoolus", "vgui/hud/weapon_doietoolus", Color( 0, 0, 0, 255 ) )
end
SWEP.PrintName = "Repair Tool"
SWEP.Category = "Engiener Tools"
SWEP.Spawnable= true
SWEP.AdminSpawnable= true
SWEP.AdminOnly = false
SWEP.ViewModelFOV = 60
SWEP.ViewModel = "models/weapons/doi/v_etool_us.mdl"
SWEP.WorldModel = "models/weapons/doi/w_etool_us.mdl"
SWEP.ViewModelFlip = false
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.Slot = 0
SWEP.SlotPos = 0
SWEP.UseHands = true
SWEP.HoldType = "melee2"
SWEP.FiresUnderwater = false
SWEP.DrawCrosshair = false
SWEP.DrawAmmo = true
SWEP.Base = "weapon_base"
SWEP.CSMuzzleFlashes = true
SWEP.Sprint = 0
SWEP.Primary.ClipSize = 0
SWEP.Primary.DefaultClip = 0
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "none"
SWEP.Secondary.ClipSize = 0
SWEP.Secondary.DefaultClip = 0
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
function SWEP:Initialize()
self:SetWeaponHoldType( self.HoldType )
end
function SWEP:Deploy()
self:SetNextPrimaryFire( CurTime() + self.Owner:GetViewModel():SequenceDuration() )
self.Weapon:SendWeaponAnim( ACT_VM_DRAW )
Sprint = 0
end
function SWEP:Holster()
self.NextSecondaryAttack = 0
Sprint = 0
return true
end
function SWEP:PrimaryAttack()
if !(self.Weapon:GetNextPrimaryFire() < CurTime()) || not(Sprint == 0) then return end
self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
self.Owner:SetAnimation( PLAYER_ATTACK1 )
self:SetNextPrimaryFire( CurTime() + 1)
self:SetNextSecondaryFire( CurTime() + 1)
if SERVER then
if self:GetOwner():GetEyeTrace().Entity.hp != self:GetOwner():GetEyeTrace().Entity.MaxHp then
self:GetOwner():GetEyeTrace().Entity.hp = self:GetOwner():GetEyeTrace().Entity.hp + 100
if self:GetOwner():GetEyeTrace().Entity.hp == self:GetOwner():GetEyeTrace().Entity.MaxHp then
self:GetOwner():GetEyeTrace().Entity.hp = self:GetOwner():GetEyeTrace().Entity.MaxHp
end
end
end
end
function SWEP:SecondaryAttack()
end
function SWEP:Reload()
end
function SWEP:DrawHUD()
if self:GetOwner():GetEyeTrace().Entity:GetClass() == 'util_structure'then
draw.RoundedBox( 20, ScrW()/2-150, ScrH()/2-30, 300, 60, Color( 50, 50, 50 , 180) )
local tW, tH = surface.GetTextSize(tostring(self:GetOwner():GetEyeTrace().Entity:GetNWInt("Hp")) ..' | '.. tostring(self:GetOwner():GetEyeTrace().Entity:GetNWInt("MaxHp")))
draw.RoundedBox( 20, ScrW()/2-145, ScrH()/2-25, self:GetOwner():GetEyeTrace().Entity:GetNWInt("Hp")*(290/self:GetOwner():GetEyeTrace().Entity:GetNWInt("MaxHp")), 50, Color( 0, 255, 0 ,125) )
draw.DrawText( tostring(self:GetOwner():GetEyeTrace().Entity:GetNWInt("Hp")) ..' | '.. tostring(self:GetOwner():GetEyeTrace().Entity:GetNWInt("MaxHp")), "Font3", ScrW()/2, ScrH()/2-15, Color( 255, 255, 255 ,255), 1 )
end
end
function SWEP:Think()
if SERVER then
if (Sprint == 0) then
if self.Owner:KeyDown(IN_SPEED) and (self.Owner:KeyDown(IN_FORWARD) || self.Owner:KeyDown(IN_BACK) || self.Owner:KeyDown(IN_MOVELEFT) || self.Owner:KeyDown(IN_MOVERIGHT)) then
Sprint = 1
end
end
if (Sprint == 1) then
self.Weapon:SendWeaponAnim(ACT_VM_SPRINT_IDLE)
Sprint = 2
end
if (Sprint == 2) then
if self.Owner:KeyReleased(IN_SPEED) then
self.Weapon:SendWeaponAnim(ACT_VM_IDLE)
Sprint = 0
end
end
end
end

View File

@@ -0,0 +1,74 @@
PLUGIN.name = "Fortifications"
PLUGIN.author = "Fortic (Портирован для Helix)"
PLUGIN.description = "Система строительства укреплений: окопы, баррикады, мешки с песком"
-- Конфигурация
ix.config.Add("fortificationsBuildingEnabled", true, "Включить систему строительства укреплений", nil, {
category = "Fortifications"
})
ix.config.Add("fortificationsMaxStructures", 50, "Максимальное количество структур на карте", nil, {
data = {min = 1, max = 200},
category = "Fortifications"
})
ix.config.Add("fortificationsBuildTime", 3, "Время постройки структуры (секунды)", nil, {
data = {min = 1, max = 30},
category = "Fortifications"
})
ix.config.Add("fortificationsRepairAmount", 100, "Количество HP восстановления за использование ремонтного инструмента", nil, {
data = {min = 10, max = 1000},
category = "Fortifications"
})
ix.config.Add("fortificationsSkinChangeEnabled", true, "Разрешить смену скинов сущностей (дроны, транспорт)", nil, {
category = "Fortifications"
})
-- Network strings
if SERVER then
util.AddNetworkString("openmenu")
util.AddNetworkString("setentity")
util.AddNetworkString("buildtrench")
util.AddNetworkString("buildanim")
util.AddNetworkString("buildstop12")
util.AddNetworkString("additem")
util.AddNetworkString("CheckAllowedEntity")
util.AddNetworkString("EntityAllowed")
util.AddNetworkString("RequestSkinData")
util.AddNetworkString("ReceiveSkinData")
util.AddNetworkString("ChangeEntitySkin")
end
function PLUGIN:Initialize()
print("[Fortifications] Система строительства загружена!")
end
-- Звуки оружия (регистрация дополнительных звуков)
for i = 1, 6 do
sound.Add({
name = "Universal.Draw",
channel = CHAN_ITEM,
volume = 1.0,
soundlevel = 75,
sound = "weapons/universal/uni_weapon_draw_0" .. i .. ".wav"
})
sound.Add({
name = "Universal.Holster",
channel = CHAN_ITEM,
volume = 1.0,
soundlevel = 75,
sound = "weapons/universal/uni_weapon_holster_0" .. i .. ".wav"
})
end
-- Клиентская часть
ix.util.Include("cl_menu.lua")
ix.util.Include("cl_skin.lua")
-- Серверная часть
ix.util.Include("sv_net.lua")
ix.util.Include("sv_skin.lua")

View File

@@ -0,0 +1 @@
-- Серверные сетевые события уже зарегистрированы в sh_plugin.lua

View File

@@ -0,0 +1,71 @@
-- Серверная часть смены скинов
local PLUGIN = PLUGIN
local allowedEntities = {
["entity_drone_base"] = true,
["entity_drone_bomb"] = true,
["sw_m1151"] = true,
["sw_gaz2330"] = true,
}
local skinNames = {
["entity_drone_base"] = {
[0] = "Стандартный дрон",
[1] = "Белый дрон",
[2] = "Медицинский дрон",
[3] = "Полицейский дрон",
[4] = "Блатной дрон",
[5] = "Золотой дрон",
[6] = "Дрон невидимка",
[7] = "Камуфляжный дрон",
[8] = "Потрёпаный дрон",
},
["entity_drone_bomb"] = {
[0] = "Стандартная бомба",
[1] = "Камуфляжная бомба",
[2] = "Золотая бомба",
},
["sw_m1151"] = {
[0] = "Стандартный M1151",
[1] = "Хамви Военной полиции",
},
["sw_gaz2330"] = {
[0] = "Стандартный GAZ-2330",
[1] = "ГАЗ-2330 Военной Полиции",
},
}
net.Receive("CheckAllowedEntity", function(len, ply)
local ent = net.ReadEntity()
if IsValid(ent) and allowedEntities[ent:GetClass()] then
net.Start("EntityAllowed")
net.Send(ply)
end
end)
net.Receive("RequestSkinData", function(len, ply)
local ent = net.ReadEntity()
if IsValid(ent) and allowedEntities[ent:GetClass()] then
local class = ent:GetClass()
local totalSkins = ent:SkinCount()
local skins = skinNames[class] or {}
net.Start("ReceiveSkinData")
net.WriteInt(totalSkins, 8)
net.WriteTable(skins)
net.Send(ply)
end
end)
net.Receive("ChangeEntitySkin", function(len, ply)
local ent = net.ReadEntity()
local skinID = net.ReadInt(8)
if IsValid(ent) and allowedEntities[ent:GetClass()] then
local totalSkins = ent:SkinCount() - 1
if skinID >= 0 and skinID <= totalSkins then
ent:SetSkin(skinID)
end
end
end)