Thanks guys
I got the progress bar working with this script
-- LUA Script - precede every function and global member with lowercase name of script + '_main'
-- Countdown Timer
local sprWidth = 60
local sprHeight = 5
local startcount = 0
local sborder = LoadImage("scriptbank\\images\\counter\\border_bar.png")
local spri = LoadImage("scriptbank\\images\\counter\\counter_bar.png")
local counterSpr = 0
local borderSpr = 0
function downcount_init(e)
secondsleft = 0
counter = 0
max = 60 -- seconds
counterSpr = CreateSprite(spri)
--max = max*1000
SetSpriteSize(counterSpr,sprWidth,sprHeight)
SetSpritePosition(counterSpr,3,2)
borderSpr = CreateSprite(sborder)
SetSpriteSize(borderSpr,98,7)
SetSpritePosition(borderSpr,1,1)
end
function downcount_main(e)
if g_Entity[e]['plrinzone']==1 and startcount==0 then
StartTimer(e)
startcount=1
end
if GetTimer(e) >= counter*1000 and GetTimer(e) < counter*1000+1000 then
PromptTextSize(5)
w = 98*(secondsleft/max)
SetSpriteSize(counterSpr,w,sprHeight)
Prompt("Time left:" .. secondsleft)
end
if GetTimer(e) >=counter*1000+1000 and startcount==1 then
counter=counter+1
secondsleft=max-counter
if secondsleft == 0 then
HurtPlayer(e,g_PlayerHealth)
startcount=0
secondsleft = 0
counter = 0
end
end
if g_Entity[e]['plrinzone']==0 then
startcount=0
counter=0
end
end
Secondly. You can collect "milk bottles" , that "increase the time ( secondsleft) with 5, if you hit them with this script
function counterhealth_init(e)
countadd = 0
end
function counterhealth_main(e)
PlayerDist = GetPlayerDistance(e)
if PlayerDist < 80 and g_PlayerHealth > 0 then
Prompt("Collected Bonus")
PlaySound(e,0)
secondsleft = secondsleft + 5
Destroy(e)
end
end
It kind off working..., but the progress and Prompt increase with 5 for a split second, and then back to the original count value
any advice please?
Nothing is impossible,
Your mind is the Limit!!!
Cubemaps -> Skymaps GUI creator - Thread
Super Fast File Scanner - Thread