function isCursorOnElement(x,y,w,h)
local mx,my = getCursorPosition ()
local fullx,fully = guiGetScreenSize()
cursorx,cursory = mx*fullx,my*fully
if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then
return true
else
return false
end
end
asd = 0
local screenW, screenH = guiGetScreenSize()
i = {}
i[1] = ""
i[2] = ""
i[3] = ""
i[4] = ""
i[5] = ""
i[6] = ""
i[7] = ""
i[8] = ""
i[9] = ""
i[10] = ""
i[11] = ""
i[12] = ""
addEvent("giveInv",true)
function invgive(inv1,inv2,inv3,inv4,inv5,inv6,inv7,inv8,inv9,inv10,inv11,inv12)
i[1] = tostring(inv1)
i[2] = tostring(inv2)
i[3] = tostring(inv3)
i[4] = tostring(inv4)
i[5] = tostring(inv5)
i[6] = tostring(inv6)
i[7] = tostring(inv7)
i[8] = tostring(inv8)
i[9] = tostring(inv9)
i[10] = tostring(inv10)
i[11] = tostring(inv11)
i[12] = tostring(inv12)
end
addEventHandler("giveInv",root,invgive)
interakcja = {
["jablko"] = function() outputChatBox("jesz jablko hehe",255,255,255,true) end,
["Pieni?dze"] = function() outputChatBox("#00ff00Posiadasz ich: "..getPlayerMoney(localPlayer),255,255,255,true) end,
}
addEventHandler("onClientRender", root,
function()
if asd == 1 then
dxDrawRectangle(screenW * 0.6750, screenH * 0.3919, screenW * 0.3206, screenH * 0.4544, tocolor(133, 247, 0, 150), false)
dxDrawRectangle(screenW * 0.6823, screenH * 0.4049, screenW * 0.3067, screenH * 0.4284, tocolor(0, 0, 0, 200), false)
dxDrawRectangle(screenW * 0.6896, screenH * 0.4180, screenW * 0.0673, screenH * 0.1094, tocolor(133, 247, 0, 100), false)
dxDrawRectangle(screenW * 0.6896, screenH * 0.5404, screenW * 0.0673, screenH * 0.1094, tocolor(133, 247, 0, 100), false)
dxDrawRectangle(screenW * 0.6896, screenH * 0.6628, screenW * 0.0673, screenH * 0.1094, tocolor(133, 247, 0, 100), false)
dxDrawRectangle(screenW * 0.7643, screenH * 0.4180, screenW * 0.0673, screenH * 0.1094, tocolor(133, 247, 0, 100), false)
dxDrawRectangle(screenW * 0.7643, screenH * 0.5404, screenW * 0.0673, screenH * 0.1094, tocolor(133, 247, 0, 100), false)
dxDrawRectangle(screenW * 0.8389, screenH * 0.4180, screenW * 0.0673, screenH * 0.1094, tocolor(133, 247, 0, 100), false)
dxDrawRectangle(screenW * 0.9136, screenH * 0.4180, screenW * 0.0673, screenH * 0.1094, tocolor(133, 247, 0, 100), false)
dxDrawRectangle(screenW * 0.8389, screenH * 0.5404, screenW * 0.0673, screenH * 0.1094, tocolor(133, 247, 0, 100), false)
dxDrawRectangle(screenW * 0.9143, screenH * 0.5404, screenW * 0.0673, screenH * 0.1094, tocolor(133, 247, 0, 100), false)
dxDrawRectangle(screenW * 0.7643, screenH * 0.6628, screenW * 0.0673, screenH * 0.1094, tocolor(133, 247, 0, 100), false)
dxDrawRectangle(screenW * 0.8389, screenH * 0.6628, screenW * 0.0673, screenH * 0.1094, tocolor(133, 247, 0, 100), false)
dxDrawRectangle(screenW * 0.9143, screenH * 0.6628, screenW * 0.0673, screenH * 0.1094, tocolor(133, 247, 0, 100), false)
dxDrawText(i[1], screenW * 0.6896, screenH * 0.4193, screenW * 0.7570, screenH * 0.5273, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
dxDrawText(i[2], screenW * 0.7643, screenH * 0.4193, screenW * 0.8316, screenH * 0.5273, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
dxDrawText(i[3], screenW * 0.8389, screenH * 0.4193, screenW * 0.9063, screenH * 0.5273, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
dxDrawText(i[4], screenW * 0.9143, screenH * 0.4193, screenW * 0.9817, screenH * 0.5273, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
dxDrawText(i[5], screenW * 0.6896, screenH * 0.5404, screenW * 0.7570, screenH * 0.6484, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
dxDrawText(i[6], screenW * 0.7643, screenH * 0.5404, screenW * 0.8316, screenH * 0.6484, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
dxDrawText(i[7], screenW * 0.8389, screenH * 0.5404, screenW * 0.9063, screenH * 0.6484, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
dxDrawText(i[8], screenW * 0.9136, screenH * 0.5417, screenW * 0.9810, screenH * 0.6497, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
dxDrawText(i[9], screenW * 0.6896, screenH * 0.6615, screenW * 0.7570, screenH * 0.7695, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
dxDrawText(i[10], screenW * 0.7643, screenH * 0.6641, screenW * 0.8316, screenH * 0.7721, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
dxDrawText(i[11], screenW * 0.8389, screenH * 0.6628, screenW * 0.9063, screenH * 0.7708, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
dxDrawText(i[12], screenW * 0.9136, screenH * 0.6628, screenW * 0.9810, screenH * 0.7708, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
end
end
)
bindKey("I", "up",function()
if asd == 0 then
triggerServerEvent("pobierzSloty",localPlayer,localPlayer)
asd = 1
showCursor(true)
else
showCursor(false)
asd = 0
end
end)
addEventHandler("onClientClick", root,function()
if isCursorOnElement(screenW * 0.6896, screenH * 0.4193, screenW * 0.7570, screenH * 0.5273) and getKeyState("mouse1") then
if interakcja[i[1]] then
interakcja[i[1]]()
end
elseif isCursorOnElement(screenW * 0.7643, screenH * 0.4193, screenW * 0.8316, screenH * 0.5273) and getKeyState("mouse1") then
if interakcja[i[2]] then
interakcja[i[2]]()
end
elseif isCursorOnElement(screenW * 0.8389, screenH * 0.4193, screenW * 0.9063, screenH * 0.5273) and getKeyState("mouse1") then
if interakcja[i[3]] then
interakcja[i[3]]()
end
elseif isCursorOnElement(screenW * 0.9143, screenH * 0.4193, screenW * 0.9817, screenH * 0.5273) and getKeyState("mouse1") then
if interakcja[i[4]] then
interakcja[i[4]]()
end
elseif isCursorOnElement(screenW * 0.6896, screenH * 0.5404, screenW * 0.7570, screenH * 0.6484) and getKeyState("mouse1") then
if interakcja[i[5]] then
interakcja[i[5]]()
end
elseif isCursorOnElement( screenW * 0.7643, screenH * 0.5404, screenW * 0.8316, screenH * 0.6484) and getKeyState("mouse1") then
if interakcja[i[6]] then
interakcja[i[6]]()
end
elseif isCursorOnElement(screenW * 0.8389, screenH * 0.5404, screenW * 0.9063, screenH * 0.6484) and getKeyState("mouse1") then
if interakcja[i[7]] then
interakcja[i[7]]()
end
elseif isCursorOnElement(screenW * 0.9136, screenH * 0.5417, screenW * 0.9810, screenH * 0.6497) and getKeyState("mouse1") then
if interakcja[i[8]] then
interakcja[i[8]]()
end
elseif isCursorOnElement(screenW * 0.6896, screenH * 0.6615, screenW * 0.7570, screenH * 0.7695) and getKeyState("mouse1") then
if interakcja[i[9]] then
interakcja[i[9]]()
end
elseif isCursorOnElement(screenW * 0.7643, screenH * 0.6641, screenW * 0.8316, screenH * 0.7721) and getKeyState("mouse1") then
if interakcja[i[10]] then
interakcja[i[10]]()
end
elseif isCursorOnElement(screenW * 0.8389, screenH * 0.6628, screenW * 0.9063, screenH * 0.7708) and getKeyState("mouse1") then
if interakcja[i[11]] then
interakcja[i[11]]()
end
elseif isCursorOnElement(screenW * 0.9136, screenH * 0.6628, screenW * 0.9810, screenH * 0.7708) and getKeyState("mouse1") then
if interakcja[i[12]] then
interakcja[i[12]]()
end
end
end)