Hallo Community
Ich habe mich einmal an einem Dx Button versucht.
Lua
local B1x, B1y, B1w, B1h = screenW / 2 - 300 / 2, screenH / 2 - 300 / 2 + 30 + 20 + 50*0, 300, 50
local B2x, B2y, B2w, B2h = screenW / 2 - 300 / 2, screenH / 2 - 300 / 2 + 30 + 40 + 50*1, 300, 50
local B3x, B3y, B3w, B3h = screenW / 2 - 300 / 2, screenH / 2 - 300 / 2 + 30 + 60 + 50*2, 300, 50
guiSetInputEnabled(true)
function isCursorOnElement(cursorx,cursory,x,y,w,h)
if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then
return true
else
return false
end
end
addEventHandler("onClientClick", getRootElement(),
function(btn, state, cursorX, cursorY)
outputChatBox("true1")
if btn == "left" and state == "down" then
if isCursorOnElement(cursorX, cursorY, B1x, B1y, B1w, B1h) then
outputChatBox("true")
end
end
end
)
Alles anzeigen
B1x, B1y, B1w, B1h sind die Koordinaten und höhe und breite von dem Button.
Das Dx Rectangle ist weiter oben definiert.
Wenn ich aber auf den Button klicke passiert gar nichts *pinch*
Ich hoffe mir kann jemand helfen.