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 


Would someone show me an example

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
ZxPwds
Advanced Cheater
Reputation: 0

Joined: 27 Oct 2015
Posts: 59

PostPosted: Mon Apr 13, 2020 6:23 pm    Post subject: Would someone show me an example Reply with quote

Hello everybody, My name is zxpwd. I'm trying to make a trainer that would toggle an AA Script in lua if that is at all possible. or if someone can tell me how to do the following in lua.

I want to have it in this hotkey

CTRL + ALT + 1
(function,VK_CONTROL,VK_MENU,0x31)



Code:
[ENABLE]
Game.exe+35AABC:
db 90 90

[DISABLE]
Game.exe+35AABC:
db 75 11
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1532

PostPosted: Mon Apr 13, 2020 7:28 pm    Post subject: Reply with quote

Extracted from the example of atom0s.
I haven't tried it, hope it works. Wink

Code:
function Hack1(sender)
local script1 = ([[
[ENABLE]
Game.exe+35AABC:
db 90 90

[DISABLE]
Game.exe+35AABC:
db 75 11
]]);

-- Execute and enable the script..
local a, b = autoAssemble(script1, false);

if (a) then
    -- Disable the script?
    autoAssemble(script1, b);
end
end

htky=createHotkey(Hack1, VK_F8)

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
ZxPwds
Advanced Cheater
Reputation: 0

Joined: 27 Oct 2015
Posts: 59

PostPosted: Mon Apr 13, 2020 8:37 pm    Post subject: Reply with quote

Hey buddy I appreciate your quick answer Smile

I've edited your hotkey accordingly but it doesn't work?


Code:


----------------------------------------------------------------
----------------------START Name ESP------------------------
----------------------------------------------------------------
-- toggleValSetHp
--Ctrl+Alt+7
    --UDF1.lblNameEsp.Font.Color=0xfc0b03 -- BLUE
    --UDF1.lblNameEsp.Font.Color=0x000000 -- BLACK

function Hack1(sender)
local script1 = ([[
[ENABLE]
Gunz.exe+35AABC:
db 90 90

[DISABLE]
Gunz.exe+35AABC:
db 75 11
]]);

-- Execute and enable the script..
local a, b = autoAssemble(script1, false);

if (a) then
    -- Disable the script?
    autoAssemble(script1, b);

end
end

htky=createHotkey(Hack1, VK_CONTROL,VK_MENU,0x38) --Ctrl+Alt+8

----------------------------------------------------------------
---------------------END Name ESP---------------------------
----------------------------------------------------------------



I've made a label change color on activation to see if it's on or not. would you help me add it aswell?
UDF1.lblNameEsp.Font.Color=0xfc0b03 -- BLUE = on
UDF1.lblNameEsp.Font.Color=0x000000 -- BLACK = off

This is the code but I when I activate it, It doesn't work.

Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1532

PostPosted: Tue Apr 14, 2020 7:09 am    Post subject: Reply with quote

Code:
--local gHotkeyOn = false
function Hack1(sender)

local script1 = ([[
[ENABLE]
Gunz.exe+35AABC:
db 90 90

[DISABLE]
Gunz.exe+35AABC:
db 75 11
]]);

local a, b = autoAssemble(script1, false);
if (gHotkeyOn) then
gHotkeyOn=false
autoAssemble(script1, b);
print("false")
else
gHotkeyOn=true
autoAssemble(script1, b);
print("true")
end
end

htky=createHotkey(Hack1, VK_8)



ParkourPenguin wrote:
Look in defines.lua to see a list of all the key codes (search "VK_").


VK_8 .. VK_NUMPAD8

etc.

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Tue Apr 14, 2020 9:07 am    Post subject: Reply with quote

Code:
local yourAAScript,yourScriptDisableTable = [==[
[ENABLE]
Gunz.exe+35AABC:
db 90 90

[DISABLE]
Gunz.exe+35AABC:
db 75 11
]==]


function Hack1(sender)
   local status
   if (type(yourScriptDisableTable)~='table') then
      status,yourScriptDisableTable = autoAssemble(yourAAScript);
      if (status) then
         UDF1.lblNameEsp.Font.Color=0xfc0b03 -- BLUE = on
      end
   else
      status = autoAssemble(yourAAScript,yourScriptDisableTable);
      -- we do not care if it managed to disabled; if game process closes before you disable, you might not be able to re activate it, unless you trigger deactivate first;
      --if (status) then
         yourScriptDisableTable = nil;
         UDF1.lblNameEsp.Font.Color=0x000000 -- BLACK = off
      --end
   end
end



htky=createHotkey(Hack1, VK_CONTROL,VK_MENU,0x38) --Ctrl+Alt+8

_________________
I'm rusty and getting older, help me re-learn lua.
Back to top
View user's profile Send private message Visit poster's website
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