Как добавить при спавне пропа анимацию , которую я нашёл в контенте при декомпилировании?
Вот код который вызывает проп
local COOLDOWN_DURATION = 1 – Продолжительность кулдауна (в секундах)
local TIMER_DELAY = 6 – Задержка перед удалением модели (в секундах)
local DISAPPEAR_DELAY = 1 – Задержка перед исчезновением пропа (в секундах)
local DAMAGE_DELAY = 0.2 – Задержка перед нанесением урона (в секундах)
local DAMAGE_RADIUS = 100 – Радиус урона
local isCooldownActive = false
local cooldownEndTime = 0
– Хук для обработки нажатия на кнопку IN_USE
hook.Add(“KeyPress”, “TokyoGhoulRP_OnKeyPress”, function(player, key)
if key == IN_USE then
if isCooldownActive then
local currentTime = CurTime()
if currentTime < cooldownEndTime then
local remainingTime = math.ceil((cooldownEndTime - currentTime) * 100) / 100
player:ChatPrint(“Способность в перезарядке еще " … remainingTime … " секунд”)
return
end
end
if not player:IsOnGround() then
player:ChatPrint("Находитесь в воздухе")
return
end
local weapon = player:GetActiveWeapon()
if IsValid(weapon) and weapon:GetClass() == "weapon_rinkaku" then
isCooldownActive = true
cooldownEndTime = CurTime() + COOLDOWN_DURATION
local prop = ents.Create("prop_physics")
prop:SetModel("models/attaque_v11/foc_attaque1.mdl")
prop:SetPos(player:GetPos() + Vector(0, 0, 100))
prop:SetCollisionGroup(COLLISION_GROUP_WORLD)
prop:Spawn()
prop:Activate()
prop:GetPhysicsObject():EnableMotion(false)
timer.Simple(COOLDOWN_DURATION, function()
isCooldownActive = false
end)
timer.Simple(DISAPPEAR_DELAY, function()
if IsValid(prop) then
prop:Remove()
end
end)
-- Таймер для нанесения урона с задержкой
timer.Simple(DISAPPEAR_DELAY - DAMAGE_DELAY, function()
if IsValid(prop) then
local propPos = prop:GetPos()
local entities = ents.FindInSphere(propPos, DAMAGE_RADIUS)
for _, ent in ipairs(entities) do
if ent ~= player and ent:IsPlayer() then
ent:TakeDamage(20, player, player)
end
end
end
end)
end
end
end)
Пример(Видео)
Garrysmod 2023.05.19 - 23.03.33.04.rar (4,7 МБ)