[HELP]Game Crashes try to do a NoSpread

razvang10

Member
Joined
Jul 6, 2014
Messages
9
Reaction score
0
why my gta crashes when i do this to a function ?
Code:
		if (kpo(VK_MULTIPLY))
		{
			*(BYTE*)(0x740676) = 0x90;
			*(BYTE*)(0x740677) = 0x90;
			*(BYTE*)(0x740678) = 0x90;
		}
and i saw a post on relases

Code:
if (bRecoil)
    memcpy_s((void*)0x740676, "x90\x90\x90", 3);
else
    memcpy_s((void*)0x740676, "xD9\x58\x2C", 3);
in the both cases my game crashes . any ideas ? :D

and also if u can give me an offset for name of the ped .. it would be great
 

T3KTONIT

Well-known member
Joined
Sep 2, 2013
Messages
308
Reaction score
5
Link us to the post that you saw...

Also the code does the same thing, just whether u prefer to do it in one line or more.
 

razvang10

Member
Joined
Jul 6, 2014
Messages
9
Reaction score
0
this is the post http://ugbase.eu/snippets-70/nospread-for-mod_sa/msg84026/#msg84026
i dont think u need the whole program its a simple dll..
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
273
Code:
vp
memcpy((void*)0x740676, (uint8_t *)"x90\x90\x90", 3);
vp

use it like this
 

razvang10

Member
Joined
Jul 6, 2014
Messages
9
Reaction score
0
springfield link said:
Code:
vp
memcpy((void*)0x740676, (uint8_t *)"x90\x90\x90", 3);
vp

use it like this
nop it still crashes i tried as byte dword same thing ...
 

y0mike

Active member
Joined
May 10, 2014
Messages
97
Reaction score
41
Location
mizus girl's house
razvang10 link said:

use this
Code:
void WriteToMemory(uintptr_t addressToWrite, char* valueToWrite, int byteNum)
{
	unsigned long OldProtection;
	VirtualProtect((LPVOID)(addressToWrite), byteNum, PAGE_EXECUTE_READWRITE, &OldProtection);
	memcpy((LPVOID)addressToWrite, valueToWrite, byteNum);
	VirtualProtect((LPVOID)(addressToWrite), byteNum, OldProtection, NULL);
}

Code:
DWORD nsaddress = 0x740676;
char nson[] = "\x90\x90\x90";
char nsoff[] = "\xD9\x58\x2C";

void cheat_handle_spread( void ) 
{
	if (cheat_state->_generic.spread)
			WriteToMemory(nsaddress, nson, sizeof(nson));
	else 
			WriteToMemory(nsaddress, nsoff, sizeof(nsoff));
}

good times lol
 

T3KTONIT

Well-known member
Joined
Sep 2, 2013
Messages
308
Reaction score
5
well i don't know what's wrong with your case but for me this works fine:
i'm not sure if you really need memory protection or not (since you're editing instructions) but yeah it worked for me without vp(I'm on Windows 7 Ultimate).

here, try this(compile as dll and inject it OR rename to .asi and put in gta sa folder):
PHP:
#include <Windows.h>

void NoSpread_0(){ *(unsigned int*)0x0740676 = 0x8B2C58D9; } // OFF
void NoSpread_1(){ *(unsigned int*)0x0740676 = 0x8B2C40D8; } // ON

void Start()
{
	while (true)
	{
		if (GetAsyncKeyState(VK_NUMPAD0) & 1)
		{
			NoSpread_0();
		}
		else if (GetAsyncKeyState(VK_NUMPAD1) & 1)
		{
			NoSpread_1();
		}
	}
}

BOOL WINAPI DllMain(HMODULE hDll, DWORD dwReason, LPVOID lpReserved)
{
	DisableThreadLibraryCalls(hDll);
	if (dwReason == DLL_PROCESS_ATTACH)
	{
		CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)Start, NULL, NULL, NULL);
	}
	return TRUE;
}
 

razvang10

Member
Joined
Jul 6, 2014
Messages
9
Reaction score
0
y0Mike link said:
use this
Code:
void WriteToMemory(uintptr_t addressToWrite, char* valueToWrite, int byteNum)
{
	unsigned long OldProtection;
	VirtualProtect((LPVOID)(addressToWrite), byteNum, PAGE_EXECUTE_READWRITE, &OldProtection);
	memcpy((LPVOID)addressToWrite, valueToWrite, byteNum);
	VirtualProtect((LPVOID)(addressToWrite), byteNum, OldProtection, NULL);
}

Code:
DWORD nsaddress = 0x740676;
char nson[] = "\x90\x90\x90";
char nsoff[] = "\xD9\x58\x2C";

void cheat_handle_spread( void ) 
{
	if (cheat_state->_generic.spread)
			WriteToMemory(nsaddress, nson, sizeof(nson));
	else 
			WriteToMemory(nsaddress, nsoff, sizeof(nsoff));
}

good times lol
thnx man :x
 
Top