GM:GUIMouseReleased problem.

I’m working on my first gamemode, but I have ran into a major issue. I am still new to lua, so if my issue relates to inexperience I apologize.

I am attempting to select multiple NPCs within a box. I am using GM:GUIMousePressed to obtain the first vector, and GM:GUIMouseReleased to obtain the second vector. GM:GUIMouseReleased doesn’t always fire when the mouse is released, however. If I click one point without holding down my mouse, and then click another point without holding down my mouse, the second click is GM:GUIMouseReleased.

I appreciate any help or solutions you can provide.

-snip-

Just tried that hook again, worked fine

[lua]
function GM:GUIMousePressed(mCode, aimVec)
print(mCode, aimVec)
end
[/lua]

My issue is with MouseReleased, not MousePressed. MousePressed is working perfectly for me as well. MouseReleased is currently firing on your second click, rather than when then mouse click was released. Your solution, utilizing the think hook, should work for me.

Thanks for the help.

I just tested it again and both hook’s work for me.

I’m also assuming that these hooks are assuming that the cursor is visible at all times.

Which means you can’t call “gui.EnableScreenClicker(false)” or else it won’t call the Released hook.

I rebooted my server and it now functions fine. Odd that it required a reboot, but I am just happy its working. Thanks again for the help Brandon.