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 


help understanding code

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
pharaon
Advanced Cheater
Reputation: 1

Joined: 29 Jun 2012
Posts: 80

PostPosted: Wed Oct 19, 2016 11:21 am    Post subject: help understanding code Reply with quote

i'm newbie
can some one help me understand this code
it's from Men of War Assault Squad 2 - Men of War Origins table
it's to freeze the ammo

i want to understand it so i can make one to freeze the grenade



Code:
[enable]
define(test,LUDO)

{$LUA}
writeInteger("iEnableMPA",1)
getAddressList().getMemoryRecordByID(101).Color=0x0008000
{$ASM}

[disable]
{$LUA}
writeInteger("iEnableMPA",0)
getAddressList().getMemoryRecordByID(101).Color=0x0c08000
{$ASM}
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Wed Oct 19, 2016 6:55 pm    Post subject: Reply with quote

In some other script, they defined the variable iEnableMPA.
Using writeInteger() they are setting the value to 1 (true) or 0 (false).
Inside the main script is likely a CMP to check if this is enabled.
Back to top
View user's profile Send private message
pharaon
Advanced Cheater
Reputation: 1

Joined: 29 Jun 2012
Posts: 80

PostPosted: Thu Oct 20, 2016 10:18 am    Post subject: Reply with quote

thanks
ther's more code i need to understand

Code:
// Definitions
define(LUDO,"mowas_2.exe")
define(GDMD,mowas_2.exe+004d4777) //#==
define(MUSA,mowas_2.exe+004d55f7) //#=#
define(MPAO,mowas_2.exe+003e8520) //#==
define(MUFL,mowas_2.exe+0044b5d8) //#==
define(MOCP,mowas_2.exe+00649f1e) //===
define(MTAO,mowas_2.exe+003e8b84) //#==
define(GMD2,mowas_2.exe+003901b4) //#==
define(MOSV,mowas_2.exe+00666be9) //===
define(GMD4,mowas_2.exe+003abea9) //#==
define(MUUC,mowas_2.exe+00627950) //#==
define(MOPI,mowas_2.exe+0058cfc6) //===



Code:
// If false the script will not be loaded

assert(GDMD,f3 0f 11 8e e4 00 00 00 f3 0f 5e 86 e0 00 00 00 f3 0f 11 45 08)
assert(MUSA,8b 00 89 47 6c 0f 54 c1 0f 2f c2 ?? ?? 8b 47 10 6a 00 68 15 04)
assert(MPAO,55 8b ec 8b 45 08 89 41 2c 5d c2 04 00 cc cc cc 55 8b ec 51 57)
assert(MUFL,89 86 fc 02 00 00 8b 86 34 05 00 00 6a 00 68 17 04 00 00 ff 70)
assert(MOCP,83 e0 06 3c 06 0f 85 ?? ?? ?? ?? a1 ?? ?? ?? ?? 89 45 f8 a1 ??)
assert(MTAO,8B 45 08 89 47 24 29 46 24 8b c7 5f 5e 5b 5d c2 04 00 cc cc cc)
assert(GMD2,8b 75 08 8b 16 85 d2 ?? ?? f6 42 18 02 ?? ?? 8b 01 52 56 ff 50 10)
assert(MOSV,f3 0f 10 47 04 83 ec 08 8b cb f3 0f 11 44 24 04 f3 0f 10 47 08)
assert(GMD4,88 9f 10 01 00 00 8b 01 57 ff 50 04 5f 5e 5b 8b e5 5d c2 0c 00)
assert(MUUC,8a 87 70 07 00 00 88 45 17 8d 45 ff 50 e8 ?? ?? ?? ?? 8b c8 83)
assert(MOPI,8a 45 ff 83 c4 04 3c 12 ?? ?? 0f b6 c0 69 d0 a8 00 00 00 81 c2)


Code:
// When decreasing ammo in Inv
// ESI = Ammo Structure
_MonTankAmmo:
 mov eax,[ebp+08]
 cmp eax,[esi+24]
 je _ExitMTA

 cmp dword ptr [iEnableMPA],0
 je _ExitMTA                       // Jump if feature is disabled

 mov eax,[esi+18]
 test eax,eax
 jz _ExitMTA

 mov eax,[eax+24]
 test eax,eax
 jz _ExitMTA

 movzx eax,byte ptr [eax+00000770]
 cmp eax,[iOwnerID]
 jne _ExitMTA

 mov eax,[ebp+08]
 add [esi+24],eax

_ExitMTA:
 mov eax,[ebp+08]                  // Original code
 mov [edi+24],eax                  // Original code
 jmp _BackMTA                      // Back to main code

//========================================= 3.251.0 NHP ok
// During Combat
_GodMode2:
 push eax

 mov esi,[ebp+08]                  // Original code
 mov edx,[esi]                     // Original code
 test edx,edx                      // Original code
 jz _ExitGM2

 mov [pHero2],edx                  // Save pointer for debugging

 mov eax,[edx+00000348]
 cmp eax,edx
 jne _ExitGM2

 cmp dword ptr [iEnableGMD],0
 je _ExitGM2                       // Jump if feature is disabled

 movzx eax,byte ptr [edx+00000770]
 cmp eax,[iOwnerID]
 jne _ExitGM2

 pop eax

 pop esi
 pop ebp
 ret 0004
//====
_ExitGM2:
 pop eax

 test edx,edx                      // Original code
 jmp _BackGM2                      // Back to main code


and how can i learn to make such scripts
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking 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