Scripts / Remove Image Zone based on a timer.

Author
Message
thatandplaygames
4
Years of Service
User Offline
Joined: 12th Feb 2020
Location: In a creative space
Posted: 24th May 2022 14:33
My script to remove a textzone works with this timer but I'm having issues with removing the image zone. I want the image to display for a few seconds and then removed.

g_myimage = {}
g_mysprite = {}
g_myangle = {}
local wait_duration = 1000
function imageinzonetimer_init(e)
g_myimage[e] = LoadImage(GetEntityString(e,0))
g_mysprite[e] = 0
g_myangle[e] = 0
end

function imageinzonetimer_main(e)
if g_Entity[e]['plrinzone']==1 then
if g_mysprite[e] == 0 then
g_mysprite[e] = CreateSprite ( g_myimage[e] )
end
SetSpriteDepth ( g_mysprite[e], 100 )
aspectratio = GetImageWidth(g_myimage[e]) / GetImageHeight(g_myimage[e])
SetSpriteSize ( g_mysprite[e], 50*aspectratio, 50 )
SetSpriteOffset ( g_mysprite[e], 25*aspectratio, 25 )
SetSpritePosition ( g_mysprite[e], 50, 50 )
--g_myangle[e] = g_myangle[e] + 0.1
--SetSpriteAngle( g_mysprite[e], g_myangle[e] )
--SetSpriteColor ( g_mysprite[e], math.random(0,255), math.random(0,255), math.random(0,255), 255 )
if GetTimer(e) >= wait_duration then
---Spawn(4)
Destroy(e)
end
else
StartTimer(e)
end

end

Login to post a reply

Server time is: 2024-12-22 01:25:01
Your offset time is: 2024-12-22 01:25:01