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 


Having problem with LUA trainers

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

Joined: 10 Apr 2013
Posts: 87

PostPosted: Sat Apr 13, 2013 10:59 am    Post subject: Having problem with LUA trainers Reply with quote

ok this is my script i done in Lua but its not working everytime i run it . it shows acces violation and if i save it as .exe the form doesnt show up

Code:
form_show(UDF1)

function FlashPlayer()
openProcess("FlashPlayerPlugin")
local op = getOpenedProcessID()
 if op==0 then
 showMessage("Failed to attach, program is shutting down..")
 CloseClick()
 else
 control_setCaption(CETrainer_CELabel2, "Attached successfully!")
 end
end
createHotkey(FlashPlayer, VK_CONTROL, VK_F2)


function CEButton1Click(sender)

check = 0 -- I love to compare between on/off
script = addresslist_getMemoryRecordByDescription(getAddressList(), "ENERGY HACK") -- Change AutoAssembler according to your script description
function Enable()
if check==0 then memoryrecord_freeze(script) else memoryrecord_unfreeze(script)end
end

end


function CEButton2Click(sender)
check = 0 -- I love to compare between on/off
script = addresslist_getMemoryRecordByDescription(getAddressList(), "HEALTH") -- Change AutoAssembler according to your script description
function Enable()
if check==0 then memoryrecord_freeze(script) else memoryrecord_unfreeze(script)end
end
end





also i have following AA codes saved in my CT

this AA script is stored as name ENERGY HACK


Code:
[ENABLE]
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)
label(restoreenergy1)
registersymbol(restoreenergy1)
aobscan(hack,8B 0E 89 4D DC 8B 46 04 8B 73 0C 8B 56 08 8B 72 14 89 81 ?? ?? ?? ?? 8B 41 18 85 C0)
newmem:
originalcode:
add [ecx+000000DC],#60
exit:
jmp returnhere

hack+11:
restoreenergy1:
jmp newmem
nop
returnhere:

[DISABLE]
mov [ecx+000000DC],eax
unregistersymbol(restoreenergy1)



AND THIS SCRIPT IS SAVED AS HEALTH

Code:

[ENABLE]
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)
label(restorehealth1)
registersymbol(restorehealth1)
aobscan(hack,8B 5E 04 8B 70 0C 8B 46 08 8B 70 14 89 75 E4 89 5F 44 8B 5F 78 8B 77 44)
newmem:
originalcode:
mov [edi+44],ebx
add [edi+44],#1000
mov ebx,[edi+78]
exit:
jmp returnhere

hack+F:
restorehealth1:
jmp newmem
nop
returnhere:

[DISABLE]
mov [edi+44],ebx
mov ebx,[edi+78]
unregistersymbol(restorehealth1)




[/code]
Back to top
View user's profile Send private message
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Sat Apr 13, 2013 11:10 am    Post subject: Reply with quote

Code:
control_setCaption(CETrainer_CELabel2, "Attached successfully!")

Code:
form_show(UDF1)

How do you create your trainer?
Via the Menu > File > Generate Generic Lua Trainer.
Or
Via the Menu > Table > Create form?

Because you got 2 different forms name
UDF1 is name of a form that being created via "Create form" option

And CETrainer is the name of a form being created via "Generate Generic Lua Trainer"

_________________
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
abhijeet1001
Advanced Cheater
Reputation: 0

Joined: 10 Apr 2013
Posts: 87

PostPosted: Sat Apr 13, 2013 11:26 am    Post subject: Reply with quote

Flash hacker wrote:
Code:
control_setCaption(CETrainer_CELabel2, "Attached successfully!")

Code:
form_show(UDF1)

How do you create your trainer?
Via the Menu > File > Generate Generic Lua Trainer.
Or
Via the Menu > Table > Create form?

Because you got 2 different forms name
UDF1 is name of a form that being created via "Create form" option

And CETrainer is the name of a form being created via "Generate Generic Lua Trainer"


the auto attach script is that u posted on skype .. i made my trainer by create form !!!

yess i noticed it !!! CEtrainer what to edit in place of it ?
Back to top
View user's profile Send private message
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Sat Apr 13, 2013 11:43 am    Post subject: Reply with quote

With your form name.
p.s
that is quick attaching,
to do a more indepth with various of options you should check main.lua

_________________
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
abhijeet1001
Advanced Cheater
Reputation: 0

Joined: 10 Apr 2013
Posts: 87

PostPosted: Sat Apr 13, 2013 11:46 am    Post subject: Reply with quote

Flash hacker wrote:
With your form name.


thnx all wrking now Smile Very Happy

forms open properly now just about to check whether it gets attached and wrks properly or not Very Happy
Back to top
View user's profile Send private message
abhijeet1001
Advanced Cheater
Reputation: 0

Joined: 10 Apr 2013
Posts: 87

PostPosted: Sat Apr 13, 2013 11:06 pm    Post subject: Reply with quote

abhijeet1001 wrote:
Flash hacker wrote:
With your form name.


thnx all wrking now Smile Very Happy

forms open properly now just about to check whether it gets attached and wrks properly or not Very Happy



hey it not getting attached ~_~ the hacks arent getting enabled


Code:

form_show(UDF1)

function FlashPlayer()
openProcess("FlashPlayerPlugin")
local op = getOpenedProcessID()
 if op==0 then
 showMessage("Failed to attach, program is shutting down..")
 CloseClick()
 else
 control_setCaption(CETrainer_CELabel2, "Attached successfully!")
 end
end
createHotkey(FlashPlayer, VK_CONTROL, VK_F2)




check = 0 -- I love to compare between on/off
script = addresslist_getMemoryRecordByDescription(getAddressList(), "ENERGY HACK") -- Change AutoAssembler according to your script description
function Enable()
if check==0 then memoryrecord_freeze(script) else memoryrecord_unfreeze(script)end
end

end



check = 0 -- I love to compare between on/off
script = addresslist_getMemoryRecordByDescription(getAddressList(), "HEALTH") -- Change AutoAssembler according to your script description
function Enable()
if check==0 then memoryrecord_freeze(script) else memoryrecord_unfreeze(script)end
end
end
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25805
Location: The netherlands

PostPosted: Sun Apr 14, 2013 2:31 am    Post subject: Reply with quote

You need to get the processlist first and scan through that for a processname that contains the text flashplayerplugin
Then extract the pid from that line and pass that to openProcess

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
abhijeet1001
Advanced Cheater
Reputation: 0

Joined: 10 Apr 2013
Posts: 87

PostPosted: Sun Apr 14, 2013 3:27 am    Post subject: Reply with quote

Dark Byte wrote:
You need to get the processlist first and scan through that for a processname that contains the text flashplayerplugin
Then extract the pid from that line and pass that to openProcess


hey dark byte can u correct my script ?? still even after putting the PID when i click on my button to activate cheats .. lua engine pop ups saying tryin to call a nill value ??

please ... everytime i do one thing another problem arises ~_~
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25805
Location: The netherlands

PostPosted: Sun Apr 14, 2013 3:52 am    Post subject: Reply with quote

Does it say at what line the nil value is called ?

I guess it's the access of CETrainer_CELabel2 . Do you have a form designed in the formdesigner named CETrainer with a label named CELabel2? If not, then this will not work.

Also, you override check and script for ENERGY HACK with the ones for health. Making the energy hack inaccessible
And you don't even seem to be calling any of the Enable() functions
You might want to use memoryrecord_onActivate(memrec, function) to set that



also a tip when coding: Execute each line one by one and print out the result with "return varname"
It will teach a lot about lua and the variables you're working with

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
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