Using this script for an in game project. It works fine the way it is but I was trying to get it so pressing "y" or "n" would keep the text on screen until they are pressed again. I have been studying the scripts in the forum that deal with this type of thing (toggling huds, text, etc.) but I just can't seem to get my brain to figure it out and make it work in this script. Can you possibly show me what I need to add to get it right? Any help would be greatly appreciated!
--Use Y and N (21 and 49)
pressed = 0
function task_result_init(e)
end
function task_result_main(e)
if GetPlayerDistance(e) < 120 then
PromptDuration("Did you successfully complete the task? Y, N",1000)
end
if GetPlayerDistance(e) < 200 and
GetScancode() == 21 and pressed == 0 then
pressed = 1
end
if GetPlayerDistance(e) < 200 and
pressed == 1 then
TextCenterOnX(50,45,5,"Great Job! Success!")
end
if GetScancode() == 0 then
pressed = 0
end
if GetPlayerDistance(e) < 200 and
GetScancode() == 49 and pressed == 0 then
pressed = 2
end
if GetPlayerDistance(e) < 200 and
pressed == 2 then
TextCenterOnX(50,45,5,"Failure!")
end
if GetScancode() == 0 then
pressed = 0
end
function task_result_exit(e)
end
end