Here is another version where it gives a time limit to read the message and if you go back to it, it will tell you that it has been read before as well as show the message.
--Of course this script is only any good for one message to be shown
--no matter how many entities it is put on..
note_sonic = 0 --This is not used at all through the script..
timesread = {}
--START OF FRAME
function sparck_note_init(e)
note = 0
timesread[e] = 0
notetext = "nota"
stop = 0
pausetime = 0
secondstopause = 15 --The ammount of seconds that you want to pause..
end
--ALWAYS--
function sparck_note_main(e) --You forgot to put main here..
PlayerDist=GetPlayerDistance(e)
if(PlayerDist < 200) and (g_PlayerHealth > 0) then
if note == 0 then --With this slight change you get rid of this prompt when the note is showing..
Prompt ("Press E to Read Note")
--ON PRESS E SHOW Note
if g_KeyPressE == 1 then
note = note + 1 --Stop this prompt from happenning..
PlaySound(e,0)
timesread[e] = timesread[e] + 1
currenttime = os.time()
pausetime = currenttime + secondstopause --Get the current time plus seconds to pause in seconds..
--Not sure why you wanted this but you did not need to put the e between the brackets..
FreezePlayer()
end
end
if note > 0 then
if os.time() <= pausetime then
--note = note + 1 --Don't no why you need this here, it works fine without it..
--This will put the text at x and y and give it the size 3..
--Text(x,y,size,'Text')
if timesread[e] >= 2 then
Text(28,37,3, "This Note has been read before.")
Text(28,41,3, notetext)
else
Text(28,40,3, notetext)
end
else
UnFreezePlayer()
note = 0
pausetime = 0
end
end
--end
end
--PromptLocal(e,os.time() .. ", " .. pausetime)
end
HP Pavilion Laptop - AMD A8-4555M APU with Radeon(tm) HD Graphics - 1.6GHz, 8GB Memory, Windows 10 Home, 64-bit Operating System.
I've got something to say - It's better to burn out than fade away.