Hi everyone, I'm currently working on a script that when you are injured and you come to a first aid kit, you hold E for 3 secs to heal - like any other games like Payday, PUBG,... A progress bar will also show up during that 3 secs. The matter is that there is something wrong with my script that it won't work, it just heals immediately when I press E. Any ideas? Thanks in advance!
cond = 0
function patching_init(e)
LoadImages("zomteria\\healing",0)
SetImagePosition(0,0)
SetImageAlignment(1)
end
function patching_main(e)
PlayerDist = GetPlayerDistance(e)
if PlayerDist == 50 then
PromptLocal(e,"Hold E to heal")
if g_KeyPressE == 1 and g_PlayerHealth < 100 then
cond = 1
if g_KeyPressE == 1 and GetTimer(e) == 1000 then
ShowImage(0)
end
if g_KeyPressE == 1 and GetTimer(e) == 2000 then
ShowImage(1)
end
if g_KeyPressE == 1 and GetTimer(e) == 3000 then
ShowImage(2)
end
if g_KeyPressE == 1 and GetTimer(e) > 3000 then
AddPlayerHealth(e)
Prompt("Healed")
PlaySound(e,0)
ActivateIfUsed(e)
end
end
end
end
function start_time_init(e)
end
function start_time_main(e)
if cond == 1 then
StartTimer(e)
end
end
The author of this post has marked a post as an answer.
Go to answer