Since some people could feel safer using keyboard and mouse clicks, i thought why not release them in LUA.
Here is some code example:
MOUSEEVENTF_LEFTDOWN = 0x0002;
MOUSEEVENTF_LEFTUP = 0x0004;
MOUSEEVENTF_RIGHTDOWN = 0x0008;
MOUSEEVENTF_RIGHTUP = 0x0010;
KEYEVENTF_KEYUP = 0x0002;
OnTick(function()
if KeyIsDown(0x11) then --CTRL key
mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0); --perform right click
mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0);
end
--if KeyIsDown(0x12) then --ALT key --if we set up holding down a key it doesn't work
SetCursorPos(WINDOW_W/2,WINDOW_H/2); --set cursor at center of the screen
keybd_event(string.byte("Q"), MapVirtualKey(string.byte("Q"), 0), 0, 0); --press Q
keybd_event(string.byte("Q"), MapVirtualKey(string.byte("Q"), 0), KEYEVENTF_KEYUP, 0);
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); --left click with mouse in case user does not have smartcast enabled
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
--end
end)
Sign In
Create Account
This topic is locked
Back to top
Report







