Code: Select all
#NoEnv
#IfWinActive, GTA:SA:MP
OnExit, freeMemory
getProcessAndModules:
global newPID := getPID("GTA:SA:MP")
if(newPID)
global hGTA := openProcess(newPID)
else{
MsgBox,GTA must be started
ExitApp
}
global g_dwSAMP_Addr := getModuleBaseAddress("samp.dll", hGTA)
global g_dwProcess := 0x400000
global pMemory := virtualAllocEx(hGTA, 6144, 0x1000 | 0x2000, 0x40)
global pParam1 := pMemory
global pParam2 := pMemory + 1024
global pParam3 := pMemory + 2048
global pParam4 := pMemory + 3072
global pParam5 := pMemory + 4096
global pInjectFunc := pMemory + 5120
AntiCrash()
SampPatchDisableAnticheat()
return
freeMemory:
; patch back
__WRITE(0x60BA80, 0x58EC83, 3, "UInt")
__WRITE(0x740450, 0x0DD8, 2, "Short")
__WRITE(0x740450 +2, 0x00858B3C, 4, "UInt")
__WRITE(0x740456, 0x1C244CD8, 4, "UInt")
__WRITE(0x60B8A0, 0x000007A09689, 6, "UInt")
__WRITE(0x60BA80, 0x58EC83, 3, "UInt")
SetRanges(0)
virtualFreeEx(hGTA, pMemory, 0, 0x8000)
closeProcess(hGTA)
FileDelete, style.html
ExitApp
return
*~rbutton up::
If(GetPlayerWeaponID() == 24){
sleep 10
Send {Wheelup}
sleep 30
Send {Wheelup}
sleep 20
Send {Wheelup}
sleep 10
send {space down}
sleep 100
send {space up}
sleep 1
send {space down}
sleep 100
send {space up}
sleep 1
send {space down}
sleep 1
send {space up}
sleep 1
send {space down}
sleep 1
send {space up}
sleep 1
send {space down}
sleep 1
send {space up}
sleep 1
#noenv
setbatchlines -1
setkeydelay -1
}
If(GetPlayerWeaponID() == 244){
sleep 10
Send {Wheelup}
sleep 120
send {space down}
sleep 340
send {space up}
sleep 1
send {space down}
sleep 100
send {space up}
sleep 1
send {space down}
sleep 1
send {space up}
sleep 1
send {space down}
sleep 1
send {space up}
sleep 1
send {space down}
sleep 1
send {space up}
sleep 1
#noenv
setbatchlines -1
setkeydelay -1
}
If(GetPlayerWeaponID() == 424){
sleep 20
Send {Wheelup}
sleep 20
Send {Wheelup}
sleep 20
Send {Wheelup}
sleep 10
send {j down}
sleep 340
send {j up}
sleep 1
send {j down}
sleep 100
send {j up}
sleep 1
send {j down}
sleep 1
send {j up}
sleep 1
#noenv
setbatchlines -1
setkeydelay -1
}
If(GetPlayerWeaponID() == 245454){
sleep 10
Send {Wheelup}
sleep 30
Send {Wheelup}
sleep 20
Send {Wheelup}
sleep 10
send {space down}
sleep 340
send {space up}
sleep 1
send {space down}
sleep 100
send {space up}
sleep 1
send {space down}
sleep 1
send {space up}
sleep 1
send {space down}
sleep 1
send {space up}
sleep 1
send {space down}
sleep 1
send {space up}
sleep 1
#noenv
setbatchlines -1
setkeydelay -1
}
if (GetPlayerWeaponID() == 34){
Sendplay {lctrl down}
Send {Wheeldown}
sendplay {lctrl up}
sleep 30
Send {Wheelup}
sleep 20
Send {Wheeldown}
sleep 1
sendplay {vk20 down}
sleep 7000ms
sendplay {vk20 up}
sleep 1
sendplay {vk20 down}
sleep 50
sendplay {vk20 up}
sleep 1
}
if (GetPlayerWeaponID() == 3444){
Sendplay {lctrl down}
SendInput {Wheeldown}
sendplay {lctrl up}
sleep 30
SendInput {Wheelup}
sleep 20
SendInput {Wheeldown}
sleep 1
sendplay {vk20 down}
sleep 7000ms
sendplay {vk20 up}
sleep 1
sendplay {vk20 down}
sleep 50
sendplay {vk20 up}
sleep 1
}
If(GetPlayerWeaponID() == 27) {
sleep 100ms
Send {Wheelup}
sleep 50
Send {Wheeldown}
sleep 10
Send {Wheelup}
sleep 10
}
If(GetPlayerWeaponID() == 25) {
sleep 100ms
Send {Wheelup}
sleep 50
Send {Wheeldown}
sleep 10
Send {Wheelup}
sleep 10
}
RandomSleep(min,max)
{
Random, random, %min%, %max%
Sleep %random%
}
getPID(szWindow)
{ local dwPID := 0
WinGet, dwPID, PID, %szWindow%
return dwPID
}
openProcess(dwPID, dwRights = 0x1F0FFF)
{ return DllCall("OpenProcess", "UInt", dwRights, "int", 0, "UInt", dwPID, "Uint")
}
closeProcess(hProcess)
{ DllCall("CloseHandle", "UInt", hProcess, "UInt")
}
getModuleBaseAddress(sModule, hProcess)
{ dwSize = 1024*4
VarSetCapacity(hMods, dwSize)
VarSetCapacity(cbNeeded, 4)
dwRet := DllCall("Psapi.dll\EnumProcessModules", "UInt", hProcess, "UInt", &hMods, "UInt", dwSize, "UInt*", cbNeeded, "UInt")
dwMods := cbNeeded / 4
i := 0
VarSetCapacity(hModule, 4)
VarSetCapacity(sCurModule, A_IsUnicode ? 2*260 : 260)
while(i < dwMods) {
hModule := NumGet(hMods, i*4)
DllCall("Psapi.dll\GetModuleFileNameEx", "UInt", hProcess, "UInt", hModule, "Str", sCurModule, "UInt", A_IsUnicode ? 2*260 : 260)
SplitPath, sCurModule, sFilename
if(sModule == sFilename)
return hModule
i := i + 1
}
return 0
}
callWithParams(dwFunc, aParams, bCleanupStack = true, thiscall = false) {
validParams := 0
i := aParams.MaxIndex()
; i * PUSH + CALL + RETN
dwLen := i * 5 + 5 + 1
if(bCleanupStack)
dwLen += 3
VarSetCapacity(injectData, i * 5 + 5 + 3 + 1, 0)
i_ := 1
while(i > 0) {
if(aParams[i][1] != "") {
dwMemAddress := 0x0
if(aParams[i][1] == "p") {
dwMemAddress := aParams[i][2]
} else if(aParams[i][1] == "s") {
if(i_>3)
return false
dwMemAddress := pParam%i_%
__WSTRING(dwMemAddress, aParams[i][2])
if(ErrorLevel)
return false
i_ += 1
} else if(aParams[i][1] == "i") {
dwMemAddress := aParams[i][2]
} else {
return false
}
NumPut((thiscall && i == 1 ? 0xB9 : 0x68), injectData, validParams * 5, "UChar")
NumPut(dwMemAddress, injectData, validParams * 5 + 1, "UInt")
validParams += 1
}
i -= 1
}
offset := dwFunc - ( pInjectFunc + validParams * 5 + 5 )
NumPut(0xE8, injectData, validParams * 5, "UChar")
NumPut(offset, injectData, validParams * 5 + 1, "Int")
if(bCleanupStack) {
NumPut(0xC483, injectData, validParams * 5 + 5, "UShort")
NumPut(validParams*4, injectData, validParams * 5 + 7, "UChar")
NumPut(0xC3, injectData, validParams * 5 + 8, "UChar")
} else {
NumPut(0xC3, injectData, validParams * 5 + 5, "UChar")
}
__RAW(pInjectFunc, &injectData, dwLen)
if(ErrorLevel)
return false
hThread := createRemoteThread(0, 0, pInjectFunc, 0, 0, 0)
if(ErrorLevel)
return false
waitForSingleObject(hThread, 0xFFFFFFFF)
closeProcess(hThread)
return true
}
virtualAllocEx(hProcess, dwSize, flAllocationType, flProtect)
{ return DllCall("VirtualAllocEx", "UInt", hProcess, "UInt", 0, "UInt", dwSize, "UInt", flAllocationType, "UInt", flProtect, "UInt")
}
virtualFreeEx(hProcess, lpAddress, dwSize, dwFreeType)
{ return DllCall("VirtualFreeEx", "UInt", hProcess, "UInt", lpAddress, "UInt", dwSize, "UInt", dwFreeType, "UInt")
}
createRemoteThread(lpThreadAttributes, dwStackSize, lpStartAddress, lpParameter, dwCreationFlags, lpThreadId)
{ return DllCall("CreateRemoteThread", "UInt", hGTA, "UInt", lpThreadAttributes, "UInt", dwStackSize, "UInt", lpStartAddress, "UInt", lpParameter, "UInt", dwCreationFlags, "UInt", lpThreadId, "UInt")
}
waitForSingleObject(hThread, dwMilliseconds) {
return DllCall("WaitForSingleObject", "UInt", hThread, "UInt", dwMilliseconds, "UInt")
}
__ansiToUnicode(sString, nLen = 0) {
If !nLen
nLen := DllCall("MultiByteToWideChar", "Uint", 0, "Uint", 0, "Uint", &sString, "int", -1, "Uint", 0, "int", 0)
VarSetCapacity(wString, nLen * 2)
DllCall("MultiByteToWideChar", "Uint", 0, "Uint", 0, "Uint", &sString, "int", -1, "Uint", &wString, "int", nLen)
return wString
}
__unicodeToAnsi(wString, nLen = 0)
{ pString := wString + 1 > 65536 ? wString : &wString
If !nLen
nLen := DllCall("WideCharToMultiByte", "Uint", 0, "Uint", 0, "Uint", pString, "int", -1, "Uint", 0, "int", 0, "Uint", 0, "Uint", 0)
VarSetCapacity(sString, nLen)
DllCall("WideCharToMultiByte", "Uint", 0, "Uint", 0, "Uint", pString, "int", -1, "str", sString, "int", nLen, "Uint", 0, "Uint", 0)
return sString
}
__READ(dwAddress, dwLen, type, ByRef dwRead=0)
{ VarSetCapacity(dwRead, dwLen)
DllCall("ReadProcessMemory", "UInt", hGTA, "UInt", dwAddress, "Str", dwRead, "UInt", dwLen, "UInt", 0, "UInt*", 0)
dwRead := NumGet(dwRead, 0, type)
return dwRead
}
__FLOAT(dwAddress, ByRef dwRead=0)
{ VarSetCapacity(dwRead, 4)
DllCall("ReadProcessMemory", "UInt", hGTA, "UInt", dwAddress, "Str", dwRead, "UInt", 4, "UInt*", 0, "UInt", 0)
dwRead := NumGet(dwRead, 0, "Float")
return dwRead
}
__DWORD(dwAddress, ByRef dwRead=0)
{ VarSetCapacity(dwRead, 4)
DllCall("ReadProcessMemory", "UInt", hGTA, "UInt", dwAddress, "Str", dwRead, "UInt", 4, "UInt", 0, "UInt*", 0)
dwRead := NumGet(dwRead, 0, "UInt")
return dwRead
}
__INT(dwAddress, ByRef dwRead=0)
{ VarSetCapacity(dwRead, 4)
DllCall("ReadProcessMemory", "UInt", hGTA, "UInt", dwAddress, "Str", dwRead, "UInt", 4, "UInt", 0, "UInt*", 0)
dwRead := NumGet(dwRead, 0, "Int")
return dwRead
}
__SHORT(dwAddress, ByRef dwRead=0)
{ VarSetCapacity(dwRead, 2)
DllCall("ReadProcessMemory", "UInt", hGTA, "UInt", dwAddress, "Str", dwRead, "UInt", 4, "UInt", 0, "UInt*", 0)
dwRead := NumGet(dwRead, 0, "Short")
return dwRead
}
__STRING(dwAddress, size, ByRef dwRead=0)
{ VarSetCapacity(dwRead, size)
DllCall("ReadProcessMemory", "UInt", hGTA, "UInt", dwAddress, "Str", dwRead, "UInt", size, "UInt*", 0, "UInt", 0)
if A_IsUnicode
dwRead := __ansiToUnicode(dwRead)
}
__WRITE(dwAddress, writevalue, size=4, type="Int")
{ VarSetCapacity(finalvalue,size, 0)
NumPut(writevalue,finalvalue,0,type)
DllCall("WriteProcessMemory","Uint",hGTA,"Uint",dwAddress,"Uint",&finalvalue,"Uint",size,"Uint",0)
}
__WSTRING(dwAddress, wString)
{ sString := wString
if A_IsUnicode
sString := __unicodeToAnsi(wString)
DllCall("WriteProcessMemory", "UInt", hGTA, "UInt", dwAddress, "Str", sString, "UInt", StrLen(wString) + 1, "UInt", 0, "UInt")
}
__RAW(dwAddress, pBuffer, dwLen)
{ DllCall("WriteProcessMemory", "UInt", hGTA, "UInt", dwAddress, "UInt", pBuffer, "UInt", dwLen, "UInt", 0, "UInt")
}
wb_BeforeNavigate2(wb, url, flags, frame, postdata, headers, cancel){
global _mainGui
global _mainGui2
if(SubStr(url, 1, 6) = "about:")
return
static m1, m2
NumPut(-1, ComObjValue(cancel), "short")
if(RegExMatch(url, "i)^navigateto://(.*?)/(.*)$", m)){
StringReplace m2, m2, `%20, %A_Space%, All
SetTimer wb_bn2_call, -15
}
else if(SubStr(url, 1, 8) != "file:///"){
Run, %url%,, UseErrorLevel
if(ErrorLevel)
ToolTip, % "Dein Browser/Programm konnte nicht korrekt gestartet werden!"
}
return
wb_bn2_call:
if(m1 = "go" OR m1 = "g"){
loop, Parse, m2, `;
{
if(IsLabel(A_LoopField) AND (wb != _maingui || wb != _mainGui2))
gosub %A_LoopField%
}
}
return
}
wb_NavigateError(wb, url, frame, status, cancel){
wb_BeforeNavigate2(wb, url, 0, frame, "", "", cancel)
}
Vehicle()
{ return (__DWORD(ADDR_VEHICLE_PTR) > 0)
}
SetRanges(toggle)
{
loop % ptr_ranges.MaxIndex()
{
If(toggle) {
__WRITE(ptr_ranges[A_Index], 9999, 4, "float")
}else{
__WRITE(ptr_ranges[A_Index], ranges[A_Index], 4, "float")
}
}
}
GetTargetPed()
{ return __DWORD(__DWORD(ADDR_WEAPON_TARGET) + OFFSET_CPED_OTARGET)
}
GetPlayerWeaponID()
{ return __DWORD(0xBAA410)
}
AddChatMessage(text,color=0xffffffff)
{ dwFunc := g_dwSAMP_Addr + FUNC_ADDMSG
__DWORD(g_dwSAMP_Addr + ADDR_SAMP_CHATMSG_PTR, dwAddress)
callWithParams(dwFunc, [["i", dwAddress],["i", 8],["s", text],["i", 0],["i", "0xFF" . color],["i", 0]], false, true)
}
IsChatOpen()
{ return (__DWORD(__DWORD(g_dwSAMP_Addr + ADDR_SAMP_INCHAT_PTR) + ADDR_SAMP_INCHAT_PTR_OFF) > 0)
}
AntiCrash(){
cReport := ADDR_SAMP_CRASHREPORT
__WRITE(g_dwSAMP_Addr + cReport, 0x90909090, 4)
cReport += 0x4
__WRITE(g_dwSAMP_Addr + cReport, 0x90, 1)
cReport += 0x9
__WRITE(g_dwSAMP_Addr + cReport, 0x90909090, 4)
cReport += 0x4
__WRITE(g_dwSAMP_Addr + cReport, 0x90, 1)
}
SampPatchDisableAnticheat(){
for i, patch in SAMP_AC_PATCHES
{
tobin(d, SAMP_AC_BYTES[i])
__RAW(g_dwSAMP_Addr + patch, &d, StrLen(SAMP_AC_BYTES[i]) / 2)
}
}
tobin(byref addr, str="")
{
if(!RegExMatch(str,"^([a-fA-F0-9][a-fA-F0-9])*$"))
{
msgbox % "fail tobin"
return
}
i:=Strlen(str)/2
VarSetCapacity(addr, i)
dataddr := &addr
x:=""
loop,parse,str
{
if(A_Index & 1)
x := A_Loopfield
else
{
DllCall("RtlFillMemory"
, "UInt", dataddr
, "UInt", 1
, "UChar", "0x" x A_Loopfield)
dataddr++
}
}
}
getWeaponName(id) {
weapons := {0: "Fist", 1: "Brass Knuckles", 2: "Golf Club", 3: "Nightstick", 4: "Knife", 5: "Baseball Bat", 6: "Shovel", 7: "Pool Cue", 8: "Katana", 9: "Chainsaw", 10: "Purple Dildo", 11: "Dildo", 12: "Vibrator", 13: "Silver Vibrator", 14: "Flowers", 15: "Cane", 16: "Grenade", 17: "Tear Gas", 18: "Molotov Cocktail", 22: "9mm", 23: "Silenced 9mm", 24: "Desert Eagle", 25: "Shotgun", 26: "Sawnoff Shotgun", 27: "Combat Shotgun", 28: "Micro SMG/Uzi", 29: "MP5", 30: "AK-47", 31: "M4", 32: "Tec-9", 33: "Country Rifle", 34: "Sniper Rifle", 35: "RPG", 36: "HS Rocket", 37: "Flamethrower", 38: "Minigun", 39: "Satchel Charge", 40: "Detonator", 41: "Spraycan", 42: "Fire Extinguisher", 43: "Camera", 44: "Night Vis Goggles", 45: "Thermal Goggles", 46: "Parachute", 47: "Fake Pistol", 49: "Vehicle", 50: "Helicopter Blades", 51: "Explosion", 53: "Drowned", 54: "Splat", 255: "Suicide"}
if(weapons[id]) {
return weapons[id]
}
}
global sizeofDataType := { "UChar": 1, "Char": 1
, "UShort": 2, "Short": 2
, "UInt": 4, "Int": 4
, "UFloat": 4, "Float": 4
, "Int64": 8, "Double": 8}
global ptr_ranges := [0xc8ab2c,0xc8ab9c,0xc8ac0c,0xc8ac7c,0xc8acec,0xc8ad5c,0xc8adcc,0xc8ae3c,0xc8aeac
,0xc8af1c,0xc8af8c,0xc8affc,0xc8b06c,0xc8b0dc,0xc8b14c,0xc8b1bc,0xc8b22c,0xc8b29c
,0xc8b30c,0xc8b37c,0xc8b3ec,0xc8b45c,0xc8b4cc,0xc8b53c,0xc8b5ac,0xc8b61c,0xc8b68c
,0xc8b6fc,0xc8b76c,0xc8b7dc,0xc8b84c,0xc8b8bc,0xc8b92c,0xc8b99c,0xc8ba0c,0xc8ba7c
,0xc8baec,0xc8bb5c,0xc8bbcc,0xc8bc3c,0xc8bcac,0xc8bd1c,0xc8bd8c,0xc8bdfc,0xc8be6c
,0xc8bedc,0xc8bf4c,0xc8bfbc,0xc8c02c,0xc8c09c,0xc8c10c,0xc8c17c,0xc8c1ec,0xc8c25c
,0xc8c2cc,0xc8c33c,0xc8c3ac,0xc8c41c,0xc8c48c,0xc8c4fc,0xc8c56c,0xc8c5dc,0xc8c64c
,0xc8c6bc,0xc8c72c,0xc8c79c,0xc8c80c,0xc8c87c,0xc8c8ec]
global ranges := [10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,30,30,30,30,30
,30,30,30,30,35,30,40,30,40,45,45,30,55,50,50,50,4 ,65,30,25
,4,10,70,70,70,10,25,25,25,30,25,35,25,35,40,40,25,35,35,35
,40,35,40,35,45,50,50,35,30]
global SAMP_AC_PATCHES := [0x99250, 0xB2F70, 0xB30F0, 0x99247]
global SAMP_AC_BYTES := ["C3", "B845000000C21C00", "B801000000C3", "9090"]
global ADDR_VEHICLE_PTR := 0xBA18FC ; dword
global OFFSET_CPED_OTARGET := 0x79C ; dword
global ADDR_WEAPON_TARGET := 0xB6F3B8 ; dword
global FUNC_ADDMSG := 0x64010
global ADDR_SAMP_CHATMSG_PTR := 0x21A0E4
global ADDR_SAMP_INCHAT_PTR := 0x21a10c
global ADDR_SAMP_INCHAT_PTR_OFF := 0x55
global ADDR_SAMP_CRASHREPORT := 0x5CF2C
[Mod action: Moved topic to the v1 section since this is v1 code. The main section is for v2. And moved it to the Gaming section since it’s for a game.]