Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


How to deactivate button when another button activate?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
mvpdez
How do I cheat?
Reputation: 0

Joined: 27 May 2017
Posts: 1

PostPosted: Sat May 27, 2017 9:07 pm    Post subject: How to deactivate button when another button activate? Reply with quote

Can some one help me with this?
I want to make it when mb4 is activated, press mb5 to activate mb5 and deactivate mb4.
Right now with this code when mb4 is activated while press mb5 and mb9, all three mouse button function are still enable.

Code:
function OnEvent(event, arg)
    OutputLogMessage("event = %s, arg = %d\n", event, arg)
    if (event == "PROFILE_ACTIVATED") then
        EnablePrimaryMouseButtonEvents(true)
   elseif event == "PROFILE_DEACTIVATED" then
        ReleaseMouseButton(2)  -- to prevent it from being stuck on
   end
    if (event == "MOUSE_BUTTON_PRESSED" and arg == 4) then
        recoildot = not recoildot
        spot = not spot
    end
   if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and recoildot) then
        if recoildot then
            repeat
                --Sleep(9)
                Sleep(9)
                MoveMouseRelative(0, 2)
            until not IsMouseButtonPressed(1)
        end
    end
    if (event == "MOUSE_BUTTON_PRESSED" and arg == 5) then
        recoilx4 = not recoilx4
        spot = not spot
    end
   if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and recoilx4) then
        if recoilx4 then
            repeat
                --Sleep(5)
                Sleep(9)
                MoveMouseRelative(0, 5)
            until not IsMouseButtonPressed(1)
        end
    end
    if (event == "MOUSE_BUTTON_PRESSED" and arg == 9) then
        recoilx9 = not recoilx9
        spot = not spot
    end
   if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and recoilx9) then
        if recoilx9 then
            repeat
                --Sleep(9)
                Sleep(9)
                MoveMouseRelative(0, 7)
            until not IsMouseButtonPressed(1)
        end
    end   
end
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites