This post has been marked by the post author as the answer.
Try this one.
item_name = {}
local livre2_pressed = 0
local imgtimer = nil or 0
function book1_init_name(e,name)
item_name[e] = name
LoadImages("book1",0)
end
function book1_main(e)
PlayerDist = GetPlayerDistance(e)
if PlayerDist < 100 then
PromptDuration("Press E to read the book",3000)
if g_KeyPressE == 1 and livre2_pressed == 0 then
if item_name[e] == "Barrel (Acid)1" then
SetImagePosition(50,50)
ShowImage(0)
PlaySound(e,0)
livre2_pressed = 1
StartTimer(e)
elseif item_name[e] == "Barrel (Acid)2" then
SetImagePosition(50,50)
ShowImage(1)
PlaySound(e,0)
livre2_pressed = 1
StartTimer(e)
elseif item_name[e] == "Barrel (Acid)3" then
SetImagePosition(50,50)
ShowImage(2)
PlaySound(e,0)
livre2_pressed = 1
StartTimer(e)
elseif item_name[e] == "Barrel (Acid)4" then
SetImagePosition(50,50)
ShowImage(3)
PlaySound(e,0)
livre2_pressed = 1
StartTimer(e)
end --item_name[e]
end --g_KeyPressE
if GetTimer(e) > 8000 then HideImage(0) end
end --PlayerDist
if g_KeyPressE == 0 then
livre2_pressed = 0
end
end --main
hth
Edit: Enter the images in your folder, in the video I have: scriptbank> images> book1> and the 4 images.
Notice images names such as 000,001,002,003.
In video I Named each barrel such as Barrel (Acid)1, Barrel (Acid)2, Barrel (Acid)3, Barrel (Acid)4.
Attach the script to each trigger entity, in the video 4 barrels.
Each barrel show you a different pic.
You can ask again and again to watch the pics, books or wharever image, you want to.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz
OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4