Página 1 de 1

[LUA]How to activate a cheat using memory address

Enviado: 03 Jan 2019, 13:58
por Grinch_
0x969130 - Weapon Set 1
I'm trying to activate this cheat using this address.

Código: Selecionar tudo

memory.write(0x969133 ,1,1)
I've tried with this but it doesn't seem to work.So,how can i achieve this?

Re: [LUA]How to activate a cheat using memory address  [RESOLVIDO]

Enviado: 03 Jan 2019, 14:27
por HybridTheory
that memory address is read-only, and it returns a boolean value which tells if the cheat is on/off

you must call the cheat's function in order to activate it, i don't really know how to do that in Lua :peepo1:, but in gta3sc it would be something like this:

CALL_FUNCTION 0x004385B0 1 1 FALSE

hope that helps

Re: [LUA]How to activate a cheat using memory address

Enviado: 03 Jan 2019, 15:51
por Grinch_
thx for your reply.That works perfectly for functions with no parameters.

Código: Selecionar tudo

// module: 004385B0
void __cdecl cheatWeaponSet1()
{
  //rest of the code
}
but when i try it on some functions with parameters for example

Código: Selecionar tudo

// module: 0x00609F50
void __thiscall CPlayerPed::CheatWantedLevel(CPlayerPed *this, int level)
{
  //rest of the code
}
I'm calling this function like this,

Código: Selecionar tudo

callFunction(0x00609F50 ,2,2,PLAYER_PED,1)
I think i'm calling it wrong way.So how should i call this function?

Re: [LUA]How to activate a cheat using memory address

Enviado: 03 Jan 2019, 17:46
por HybridTheory
Grinch_ escreveu:
03 Jan 2019, 15:51
callFunction(0x00609F50 ,2,2,PLAYER_PED,1)

PLAYER_PED is the player's handle, you must use CPlayerPed, which is the player's struct

and you should use callMethod in this case

something like this:

Código: Selecionar tudo

GET_PED_POINTER scplayer (CPlayerPed)
CALL_METHOD 0x609F50 CPlayerPed 2 1 (CPlayerPed, 3) //last parameter is the desired wanted level

btw, if i recall corectly, moonloader already has a command that does the same thing that this function does (alterWantedLevel?)

Re: [LUA]How to activate a cheat using memory address

Enviado: 03 Jan 2019, 17:54
por Grinch_
HybridTheory escreveu:
03 Jan 2019, 17:46
Grinch_ escreveu:
03 Jan 2019, 15:51
callFunction(0x00609F50 ,2,2,PLAYER_PED,1)

PLAYER_PED is the player's handle, you must use CPlayerPed, which is the player's struct

and you should use callMethod in this case

something like this:

Código: Selecionar tudo

GET_PED_POINTER scplayer (CPlayerPed)
CALL_METHOD 0x609F50 CPlayerPed 2 1 (CPlayerPed, 3) //last parameter is the desired wanted level

btw, if i recall corectly, moonloader already has a command that does the same thing that this function does (alterWantedLevel?)  
I wanted to know how i can do this way.