local x,y,z = guiGetScreenSize ( )
local keyStateValue = 0
addEventHandler(\"onClientRender\",getRootElement(),
function ( )
if keyStateValue == 0 then
dxDrawRectangle(x+50,y+45,150,150,tocolor(0,0,0,255))
elseif keyStateValue == 1 then
dxDrawRectangle(x+50,y+45,150,150,tocolor(255,0,255,255))
end
end
)
function leptet_jobbra ()
if keyStateValue == 0 then
keyStateValue = keyStateValue + 1
end
end
function leptet_balra ()
if keyStateValue == 1 then
keyStateValue = keyStateValue - 1
end
end
bindKey(\"arrow_r\",\"down\",leptet_jobbra)
bindKey(\"arrow_l\",\"down\",leptet_balra)
local screenWidth, screenHeight = guiGetScreenSize()
local image = \"kep1.png\"
addEventHandler(\"onClientRender\", root, function()
dxDrawImage(screenWidth/2 - 300, screenHeight/2 - 200, 600, 400, image)
end)
bindKey(\"arrow_l\", \"down\", function()
image = \"kep1.png\"
end)
bindKey(\"arrow_r\", \"down\", function()
image = \"kep2.png\"
end)
vagy
local screenWidth, screenHeight = guiGetScreenSize()
local image = 1
addEventHandler(\"onClientRender\", root, function()
dxDrawImage(screenWidth/2 - 300, screenHeight/2 - 200, 600, 400, \"kep\" .. image .. \".png\")
end)
bindKey(\"arrow_l\", \"down\", function()
if image ~= 1 then
image = image - 1
end
end)
bindKey(\"arrow_r\", \"down\", function()
if image ~= 2 then
image = image + 1
end
end)