HU/IsInSlot: Difference between revisions
Jump to navigation
Jump to search
(→Syntax) |
|||
| Line 6: | Line 6: | ||
írta '''Petrik''' | írta '''Petrik''' | ||
==Code== | |||
<section name="Client" class="client" show="true"> | |||
<syntaxhighlight lang="lua"> | |||
local x,y = guiGetScreenSize() | |||
function isInSlot(dX, dY, dSZ, dM) --Creating function isInSlot | |||
if isCursorShowing() then --If your cursor showing | |||
local cX ,cY = getCursorPosition() --Get your cursor position | |||
cX,cY = cX*x , cY*y --Get cursor position on the resolution | |||
if(cX >= dX and cX <= dX+dSZ and cY >= dY and cY <= dY+dM) then --If cursor in the position given | |||
return true, cX, cY --If in the position return true | |||
else | |||
return false --If not in the position return false | |||
end | |||
end | |||
end | |||
</syntaxhighlight> | |||
</section> | |||
Revision as of 20:00, 3 November 2019
Szintaxis
isInSlot(x, y, width, height)
Returns
Ha a cursor a dobozban van akkor a visszatérési érték 'igaz' különben pedig 'hamis'
írta Petrik
Code
Click to collapse [-]
Client local x,y = guiGetScreenSize()
function isInSlot(dX, dY, dSZ, dM) --Creating function isInSlot
if isCursorShowing() then --If your cursor showing
local cX ,cY = getCursorPosition() --Get your cursor position
cX,cY = cX*x , cY*y --Get cursor position on the resolution
if(cX >= dX and cX <= dX+dSZ and cY >= dY and cY <= dY+dM) then --If cursor in the position given
return true, cX, cY --If in the position return true
else
return false --If not in the position return false
end
end
end