local sitText = "Садитесь в машину..."
local sitTextAlpha = 0
local sitTextPanel
local function createSitText()
sitTextPanel = vgui.Create("DPanel")
sitTextPanel:SetSize(ScrW(), ScrH())
sitTextPanel:SetPos(0,0)
sitTextPanel.Paint = function(self, w, h)
draw.SimpleText(sitText, "DermaLarge", w / 2, h / 2, Color(255, 255, 255, sitTextAlpha), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
end
sitTextPanel:SetVisible(false)
end
local function handleSitAnim(ply, vehicle)
if ply:InVehicle() then
sitTextPanel:SetVisible(true)
local anim = Derma_Anim("SitAnim", sitTextPanel, function(pnl, anim, delta, data)
sitTextAlpha = 255 * delta
if anim.Finished then
sitTextPanel:SetVisible(false)
sitTextAlpha = 0
end
end)
anim:Start(1)
end
end
hook.Add("PlayerEnteredVehicle", "HandleSitAnim", handleSitAnim)
createSitText()