Try this
[client-side]
function onClientClick(button, state)
if button == "left" and state == "down" then
for k, v in ipairs(fegyverek) do
if isInBox(screenW * 0.5703, screenH * 0.2700+(elem * 49.5), screenW * 0.0656, screenH * 0.0269) then
fegyver = k
end
end
if isInBox(screenW * 0.5703, screenH * 0.2700+(elem * 49.5), screenW * 0.0656, screenH * 0.0269) then
if fegyver == 3 then
outputChatBox("asd")
end
end
end
end
addEventHandler("onClientClick", root, onClientClick)
function isInBox(xS,yS,wS,hS)
local sx,sy = getCursorPosition ()
local fx,fy = guiGetScreenSize()
cursorx,cursory = sx*fx,sy*fy
if cursorx > xS and cursorx < xS + wS and cursory > yS and cursory < yS + hS then
return true
else
return false
end
end
EDIT: Not tested