Results 1 to 5 of 5
  1. #1
    iamSxlvatore's Avatar
    Join Date
    Jan 2016
    Gender
    male
    Posts
    8
    Reputation
    10
    Thanks
    0
    My Mood
    Sad

    Question AHK error for no recoil

    says
    "error at line 678
    getProcessBaseAddress(WindowTitle, windowMatchMode := "3")
    error: needs comma"

    how do i fix this? thank you.

    link to cheat post: /forum/showthread.php?t=1045676

  2. #2
    emlor's Avatar
    Join Date
    Dec 2014
    Gender
    male
    Posts
    62
    Reputation
    10
    Thanks
    1,523
    Copy this code into the previous script overwriting everything.. or just make a new AHK script with this code

    I had used this one for awhile now and the only thing it misses is the autospotting and the minimap
    recoil , spread , gravity still work as well as velocity and such

    Code:
    #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
    ; #Warn  ; Enable warnings to assist with detecting common errors.
    SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
    SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
    #SingleInstance Force
    #NoEnv
    #include GDI+.ahk
    SetBatchLines -1
    MaxROF = 2000
    MaxVel = 10000
    IniRead,NoSpread,Settings.dfd,Settings,Spread,100
    NoSpreadOld := NoSpread + 2
    IniRead,NoRecoil,Settings.dfd,Settings,Recoil,0
    IniRead,Overlay,Settings.dfd,Settings,Overlay,0
    IniRead,Breath,Settings.dfd,Settings,Breath,0
    IniRead,Spotting,Settings.dfd,Settings,Spotting,0
    IniRead,PlayerRadar,Settings.dfd,Settings,PlayerRadar,0
    IniRead,showTeam,Settings.dfd,Settings,ShowTeam,0
    IniRead,PosCX1,Settings.dfd,Settings,PosCX1,1920
    IniRead,PosCY1,Settings.dfd,Settings,PosCY1,540
    IniRead,ROFAuto,Settings.dfd,Settings,ROFAuto,0
    IniRead,Auto,Settings.dfd,Settings,Auto,%A_Space%
    IniRead,GravitySet,Settings.dfd,Settings,Gravity,0
    IniRead,MuzzleVel,Settings.dfd,Settings,MuzzleSet,0
    iniRead,MuzzleV,Settings.dfd,Settings,MuzzleVelocity
    
    Process,Priority,,R
    
    ;0BBCE9410
    ;151B1D500
    
    ;Type---------------
    PROGRAM = Battlefield 4
    Settimer,Base,10
    Settimer,pData,10
    Settimer, WindowXY,100
    Settimer, Spread,300
    Settimer, Recoil,300
    Settimer, MuzzleVelocitySetting,300
    Settimer, ROFSetting,300
    Settimer, GravitySetting,300
    ;Settimer, Debug, 10
    Settimer,Breath,300
    Settimer, SaveSettings,5000
    Settimer,Overlay,300
    
    If !pToken := Gdip_Startup()
    {
       MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
       ExitApp
    }
    
    /*
    Offset(kl="")
    {
    CLIENTGAMECONTEXT = 0x24a0c00 ;0 +  Base
    ANGLES := 0x21e3400 ;+ base
    ;---------gamecontext----------
    ClientPlayerManager := 0x60 ;GameContext 
    idToPlayerMapOffset := 0x548 ;ClientPlayerManager
    ;------------------ReadLocalPlayer --------------------
    ClientPlayer = 0x540 ;ClientPlayerManager 
    ClientSoldier = 0x14d0 ;ClientPlayer 
    ClientReplication = 0x490 ;ClientSoldier
    soldierWeaponsComponent = 0x570 ;ClientSoldier 
    breathControlHandler = 0x588 ;clientSoldier
    pHealthComponent = 0x140 ;ClientSoldier
    ActiveSlot = 0x0a98 ;SoldierWeaponCompenent 
    CurrentAnimatedWeaponHandler = 0x0890 ;soldierWeaponComponent
    ClientSoldierWeapon := * 0x8 ;currentAnimantedWeaponHandler + ActiveSlot
    CorrectedFiring := 0x49c0 ;Angles
    WeaponSway := 0x78 ;CorrectedFiring
    WeaponSwayData := 0x08 ;WeaponSway
    ;---------------------PlayerData-------------------
    InVehicle := 0x14c0 ;clientPlayer
    TeamID := 0x13cc ;Clientplayer
    Health := 0x20 ;pHealthComponent
    projectilesLoaded := 0x01a0 ;CorrectedFiring
    ProjectilesInMagazines := 0x01a4 ;CorrectedFiring
    PositionX := 0x30 ;clientReplication
    PositionY := 0x34 ;ClientReplication
    PositionZ := 0x38 ;clientReplication
    flYaw := 0x4D8 ;clientSoldier
    Return %kl%
    }
    */
    
    
    MainGui():
    if WinExist("Battlefield 4")
    {
    WinGetPos,Xpos, YPos,WidthW,HeightH,Battlefield 4
    PosX := XPos+10, PosY := YPos +20
    Gui +AlwaysOnTop -Caption +ToolWindow
    Gui, Color, FA0000
    gui, font,cFF0000 S12 Bold, Arial
    Gui, Add, Text, x10 y10 w100 h20 vNSpread ,Spread %NoSpread%
    Gui, Add, Slider,x120 y10 W50 h20 Center NoTicks Range0-100 vNoSpread gSpread ,%NoSpread%
    
    Gui, Add, text, x10 y30 w100 h30, NoRecoil
    Gui, Add, CheckBox,x120 y30 Checked%NoRecoil% vNoRecoil ; gRecoil
    
    Gui,Add,Text, x10 y50 W100 H40,Overlay
    Gui, Add, CheckBox, x120 y50 Checked%Overlay% vOverlay gOverlay
    
    gui, Add, Text, x10 y70 w120 h30, NoBreath
    Gui, Add, CheckBox, X120 y70 Checked%Breath% vBreath gBreath
    
    Gui, Add, Text,x10 y90 w120 h30,MiniMap Spotting
    Gui, Add, CheckBox,x120 y90 Checked%Spotting% vSpotting gpData
    
    Gui, Add, Text,x10 y110 w120 h30,EnemyRadar
    Gui, Add, Checkbox,x120 y110 Checked%PlayerRadar% vPlayerRadar gpData
    
    Gui, Add, Text ,x10 y130 w120 H30,ShowTeam
    Gui, Add, CheckBox,x120 y130 Checked%ShowTeam% vShowTeam gpData
    
    Gui, Add, Text,x10 y150 W120 H30,HorzPos
    Gui, Add, Slider,x120 y150 w50 h20 Center NoTicks range0-%A_ScreenWidth% vPosCX1 gpData,%PosCX1%
    
    Gui, Add, Text,x10 y170 W120 H30,VertPos
    Gui, Add, Slider,x120 y170 w50 h20 Center NoTicks range0-%A_ScreenHeight% vPosCY1 gpData,%PosCY1%
    
    Gui, Add, Text, x10 y190 w110 h20 vRPMAuto,ROF %Auto%
    Gui, Add, CheckBox,x120 y190  h15 w15 Checked%ROFAuto% vROFAuto 
    Gui, Add, Slider,x140 y190 w50 h20 Center NoTicks range0-%MaxROF% vAuto, %Auto%
    
    Gui, Add, text,x10 y210 w110 h20,NoGravity
    Gui, Add, CheckBox,x120 y210 h15 w15 Checked%GravitySet% vGravitySet ; gRecoil
    
    Gui, Add, Text,x10 y230 w110 h20 vMuzzleText,Vel %MuzzleV%
    Gui, Add, CheckBox,x120 y230  h15 w15 Checked%MuzzleVel% vMuzzleVel 
    Gui, Add, Slider,x140 y230 w50 h20 Center NoTicks range0-%MaxVel% vMuzzleV, %MuzzleV%
    
    Gui, Show, NA x%PosX% y%PosY%,Gui77
    WinSet, TransColor,FA0000, Gui77
    }
    return
    
    
    ~Numpad0::
    IfWinNotActive,Gui77
    {
    	WinGetPos,Xpos, YPos,WidthW,HeightH,Battlefield 4
        PosX := XPos, PosY := YPos
    	Gui, Show,x%PosX% y%PosY%,Gui77
    	WinMove,Gui77,,PosX,PosY
    }
    return
    
    WindowXY:
    WinGetPos,Xpos, YPos,WidthW,HeightH,Battlefield 4
    IfWinNotActive,Gui77
    	Gui,Hide
    IfWinNotExist,Battlefield 4
    {
    	FileDelete,%A_WorkingDir%\Backup.dfd
    	ExitApp
    }
    return
    
    Spread:
    Gui, Submit, Nohide
    if Done = 1
    {
    NoSpreadDec := Round(NoSpread/100,3)
    VarHex := FloatToHex(NoSpreadDec)
    StringTrimRight,NoSpreadDec,NoSpreadDec,1
    GuiControl,,NSpread,Spread %NoSpreadDec%
    	WriteMemory(VarHex,WeaponSwayData+0x0430,PROGRAM) ;VisualSpreadADS
    	WriteMemory(VarHex,WeaponSwayData+0x0434,PROGRAM) ;ProjectileSpreadADS
    	WriteMemory(VarHex,WeaponSwayData+0x0438,PROGRAM) ;VisualSpread
    	WriteMemory(VarHex,WeaponSwayData+0x043C,PROGRAM) ;ProjectileSpread
    }
    return
    
    Recoil:
    if Done = 1
    {
    Gui, Submit, Nohide
    if NoRecoil = 1
    	{
    		;if (Recoil1 = FloatToHex(100)) && (Recoil2 = FloatToHex(0))
    		;	return
    		iniRead,WeaponNameLoad,Backup.dfd,%CurrentWeaponName3%,Weapon
    		if WeaponNameLoad != %CurrentWeaponName3%
    		{
    			IniWrite,%CurrentWeaponName3%,Backup.dfd,%CurrentWeaponName3%,Weapon
    			IniWrite,%Recoil1%,Backup.dfd,%CurrentWeaponName3%,Recoil1B
    			IniWrite,%Recoil2%,Backup.dfd,%CurrentWeaponName3%,Recoil2B
    			}
    			WriteMemory(FloatToHex(100),WeaponSwayData+0x0440,PROGRAM)
    			WriteMemory(FloatToHex(0),WeaponSwayData+0x0444,PROGRAM)
    		}
    		
    if NoRecoil = 0
       {
    	iniRead,WeaponNameLoad,Backup.dfd,%CurrentWeaponName3%,Weapon
    	if WeaponNameLoad != ERROR
    	{
    	IniRead,Recoil1Ret,Backup.dfd,%CurrentWeaponName3%,Recoil1B
    	IniRead,Recoil2Ret,Backup.dfd,%CurrentWeaponName3%,Recoil2B
    ;	if (Recoil1 = Recoil1Ret) && (Recoil2 = Recoil2Ret)
    	;	return
    		WriteMemory(Recoil1Ret,WeaponSwayData+0x0440,PROGRAM)
    		WriteMemory(Recoil2Ret,WeaponSwayData+0x0444,PROGRAM)
    	    }
    	}
    }
    return
    
    
    ROFSetting:
    if Done = 1
    {
    Gui, Submit, Nohide
    if ROFAuto = 1
    	{
    		iniRead,ROF,Backup.dfd,%CurrentWeaponName3%,ROFAuto
    		if ROF = ERROR
    		{
    			IniWrite,%ClientROFAuto%,Backup.dfd,%CurrentWeaponName3%,ROFAuto
    			IniWrite,%ClientROFBurst%,Backup.dfd,%CurrentWeaponName3%,ROFBurst
    		}
    		else
    		{
    			RPM1 := Auto
    			VarHexRPM1 := FloatToHex(Auto)
    			GuiControl,,RPMAuto,ROF %Auto%
    		;	if (ClientROFAuto = HexToFloat(VarHexRPM1))
    		;		return
    			WriteMemory(VarHexRPM1,FiringFunctionData+0x1c8,PROGRAM)
    			WriteMemory(VarHexRPM1,FiringFunctionData+0x1cc,PROGRAM)
    		}
    }
    	
    if ROFAuto = 0
    	{
    		iniRead,ROF,Backup.dfd,%CurrentWeaponName3%,ROFAuto
    		if ROF != ERROR
    		{
    			IniRead,BackupROFAuto,Backup.dfd,%CurrentWeaponName3%,ROFAuto
    			IniRead,BackupROFBurst,Backup.dfd,%CurrentWeaponName3%,ROFBurst
    			VarHexRPM3 := BackupROFAuto
    			VarHexRPM4 := BackupROFBurst
    			GuiControl,,RPMAuto,ROF %BackupROFAuto%
    		;	if (ClientROFAuto = HexToFloat(VarHexRPM3))
    		;		return
    			WriteMemory(FloatToHex(VarHexRPM3),FiringFunctionData+0x1c8,PROGRAM)
    			WriteMemory(FloatToHex(VarHexRPM4),FiringFunctionData+0x1cc,PROGRAM)
    		}
    	}
    }
    return
    
    GravitySetting:
    if Done = 1
    {
    if GravitySet = 1
    	{
    		iniRead,GravityBackup,Backup.dfd,%CurrentWeaponName3%,Gravity
    		if GravityBackup = ERROR
    		{
    			IniWrite,%Gravity%,Backup.dfd,%CurrentWeaponName3%,Gravity
    		}
    		else 
    		{
    			if (Gravity = 0)
    				return
    			WriteMemory(FloatToHex(0),BulletEntityData+0x130,PROGRAM)		
    		}
    	}
    	
    if GravitySet = 0
    	{
    		iniRead,GravityBackup,Backup.dfd,%CurrentWeaponName3%,Gravity
    		if GravityBackup != ERROR
    		{
    			VarHexGr := FloatToHex(GravityBackup)
    			if (Gravity = GravityBackup)
    				return
    			WriteMemory(VarHexGr,BulletEntityData+0x130,PROGRAM)
    		}
    	}
    }
    return
    
    MuzzleVelocitySetting:
    if Done = 1
    {
    Gui, Submit, Nohide
    if MuzzleVel = 1 
    	{
    		iniRead,MuzzleBackup,Backup.dfd,%CurrentWeaponName3%,MuzzleVelocity
    		if MuzzleBackup = ERROR
    		{
    			IniWrite,%MuzzleVelo%,Backup.dfd,%CurrentWeaponName3%,MuzzleVelocity
    		}
    		else
    		{
    			GuiControl,,MuzzleText,Vel %MuzzleV%
    		;	if (MuzzleVelo = HexToFloat(FloatToHex(MuzzleV))) 
    		;		return
    			WriteMemory(FloatToHex(MuzzleV),FiringFunctionData+0x88,PROGRAM)
    		}
    }
    	
    if MuzzleVel = 0
    	{
    		iniRead,MuzzleBackup,Backup.dfd,%CurrentWeaponName3%,MuzzleVelocity
    		if MuzzleBackup != ERROR
    		{
    			GuiControl,,MuzzleText,Vel %MuzzleBackup%
    			VarHexVel := FloatToHex(MuzzleBackup)
    		;	if (MuzzleVelo = MuzzleBackup) 
    		;		return
    			WriteMemory(VarHexVel,FiringFunctionData+0x88,PROGRAM)
    		}
    	}
    }
    return
    
    Overlay:
    if Overlay = 1
    {
    Settimer, OverlayUpdate,1 
    }
    if Overlay = 0
    {
    	Settimer, OverlayUpdate, Off
    	Gui,2: Destroy
    }
    return
    
    OverlayUpdate:
    projectilesLoaded := Convert(ReadMemory(CFiring+0x01a0,PROGRAM),"D")
    projectilesInMagazines := Convert(ReadMemory(CFiring+0x01a4,PROGRAM),"D")
    SendText := Round(HexToFloat(Convert(ReadMemory(HealthComponent+0x20,PROGRAM),"H"))) " / 100 `n" projectilesLoaded " / " ProjectilesInMagazines
    Width := 120, Height := 50
    Gui, 2:  -Caption +E0x80000 +LastFound +OwnDialogs +Owner +AlwaysOnTop
    Gui, 2: Show, NA
    hwnd1 := WinExist()
    hbm := CreateDIBSection(Width, Height)
    hdc := CreateCompatibleDC()
    obm := SelectObject(hdc, hbm)
    G := Gdip_GraphicsFromHDC(hdc)
    Gdip_SetSmoothingMode(G, 4)
    pBrush := Gdip_BrushCreateSolid(0x00000000)
    Gdip_FillRoundedRectangle(G, pBrush, 0, 0, Width, Height, 20)
    Gdip_DeleteBrush(pBrush)
    Font = Arial
    If !hFamily := Gdip_FontFamilyCreate(Font)
    {
       MsgBox, 48, Font error!, The font you have specified does not exist on the system
       ExitApp
    }
    Options = x10p y30p w80p Left cFF00ff00 r4 s15 BoldItalic
    Gdip_TextToGraphics(G, SendText, Options, Font, Width, Height) 
    UpdateLayeredWindow(hwnd1, hdc, PosX, PosY+180, Width, Height)
    Gdip_DeleteFontFamily(hFamily)
    SelectObject(hdc, obm)
    DeleteObject(hbm)
    DeleteDC(hdc)
    Gdip_DeleteGraphics(G)
    return
    
    Breath:
    if Breath = 1
    {
    if InVehicle = 1
    	return
    if Done = 1
    {
    	WriteMemory(0x00,BreathControlHandler+0x38,PROGRAM)
    	WriteMemory(0x00,BreathControlHandler+0x3C,PROGRAM)
    	WriteMemory(0x00,BreathControlHandler+0x40,PROGRAM)
    	WriteMemory(0x00,BreathControlHandler+0x44,PROGRAM)
    	WriteMemory(0x00,BreathControlHandler+0x48,PROGRAM)
    	WriteMemory(0x00,BreathControlHandler+0x4C,PROGRAM)
    	WriteMemory(0x00,BreathControlHandler+0x58,PROGRAM)
    }
    else
    	return
    }
    return
    
    Debug:
    Tooltip % "Base " Base " `n Deploy  " DeployScreen " `n Context " Convert(GameContext,"H") "`n  ClientPlayerManager  " Convert(ClientPlayerManager,"H") "`n ClientPlayer" Convert(ClientPlayer,"H") " `n InVehicle " Convert(InVehicle,"H") "`n PlayerName " PlayerName "`n CLTeamID " Convert(ClientPlayerTeamID,"H") " `n  ClientSoldier " Convert(ClientSoldier,"H") " `n HealthComponent " Convert(HealthComponent,"H") " `n ClientHealth " ClientHealth " `n  `n Angle  " Convert(Angles,"H") " `n CorrectedFiring " Convert(CFiring,"H") " `n W " Convert(CurrentWeaponName,"H") " `n W2 " Convert(CurrentWeaponName2,"H") "`n W3 " CurrentWeaponName3 " `n PrimaryFire " Convert(PrimaryFire,"H") " `n FirngFuncData " Convert(FiringFunctionData,"H") " `n BulletEntityData " Convert(BulletEntityData,"H") " `n WeaponSway " Convert(WeaponSway,"H") " `n WeaponSwayData " Convert(WeaponSwayData,"H")  " `n `n IdToPlayerMapOffset " Convert(IdToPlayerMapOffset,"H") " `n pPlayer " Convert(pPlayer,"H") "`n pSoldierName" pSoldierName "`n pPlayerTeamID " Convert(pPlayerTeamID,"H") "`n pSoldier " Convert(pSoldier,"H") "`n pHealthComponent " Convert(pHealthComponent,"H") "`n pHealth " pHealth "`n pReplication " Convert(pReplication,"H")   ,1800,0
    return
    
    
    pData:
    Gui, Submit, Nohide
    if PlayerRadar = 1
    {
    Straal := (2*150)
    PosCX := PosCX1 - Straal
    PosCY := PosCY1 - Straal 
    Width3 := WidthW, Height3 := HeightH
    Gui, 4:  -Caption +E0x80000 +LastFound +OwnDialogs +Owner +AlwaysOnTop 
    
    Gui, 4: Show, NA 
    hwnd3 := WinExist()
    hbm3 := CreateDIBSection(Width3, Height3)
    hdc3 := CreateCompatibleDC()
    obm3 := SelectObject(hdc3, hbm3)
    G3 := Gdip_GraphicsFromHDC(hdc3)
    Gdip_SetSmoothingMode(G3, 4)
    pBrush4 := Gdip_BrushCreateSolid(0x11000000)
    pBrush5 := Gdip_BrushCreateSolid(0xFF00FF00)
    Gdip_FillRoundedRectangle(G3, pBrush4, PosCX, PosCY, Straal, Straal, Straal/2)
    Gdip_FillRoundedRectangle(G3, pBrush5, (PosCX+(Straal/2)), (PosCY+(Straal/2)) , 5, 5, 2.5)
    Gdip_DeleteBrush(pBrush4)
    Gdip_DeleteBrush(pBrush5)
    }
    While (ide < 64)
    	{
    		if Round(HexToFloat(Convert(ReadMemory(HealthComponent+0x20,PROGRAM),"H"))) < 1
    			continue
    		IdToPlayerMapOffset := ReadMemory(ClientPlayerManager+0x548,PROGRAM,5)
    		if IdToPlayerMapOffset != -1
    			{
    				ide ++
    				pPlayer := ReadMemory(IdToPlayerMapOffset+(ide * 0x8),PROGRAM,5)
    				if pPlayer != -1
    				{
    					pSoldierName := ReadMemoryStr(pPlayer+0x40,PROGRAM)
    					pPlayerTeamID := ReadMemory(pPlayer+0x13cc,PROGRAM)
    					pSoldier := ReadMemory(pPlayer+0x14D0,PROGRAM,5)
    					if pSoldier != -1
    					{
    						pHealthComponent := ReadMemory(pSoldier+0x140,PROGRAM,5)
    						if pHealthComponent != -1
    						{
    							pHealth := Round(HexToFloat(Convert(ReadMemory(pHealthComponent+0x20,PROGRAM),"H")))
    						}						
    						pReplication := ReadMemory(pSoldier+0x490,PROGRAM,5)
    						if pReplication != -1
    						{
    							pPositionX := HexToFloat(Convert(ReadMemory(pReplication+0x30,PROGRAM),"H"))
    							pPositionY := HexToFloat(Convert(ReadMemory(pReplication+0x34,PROGRAM),"H"))
    							pPositionZ := HexToFloat(Convert(ReadMemory(pReplication+0x38,PROGRAM),"H"))
    							;pVelocityX := HexToFLoat(Convert(ReadMemory(pReplication+0x50,PROGRAM),"H"))
    							;pVelocityY := HexToFloat(Convert(ReadMemory(pReplication+0x54,PROGRAM),"H"))
    							;pVelocityZ := HexToFloat(Convert(ReadMemory(pReplication+0x58,PROGRAM),"H"))
    							PositionX := HexToFloat(Convert(ReadMemory(ClientReplication+0x30,PROGRAM),"H"))
    							PositionY := HexToFloat(Convert(ReadMemory(ClientReplication+0x34,PROGRAM),"H")) ;Heigth in map
    							PositionZ := HexToFloat(Convert(ReadMemory(ClientReplication+0x38,PROGRAM),"H"))
    						}
    					}
    				}
    			}
    			Yaw := HexToFloat(Convert(ReadMemory(ClientSoldier+0x4D8,PROGRAM),"H"))
    			angle := -Yaw
    			if Spotting = 1
    			{
    			if pPlayerTeamID != %ClientPlayerTeamID%
    				{
    				SpottingTargetComponentData := Convert(ReadMemory(pSoldier+0xBF0,PROGRAM,5),"H")
    				SpotType := ReadMemory(SpottingTargetComponentData+0x50,PROGRAM)
    				if (SpotType = 0 && ClientHealth > 0)
    					WriteMemory(0x1,SpottingTargetComponentData+0x50,PROGRAM)
    				}	
    			}
    			if PlayerRadar = 1
    			{	
    				IfNotEqual, pPlayerTeamID,  %ClientPlayerTeamID% ; if other team 
    				{
    					RColor = 0xFFFF0000
    				}
    			else
    				{
    				if ShowTeam = 1
    					RColor = 0xFF0000FF
    				Else
    					RColor = 0x00000000
    				}
    				if pHealth <= 1
    				{
    					RColor = 0x00000000
    				}
    				Distance:
    				xD := Round(PositionX - pPositionX)	
    				yD := Round(PositionY - pPositionY)
    				zD := Round(PositionZ - pPositionZ)
    				pDistance := Round(sqrt((xD * xD) + (yD * yD) + (zD * zD)))
    				ArrayCount++
    				RC%ArrayCount% := RColor
    				xD%ArrayCount% := pPositionX
    				yD%ArrayCount% := pPositionY
    				zD%ArrayCount% := pPositionZ
    				%ArrayCount% := pDistance 
    				Ry := positionZ - zD%ArrayCount%
    				Rx := PositionX - xD%ArrayCount%
    				if (pDistance < 150)
    				{
    					if (pDistance = 0)
    						continue
    					xR%ArrayCount% := (Rx*Cos(angle)-Ry*Sin(angle))+(PosCX+(Straal/2))
    					yR%ArrayCount% := (Rx*Sin(angle)+Ry*Cos(angle))+(PosCY+(Straal/2))
    					pBrush6 := Gdip_BrushCreateSolid(RC%ArrayCount%)
    					Gdip_FillRoundedRectangle(G3, pBrush6, xR%ArrayCount%, yR%ArrayCount% , 5, 5, 2.5)
    					Gdip_DeleteBrush(pBrush6)
    				}
    			} 
    	}	;End While Loop
    if PlayerRadar = 1
    {
    UpdateLayeredWindow(hwnd3, hdc3, 0, 0, Width3, Height3)
    SelectObject(hdc3, obm3)
    DeleteObject(hbm3)
    DeleteDC(hdc3)
    Gdip_DeleteGraphics(G3)
    }
    if PlayerRadar = 0
    {
    	Gui, 4: Destroy
    }
    ArrayCount = 0
    ide = 0
    return
    
    Base:
    IfWinActive,Battlefield 4
    {
        Base := getProcessBaseAddress(PROGRAM)
    	DeployScreen := ReadMemory(Base+0x21caee0+0x110,PROGRAM,5)
    	if DeployScreen = 0
    	{
    		Angles := ReadMemory(Base+0x21caee0,PROGRAM,5)
    		if Angles != -1
    		{
    			CFiring := ReadMemory(Angles+0x49c0,PROGRAM,5)
    			if CFiring != -1
    			{
    				CurrentWeaponName := ReadMemory(CFiring+0x01c8,PROGRAM,5)
    				if CurrentWeaponName != -1
    				{
    					CurrentWeaponName2 := ReadMemory(CurrentWeaponName+0x130,PROGRAM,5)
    					if CurrentWeaponName2 != -1
    					{				
    						CurrentWeaponName3 := ReadMemoryStr(CurrentWeaponName2+0x0,PROGRAM)	
    					}
    				}
    				PrimaryFire := 	ReadMemory(CFiring+0x0128,PROGRAM,5)
    				if PrimaryFire != -1
    				{
    					FiringFunctionData := ReadMemory(PrimaryFire+0x0010,PROGRAM,5)
    					if FiringFunctionData != -1
    					{
    						BulletEntityData := ReadMemory(FiringFunctionData+0x00B0,PROGRAM,5)
    					}
    				}
    				WeaponSway := ReadMemory(CFiring+0x0078,PROGRAM,5)
    				if WeaponSway != -1
    				{
    					WeaponSwayData := ReadMemory(WeaponSway+0x0008,PROGRAM,5)
    				}
    			}
    		}
    		GameContext := ReadMemory(Base+0x24abd20,PROGRAM,5)
    		if (GameContext != -1)
    		{
    			ClientPlayerManager := ReadMemory(GameContext+0x60,PROGRAM,5)
    			if (ClientPlayerManager != -1)
    			{
    				ClientPlayer := ReadMemory(ClientPlayerManager+0x540,PROGRAM,5)
    				if ClientPlayer != -1
    				{
    					InVehicle := ReadMemory(ClientPlayer+0x14c0,PROGRAM)
    					PlayerName := ReadMemoryStr(ClientPlayer+0x40,PROGRAM)
    					ClientPlayerTeamID := ReadMemory(ClientPlayer+0x13cc,PROGRAM)
    					ClientSoldier := ReadMemory(ClientPlayer+0x14d0,PROGRAM,5)
    					if ClientSoldier != -1
    					{
    						SoldierWeaponComponent := ReadMemory(ClientSoldier+0x570,PROGRAM,5)
    						if SoldierWeaponCompnent != -1
    						{
    							ActiveSlot := ReadMemory(SoldierWeaponComponent+0x0a98,PROGRAM) +2
    							Done :=  ActiveSlot = 2 OR ActiveSlot = 3 OR ActiveSlot = 11
    						}
    						ClientReplication := ReadMemory(ClientSoldier+0x490,PROGRAM,5)
    						breathControlHandler := ReadMemory(ClientSoldier+0x588,PROGRAM,5)
    						HealthComponent := ReadMemory(ClientSoldier+0x140,PROGRAM,5) 
    					}
    				}
    			}
    		}
    	}
    }
    return
    /*
    	;----------------LocelPlayer--------------------
    	;ClientPlayer := Convert(ReadMemory(ClientPlayerManager+0x540,PROGRAM),"H") 
    	;ClientSoldier := Convert(ReadMemory(ClientPlayer+0x14d0,PROGRAM),"H")
    	;ClientReplication := Convert(ReadMemory(ClientSoldier+0x490,PROGRAM),"H")
    	;SoldierWeaponsComponent := Convert(ReadMemory(ClientSoldier+0x570,PROGRAM),"H")
    	;breathControlHandler := Convert(ReadMemory(ClientSoldier+0x588,PROGRAM),"H")
    	;HealthComponent := Convert(ReadMemory(ClientSoldier+0x140,PROGRAM),"H")
    	;ClientHealth := Convert(ReadMemory(HealthComponent+0x20,PROGRAM),"H")
    	;PlayerName := ReadMemoryStr(ClientPlayer+0x40,PROGRAM)
    	;ClientPlayerTeamID := ReadMemory(ClientPlayer+0x13cc,PROGRAM)
    	;cActiveSlot := Convert(ReadMemory(SoldierWeaponComponent+0x0a98,PROGRAM),"H")
    	;Done :=  ActiveSlot = 2 OR ActiveSlot = 3 OR ActiveSlot = 11
    	;InVehicle := Convert(ReadMemory(ClientPlayer+0x14c0,PROGRAM),"H")
    	;CorrectedFiring := Convert(ReadMemory(Angles+0x49c0,PROGRAM),"H")
    	;CurrentWeaponName := Convert(ReadMemory(CorrectedFiring+0x01c8,PROGRAM),"H")
    	;PrimaryFire := 	Convert(ReadMemory(CorrectedFiring+0x0128,PROGRAM),"H")
    	;WeaponSway := Convert(ReadMemory(CorrectedFiring+0x0078,PROGRAM),"H")
    	WeaponSwayData := Convert(ReadMemory(WeaponSway+0x0008,PROGRAM),"H")
    	SpreadBase := Round(HexToFLoat(Convert(ReadMemory(WeaponSwayData+0x0430,PROGRAM),"H"))*100)
    	Recoil1 := Convert(ReadMemory(WeaponSwayData+0x0440,PROGRAM),"H")
    	Recoil2 := Convert(ReadMemory(WeaponSwayData+0x0444,PROGRAM),"H")
    	FiringFunctionData := Convert(ReadMemory(PrimaryFire+0x0010,PROGRAM),"H")
    	MuzzleVelo := HexToFloat(Convert(ReadMemory(FiringFunctionData+0x0088,PROGRAM),"H"))
    	BulletEntityData := Convert(ReadMemory(FiringFunctionData+0x00B0,PROGRAM),"H")
    	Gravity := HexToFloat(Convert(ReadMemory(BulletEntityData+0x0130,PROGRAM),"H"))
    	ClientROFAuto := HexToFloat(Convert(ReadMemory(FiringFunctionData+0x1c8,PROGRAM),"H"))
    	ClientROFBurst := HexToFloat(Convert(ReadMemory(FiringFunctionData+0x1cc,PROGRAM),"H"))
    	;CurrentWeaponName2 := Convert(ReadMemory(CurrentWeaponName+0x130,PROGRAM),"H")
    	;CurrentWeaponName3 := ReadMemoryStr(CurrentWeaponName2+0x0,PROGRAM)	
    	MuzzleVelocity := Convert(ReadMemory(FiringFunctionData+0x88,PROGRAM),"H")
    	ROFSettings := Convert(ReadMemory(FiringFunctionData+0x1c8,PROGRAM),"H")
    	SpreadBase := Convert(ReadMemory(WeaponSwayData+0x0430,PROGRAM),"H")
    */
    
    
    WriteMemory(WVALUE,MADDRESS,PROGRAM) 
    { 
    winget, pid, PID, %PROGRAM% 
    ProcessHandle := DllCall("OpenProcess", "int", 2035711, "char", 0, "UInt", PID, "UInt") 
    DllCall("WriteProcessMemory", "UInt", ProcessHandle, "UInt", MADDRESS, "Uint*", WVALUE, "Uint", 4, "Uint *", 0) 
    
    return 
    }
    
    HexToFloat(x) {
       Return (1-2*(x>>31)) * (2**((x>>23 & 255)-150)) * (0x800000 | x & 0x7FFFFF)
    }
    
    HexToDouble(x) { ; may be wrong at extreme values
       Return (2*(x>0)-1) * (2**((x>>52 & 0x7FF)-1075)) * (0x10000000000000 | x & 0xFFFFFFFFFFFFF)
    }
    
    FloatToHex(f) {
       form := A_FormatInteger
       SetFormat Integer, HEX
       v := DllCall("MulDiv", Float,f, Int,1, Int,1, UInt)
       SetFormat Integer, %form%
       Return v
    }
    
    DoubleToHex(d) {
       form := A_FormatInteger
       SetFormat Integer, HEX
       v := DllCall("ntdll.dll\RtlLargeIntegerShiftLeft",Double,d, UChar,0, Int64)
       SetFormat Integer, %form%
       Return v
    }
    
    ReadMemory(MADDRESS=0,PROGRAM="",BYTE=4,MVALUE=" ")
    {
    	Static OLDPROC, ProcessHandle
    	if MVALUE := " " 
    	VarSetCapacity(MVALUE,4,0)
    	If PROGRAM != %OLDPROC%
    	{
    		WinGet, pid, pid, % OLDPROC := PROGRAM
    		ProcessHandle := ( ProcessHandle ? 0*(closed:=DllCall("CloseHandle"
    		,"UInt",ProcessHandle)) : 0 )+(pid ? DllCall("OpenProcess"
    		,"Int",16,"Int",0,"UInt",pid) : 0)
    	}
    	If (ProcessHandle) && DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",MADDRESS,"str",MVALUE,"UInt",BYTE,"UInt *",0)
    	return *(&MVALUE+4)<<32 | *(&MVALUE+3)<<24 | *(&MVALUE+2)<<16 | *(&MVALUE+1)<<8 | *(&MVALUE)
    	return !ProcessHandle ? "Handle Closed: " closed : "-2"
    }
    
    getProcessBaseAddress(WindowTitle, windowMatchMode := "3")    ;WindowTitle can be anything ahk_exe ahk_class etc
    {
        if (windowMatchMode && A_TitleMatchMode != windowMatchMode)
        {
            mode := A_TitleMatchMode ; This is a string and will not contain the 0x prefix
            StringReplace, windowMatchMode, windowMatchMode, 0x ; remove hex prefix as SetTitleMatchMode will throw a run time error. This will occur if integer mode is set to hex and matchmode param is passed as an number not a string.
            SetTitleMatchMode, %windowMatchMode%    ;mode 3 is an exact match
        }
        WinGet, hWnd, ID, %WindowTitle%
        if mode
            SetTitleMatchMode, %mode%    ; In case executed in autoexec
        if !hWnd
            return ; return blank failed to find window
        return DllCall(A_PtrSize = 4     ; If DLL call fails, returned value will = 0
            ? "GetWindowLong"
            : "GetWindowLongPtr"
            , "Ptr", hWnd, "Int", -6, A_Is64bitOS ? "Int64" : "UInt")  
            ; For the returned value when the OS is 64 bit use Int64 to prevent negative overflow when AHK is 32 bit and target process is 64bit 
            ; however if the OS is 32 bit, must use UInt, otherwise the number will be huge (however it will still work as the lower 4 bytes are correct)      
            ; Note - it's the OS bitness which matters here, not the scripts/AHKs
    }   
    
    ReadMemoryStr(MADDRESS=0, PROGRAM = "", length = 0 , terminator = "")  ; "" = Null
    { 
        Static OLDPROC, ProcessHandle
    
        If (PROGRAM != OLDPROC || !ProcessHandle)
        {
            WinGet, pid, pid, % OLDPROC := PROGRAM
            ProcessHandle := ( ProcessHandle ? 0*(closed:=DllCall("CloseHandle"
            ,"UInt",ProcessHandle)) : 0 )+(pid ? DllCall("OpenProcess"
            ,"Int",16,"Int",0,"UInt",pid) : 0) ;PID is stored in value pid
        }
        ; length depends on the encoding too
        VarSetCapacity(Output, length ? length : 1, 0)
        If !length ; read until terminator found or something goes wrong/error
    	{
            Loop
            { 
                success := DllCall("ReadProcessMemory", "UInt", ProcessHandle, "UInt", MADDRESS++, "str", Output, "Uint", 1, "Uint *", 0) 
                if (ErrorLevel || !success || Output = terminator) 
                    break
                teststr .= Output 
    		} 
    	}		
    	Else ; will read X length
    	{
            DllCall("ReadProcessMemory", "UInt", ProcessHandle, "UInt", MADDRESS, "str", Output, "Uint", length, "Uint *", 0) 
            ;  Loop % length
            ;     teststr .= chr(NumGet(Output, A_Index-1, "Char"))      
            teststr := StrGet(&Output, length, "UTF-8")
    	}
    	return teststr  
    }
    
    ;H for Hex D for Dec
    Convert(Number=0, ConvertTo="") {
    	TmpNum := Number
    	Ok := False
    	If TmpNum Is Integer
    		Ok := True
    	Else If TmpNum Is Xdigit
    	{
    		Ok := True
    		TmpNum := "0x" TmpNum
    	} Else If (InStr(TmpNum, "0x"))
    		Ok := True
    	Else
    		Return -1
    	If (Ok)
    		If (ConvertTo = "D" ) {
    			SetFormat Integer, D
    			TmpNum += 0
    			SetFormat Integer, H
    			Return TmpNum
    		} Else If (ConvertTo = "H") {
    			SetFormat Integer, H
    			TmpNum += 0
    			SetFormat Integer, D
    			Return TmpNum
    		} Else
    			Return -2
    	Else
    		Return -3
    }
    
    SaveSettings:
    IniWrite,%NoSpread%,Settings.dfd,Settings,Spread
    IniWrite,%NoRecoil%,Settings.dfd,Settings,Recoil
    IniWrite,%Overlay%,Settings.dfd,Settings,Overlay
    IniWrite,%Breath%,Settings.dfd,Settings,Breath
    IniWrite,%Spotting%,Settings.dfd,Settings,Spotting
    IniWrite,%PlayerRadar%,Settings.dfd,Settings,PlayerRadar
    IniWrite,%ShowTeam%,Settings.dfd,Settings,ShowTeam
    IniWrite,%PosCX1%,Settings.dfd,Settings,PosCX1
    IniWrite,%PosCY1%,Settings.dfd,Settings,PosCY1
    iniWrite,%ROFAuto%,Settings.dfd,Settings,ROFAuto
    IniWrite,%Auto%,Settings.dfd,Settings,Auto
    IniWrite,%GravitySet%,Settings.dfd,Settings,Gravity
    iniWrite,%MuzzleVel%,Settings.dfd,Settings,MuzzleSet
    iniWrite,%MuzzleV%,Settings.dfd,Settings,MuzzleVelocity
    return
    Last edited by emlor; 01-10-2016 at 06:02 PM.

  3. #3
    iamSxlvatore's Avatar
    Join Date
    Jan 2016
    Gender
    male
    Posts
    8
    Reputation
    10
    Thanks
    0
    My Mood
    Sad
    thank you so much!! +1

    - - - Updated - - -

    Quote Originally Posted by emlor View Post
    Copy this code into the previous script overwriting everything.. or just make a new AHK script with this code

    I had used this one for awhile now and the only thing it misses is the autospotting and the minimap
    recoil , spread , gravity still work as well as velocity and such

    Code:
    #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
    ; #Warn  ; Enable warnings to assist with detecting common errors.
    SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
    SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
    #SingleInstance Force
    #NoEnv
    #include GDI+.ahk
    SetBatchLines -1
    MaxROF = 2000
    MaxVel = 10000
    IniRead,NoSpread,Settings.dfd,Settings,Spread,100
    NoSpreadOld := NoSpread + 2
    IniRead,NoRecoil,Settings.dfd,Settings,Recoil,0
    IniRead,Overlay,Settings.dfd,Settings,Overlay,0
    IniRead,Breath,Settings.dfd,Settings,Breath,0
    IniRead,Spotting,Settings.dfd,Settings,Spotting,0
    IniRead,PlayerRadar,Settings.dfd,Settings,PlayerRadar,0
    IniRead,showTeam,Settings.dfd,Settings,ShowTeam,0
    IniRead,PosCX1,Settings.dfd,Settings,PosCX1,1920
    IniRead,PosCY1,Settings.dfd,Settings,PosCY1,540
    IniRead,ROFAuto,Settings.dfd,Settings,ROFAuto,0
    IniRead,Auto,Settings.dfd,Settings,Auto,%A_Space%
    IniRead,GravitySet,Settings.dfd,Settings,Gravity,0
    IniRead,MuzzleVel,Settings.dfd,Settings,MuzzleSet,0
    iniRead,MuzzleV,Settings.dfd,Settings,MuzzleVelocity
    
    Process,Priority,,R
    
    ;0BBCE9410
    ;151B1D500
    
    ;Type---------------
    PROGRAM = Battlefield 4
    Settimer,Base,10
    Settimer,pData,10
    Settimer, WindowXY,100
    Settimer, Spread,300
    Settimer, Recoil,300
    Settimer, MuzzleVelocitySetting,300
    Settimer, ROFSetting,300
    Settimer, GravitySetting,300
    ;Settimer, Debug, 10
    Settimer,Breath,300
    Settimer, SaveSettings,5000
    Settimer,Overlay,300
    
    If !pToken := Gdip_Startup()
    {
       MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
       ExitApp
    }
    
    /*
    Offset(kl="")
    {
    CLIENTGAMECONTEXT = 0x24a0c00 ;0 +  Base
    ANGLES := 0x21e3400 ;+ base
    ;---------gamecontext----------
    ClientPlayerManager := 0x60 ;GameContext 
    idToPlayerMapOffset := 0x548 ;ClientPlayerManager
    ;------------------ReadLocalPlayer --------------------
    ClientPlayer = 0x540 ;ClientPlayerManager 
    ClientSoldier = 0x14d0 ;ClientPlayer 
    ClientReplication = 0x490 ;ClientSoldier
    soldierWeaponsComponent = 0x570 ;ClientSoldier 
    breathControlHandler = 0x588 ;clientSoldier
    pHealthComponent = 0x140 ;ClientSoldier
    ActiveSlot = 0x0a98 ;SoldierWeaponCompenent 
    CurrentAnimatedWeaponHandler = 0x0890 ;soldierWeaponComponent
    ClientSoldierWeapon := * 0x8 ;currentAnimantedWeaponHandler + ActiveSlot
    CorrectedFiring := 0x49c0 ;Angles
    WeaponSway := 0x78 ;CorrectedFiring
    WeaponSwayData := 0x08 ;WeaponSway
    ;---------------------PlayerData-------------------
    InVehicle := 0x14c0 ;clientPlayer
    TeamID := 0x13cc ;Clientplayer
    Health := 0x20 ;pHealthComponent
    projectilesLoaded := 0x01a0 ;CorrectedFiring
    ProjectilesInMagazines := 0x01a4 ;CorrectedFiring
    PositionX := 0x30 ;clientReplication
    PositionY := 0x34 ;ClientReplication
    PositionZ := 0x38 ;clientReplication
    flYaw := 0x4D8 ;clientSoldier
    Return %kl%
    }
    */
    
    
    MainGui():
    if WinExist("Battlefield 4")
    {
    WinGetPos,Xpos, YPos,WidthW,HeightH,Battlefield 4
    PosX := XPos+10, PosY := YPos +20
    Gui +AlwaysOnTop -Caption +ToolWindow
    Gui, Color, FA0000
    gui, font,cFF0000 S12 Bold, Arial
    Gui, Add, Text, x10 y10 w100 h20 vNSpread ,Spread %NoSpread%
    Gui, Add, Slider,x120 y10 W50 h20 Center NoTicks Range0-100 vNoSpread gSpread ,%NoSpread%
    
    Gui, Add, text, x10 y30 w100 h30, NoRecoil
    Gui, Add, CheckBox,x120 y30 Checked%NoRecoil% vNoRecoil ; gRecoil
    
    Gui,Add,Text, x10 y50 W100 H40,Overlay
    Gui, Add, CheckBox, x120 y50 Checked%Overlay% vOverlay gOverlay
    
    gui, Add, Text, x10 y70 w120 h30, NoBreath
    Gui, Add, CheckBox, X120 y70 Checked%Breath% vBreath gBreath
    
    Gui, Add, Text,x10 y90 w120 h30,MiniMap Spotting
    Gui, Add, CheckBox,x120 y90 Checked%Spotting% vSpotting gpData
    
    Gui, Add, Text,x10 y110 w120 h30,EnemyRadar
    Gui, Add, Checkbox,x120 y110 Checked%PlayerRadar% vPlayerRadar gpData
    
    Gui, Add, Text ,x10 y130 w120 H30,ShowTeam
    Gui, Add, CheckBox,x120 y130 Checked%ShowTeam% vShowTeam gpData
    
    Gui, Add, Text,x10 y150 W120 H30,HorzPos
    Gui, Add, Slider,x120 y150 w50 h20 Center NoTicks range0-%A_ScreenWidth% vPosCX1 gpData,%PosCX1%
    
    Gui, Add, Text,x10 y170 W120 H30,VertPos
    Gui, Add, Slider,x120 y170 w50 h20 Center NoTicks range0-%A_ScreenHeight% vPosCY1 gpData,%PosCY1%
    
    Gui, Add, Text, x10 y190 w110 h20 vRPMAuto,ROF %Auto%
    Gui, Add, CheckBox,x120 y190  h15 w15 Checked%ROFAuto% vROFAuto 
    Gui, Add, Slider,x140 y190 w50 h20 Center NoTicks range0-%MaxROF% vAuto, %Auto%
    
    Gui, Add, text,x10 y210 w110 h20,NoGravity
    Gui, Add, CheckBox,x120 y210 h15 w15 Checked%GravitySet% vGravitySet ; gRecoil
    
    Gui, Add, Text,x10 y230 w110 h20 vMuzzleText,Vel %MuzzleV%
    Gui, Add, CheckBox,x120 y230  h15 w15 Checked%MuzzleVel% vMuzzleVel 
    Gui, Add, Slider,x140 y230 w50 h20 Center NoTicks range0-%MaxVel% vMuzzleV, %MuzzleV%
    
    Gui, Show, NA x%PosX% y%PosY%,Gui77
    WinSet, TransColor,FA0000, Gui77
    }
    return
    
    
    ~Numpad0::
    IfWinNotActive,Gui77
    {
    	WinGetPos,Xpos, YPos,WidthW,HeightH,Battlefield 4
        PosX := XPos, PosY := YPos
    	Gui, Show,x%PosX% y%PosY%,Gui77
    	WinMove,Gui77,,PosX,PosY
    }
    return
    
    WindowXY:
    WinGetPos,Xpos, YPos,WidthW,HeightH,Battlefield 4
    IfWinNotActive,Gui77
    	Gui,Hide
    IfWinNotExist,Battlefield 4
    {
    	FileDelete,%A_WorkingDir%\Backup.dfd
    	ExitApp
    }
    return
    
    Spread:
    Gui, Submit, Nohide
    if Done = 1
    {
    NoSpreadDec := Round(NoSpread/100,3)
    VarHex := FloatToHex(NoSpreadDec)
    StringTrimRight,NoSpreadDec,NoSpreadDec,1
    GuiControl,,NSpread,Spread %NoSpreadDec%
    	WriteMemory(VarHex,WeaponSwayData+0x0430,PROGRAM) ;VisualSpreadADS
    	WriteMemory(VarHex,WeaponSwayData+0x0434,PROGRAM) ;ProjectileSpreadADS
    	WriteMemory(VarHex,WeaponSwayData+0x0438,PROGRAM) ;VisualSpread
    	WriteMemory(VarHex,WeaponSwayData+0x043C,PROGRAM) ;ProjectileSpread
    }
    return
    
    Recoil:
    if Done = 1
    {
    Gui, Submit, Nohide
    if NoRecoil = 1
    	{
    		;if (Recoil1 = FloatToHex(100)) && (Recoil2 = FloatToHex(0))
    		;	return
    		iniRead,WeaponNameLoad,Backup.dfd,%CurrentWeaponName3%,Weapon
    		if WeaponNameLoad != %CurrentWeaponName3%
    		{
    			IniWrite,%CurrentWeaponName3%,Backup.dfd,%CurrentWeaponName3%,Weapon
    			IniWrite,%Recoil1%,Backup.dfd,%CurrentWeaponName3%,Recoil1B
    			IniWrite,%Recoil2%,Backup.dfd,%CurrentWeaponName3%,Recoil2B
    			}
    			WriteMemory(FloatToHex(100),WeaponSwayData+0x0440,PROGRAM)
    			WriteMemory(FloatToHex(0),WeaponSwayData+0x0444,PROGRAM)
    		}
    		
    if NoRecoil = 0
       {
    	iniRead,WeaponNameLoad,Backup.dfd,%CurrentWeaponName3%,Weapon
    	if WeaponNameLoad != ERROR
    	{
    	IniRead,Recoil1Ret,Backup.dfd,%CurrentWeaponName3%,Recoil1B
    	IniRead,Recoil2Ret,Backup.dfd,%CurrentWeaponName3%,Recoil2B
    ;	if (Recoil1 = Recoil1Ret) && (Recoil2 = Recoil2Ret)
    	;	return
    		WriteMemory(Recoil1Ret,WeaponSwayData+0x0440,PROGRAM)
    		WriteMemory(Recoil2Ret,WeaponSwayData+0x0444,PROGRAM)
    	    }
    	}
    }
    return
    
    
    ROFSetting:
    if Done = 1
    {
    Gui, Submit, Nohide
    if ROFAuto = 1
    	{
    		iniRead,ROF,Backup.dfd,%CurrentWeaponName3%,ROFAuto
    		if ROF = ERROR
    		{
    			IniWrite,%ClientROFAuto%,Backup.dfd,%CurrentWeaponName3%,ROFAuto
    			IniWrite,%ClientROFBurst%,Backup.dfd,%CurrentWeaponName3%,ROFBurst
    		}
    		else
    		{
    			RPM1 := Auto
    			VarHexRPM1 := FloatToHex(Auto)
    			GuiControl,,RPMAuto,ROF %Auto%
    		;	if (ClientROFAuto = HexToFloat(VarHexRPM1))
    		;		return
    			WriteMemory(VarHexRPM1,FiringFunctionData+0x1c8,PROGRAM)
    			WriteMemory(VarHexRPM1,FiringFunctionData+0x1cc,PROGRAM)
    		}
    }
    	
    if ROFAuto = 0
    	{
    		iniRead,ROF,Backup.dfd,%CurrentWeaponName3%,ROFAuto
    		if ROF != ERROR
    		{
    			IniRead,BackupROFAuto,Backup.dfd,%CurrentWeaponName3%,ROFAuto
    			IniRead,BackupROFBurst,Backup.dfd,%CurrentWeaponName3%,ROFBurst
    			VarHexRPM3 := BackupROFAuto
    			VarHexRPM4 := BackupROFBurst
    			GuiControl,,RPMAuto,ROF %BackupROFAuto%
    		;	if (ClientROFAuto = HexToFloat(VarHexRPM3))
    		;		return
    			WriteMemory(FloatToHex(VarHexRPM3),FiringFunctionData+0x1c8,PROGRAM)
    			WriteMemory(FloatToHex(VarHexRPM4),FiringFunctionData+0x1cc,PROGRAM)
    		}
    	}
    }
    return
    
    GravitySetting:
    if Done = 1
    {
    if GravitySet = 1
    	{
    		iniRead,GravityBackup,Backup.dfd,%CurrentWeaponName3%,Gravity
    		if GravityBackup = ERROR
    		{
    			IniWrite,%Gravity%,Backup.dfd,%CurrentWeaponName3%,Gravity
    		}
    		else 
    		{
    			if (Gravity = 0)
    				return
    			WriteMemory(FloatToHex(0),BulletEntityData+0x130,PROGRAM)		
    		}
    	}
    	
    if GravitySet = 0
    	{
    		iniRead,GravityBackup,Backup.dfd,%CurrentWeaponName3%,Gravity
    		if GravityBackup != ERROR
    		{
    			VarHexGr := FloatToHex(GravityBackup)
    			if (Gravity = GravityBackup)
    				return
    			WriteMemory(VarHexGr,BulletEntityData+0x130,PROGRAM)
    		}
    	}
    }
    return
    
    MuzzleVelocitySetting:
    if Done = 1
    {
    Gui, Submit, Nohide
    if MuzzleVel = 1 
    	{
    		iniRead,MuzzleBackup,Backup.dfd,%CurrentWeaponName3%,MuzzleVelocity
    		if MuzzleBackup = ERROR
    		{
    			IniWrite,%MuzzleVelo%,Backup.dfd,%CurrentWeaponName3%,MuzzleVelocity
    		}
    		else
    		{
    			GuiControl,,MuzzleText,Vel %MuzzleV%
    		;	if (MuzzleVelo = HexToFloat(FloatToHex(MuzzleV))) 
    		;		return
    			WriteMemory(FloatToHex(MuzzleV),FiringFunctionData+0x88,PROGRAM)
    		}
    }
    	
    if MuzzleVel = 0
    	{
    		iniRead,MuzzleBackup,Backup.dfd,%CurrentWeaponName3%,MuzzleVelocity
    		if MuzzleBackup != ERROR
    		{
    			GuiControl,,MuzzleText,Vel %MuzzleBackup%
    			VarHexVel := FloatToHex(MuzzleBackup)
    		;	if (MuzzleVelo = MuzzleBackup) 
    		;		return
    			WriteMemory(VarHexVel,FiringFunctionData+0x88,PROGRAM)
    		}
    	}
    }
    return
    
    Overlay:
    if Overlay = 1
    {
    Settimer, OverlayUpdate,1 
    }
    if Overlay = 0
    {
    	Settimer, OverlayUpdate, Off
    	Gui,2: Destroy
    }
    return
    
    OverlayUpdate:
    projectilesLoaded := Convert(ReadMemory(CFiring+0x01a0,PROGRAM),"D")
    projectilesInMagazines := Convert(ReadMemory(CFiring+0x01a4,PROGRAM),"D")
    SendText := Round(HexToFloat(Convert(ReadMemory(HealthComponent+0x20,PROGRAM),"H"))) " / 100 `n" projectilesLoaded " / " ProjectilesInMagazines
    Width := 120, Height := 50
    Gui, 2:  -Caption +E0x80000 +LastFound +OwnDialogs +Owner +AlwaysOnTop
    Gui, 2: Show, NA
    hwnd1 := WinExist()
    hbm := CreateDIBSection(Width, Height)
    hdc := CreateCompatibleDC()
    obm := SelectObject(hdc, hbm)
    G := Gdip_GraphicsFromHDC(hdc)
    Gdip_SetSmoothingMode(G, 4)
    pBrush := Gdip_BrushCreateSolid(0x00000000)
    Gdip_FillRoundedRectangle(G, pBrush, 0, 0, Width, Height, 20)
    Gdip_DeleteBrush(pBrush)
    Font = Arial
    If !hFamily := Gdip_FontFamilyCreate(Font)
    {
       MsgBox, 48, Font error!, The font you have specified does not exist on the system
       ExitApp
    }
    Options = x10p y30p w80p Left cFF00ff00 r4 s15 BoldItalic
    Gdip_TextToGraphics(G, SendText, Options, Font, Width, Height) 
    UpdateLayeredWindow(hwnd1, hdc, PosX, PosY+180, Width, Height)
    Gdip_DeleteFontFamily(hFamily)
    SelectObject(hdc, obm)
    DeleteObject(hbm)
    DeleteDC(hdc)
    Gdip_DeleteGraphics(G)
    return
    
    Breath:
    if Breath = 1
    {
    if InVehicle = 1
    	return
    if Done = 1
    {
    	WriteMemory(0x00,BreathControlHandler+0x38,PROGRAM)
    	WriteMemory(0x00,BreathControlHandler+0x3C,PROGRAM)
    	WriteMemory(0x00,BreathControlHandler+0x40,PROGRAM)
    	WriteMemory(0x00,BreathControlHandler+0x44,PROGRAM)
    	WriteMemory(0x00,BreathControlHandler+0x48,PROGRAM)
    	WriteMemory(0x00,BreathControlHandler+0x4C,PROGRAM)
    	WriteMemory(0x00,BreathControlHandler+0x58,PROGRAM)
    }
    else
    	return
    }
    return
    
    Debug:
    Tooltip % "Base " Base " `n Deploy  " DeployScreen " `n Context " Convert(GameContext,"H") "`n  ClientPlayerManager  " Convert(ClientPlayerManager,"H") "`n ClientPlayer" Convert(ClientPlayer,"H") " `n InVehicle " Convert(InVehicle,"H") "`n PlayerName " PlayerName "`n CLTeamID " Convert(ClientPlayerTeamID,"H") " `n  ClientSoldier " Convert(ClientSoldier,"H") " `n HealthComponent " Convert(HealthComponent,"H") " `n ClientHealth " ClientHealth " `n  `n Angle  " Convert(Angles,"H") " `n CorrectedFiring " Convert(CFiring,"H") " `n W " Convert(CurrentWeaponName,"H") " `n W2 " Convert(CurrentWeaponName2,"H") "`n W3 " CurrentWeaponName3 " `n PrimaryFire " Convert(PrimaryFire,"H") " `n FirngFuncData " Convert(FiringFunctionData,"H") " `n BulletEntityData " Convert(BulletEntityData,"H") " `n WeaponSway " Convert(WeaponSway,"H") " `n WeaponSwayData " Convert(WeaponSwayData,"H")  " `n `n IdToPlayerMapOffset " Convert(IdToPlayerMapOffset,"H") " `n pPlayer " Convert(pPlayer,"H") "`n pSoldierName" pSoldierName "`n pPlayerTeamID " Convert(pPlayerTeamID,"H") "`n pSoldier " Convert(pSoldier,"H") "`n pHealthComponent " Convert(pHealthComponent,"H") "`n pHealth " pHealth "`n pReplication " Convert(pReplication,"H")   ,1800,0
    return
    
    
    pData:
    Gui, Submit, Nohide
    if PlayerRadar = 1
    {
    Straal := (2*150)
    PosCX := PosCX1 - Straal
    PosCY := PosCY1 - Straal 
    Width3 := WidthW, Height3 := HeightH
    Gui, 4:  -Caption +E0x80000 +LastFound +OwnDialogs +Owner +AlwaysOnTop 
    
    Gui, 4: Show, NA 
    hwnd3 := WinExist()
    hbm3 := CreateDIBSection(Width3, Height3)
    hdc3 := CreateCompatibleDC()
    obm3 := SelectObject(hdc3, hbm3)
    G3 := Gdip_GraphicsFromHDC(hdc3)
    Gdip_SetSmoothingMode(G3, 4)
    pBrush4 := Gdip_BrushCreateSolid(0x11000000)
    pBrush5 := Gdip_BrushCreateSolid(0xFF00FF00)
    Gdip_FillRoundedRectangle(G3, pBrush4, PosCX, PosCY, Straal, Straal, Straal/2)
    Gdip_FillRoundedRectangle(G3, pBrush5, (PosCX+(Straal/2)), (PosCY+(Straal/2)) , 5, 5, 2.5)
    Gdip_DeleteBrush(pBrush4)
    Gdip_DeleteBrush(pBrush5)
    }
    While (ide < 64)
    	{
    		if Round(HexToFloat(Convert(ReadMemory(HealthComponent+0x20,PROGRAM),"H"))) < 1
    			continue
    		IdToPlayerMapOffset := ReadMemory(ClientPlayerManager+0x548,PROGRAM,5)
    		if IdToPlayerMapOffset != -1
    			{
    				ide ++
    				pPlayer := ReadMemory(IdToPlayerMapOffset+(ide * 0x8),PROGRAM,5)
    				if pPlayer != -1
    				{
    					pSoldierName := ReadMemoryStr(pPlayer+0x40,PROGRAM)
    					pPlayerTeamID := ReadMemory(pPlayer+0x13cc,PROGRAM)
    					pSoldier := ReadMemory(pPlayer+0x14D0,PROGRAM,5)
    					if pSoldier != -1
    					{
    						pHealthComponent := ReadMemory(pSoldier+0x140,PROGRAM,5)
    						if pHealthComponent != -1
    						{
    							pHealth := Round(HexToFloat(Convert(ReadMemory(pHealthComponent+0x20,PROGRAM),"H")))
    						}						
    						pReplication := ReadMemory(pSoldier+0x490,PROGRAM,5)
    						if pReplication != -1
    						{
    							pPositionX := HexToFloat(Convert(ReadMemory(pReplication+0x30,PROGRAM),"H"))
    							pPositionY := HexToFloat(Convert(ReadMemory(pReplication+0x34,PROGRAM),"H"))
    							pPositionZ := HexToFloat(Convert(ReadMemory(pReplication+0x38,PROGRAM),"H"))
    							;pVelocityX := HexToFLoat(Convert(ReadMemory(pReplication+0x50,PROGRAM),"H"))
    							;pVelocityY := HexToFloat(Convert(ReadMemory(pReplication+0x54,PROGRAM),"H"))
    							;pVelocityZ := HexToFloat(Convert(ReadMemory(pReplication+0x58,PROGRAM),"H"))
    							PositionX := HexToFloat(Convert(ReadMemory(ClientReplication+0x30,PROGRAM),"H"))
    							PositionY := HexToFloat(Convert(ReadMemory(ClientReplication+0x34,PROGRAM),"H")) ;Heigth in map
    							PositionZ := HexToFloat(Convert(ReadMemory(ClientReplication+0x38,PROGRAM),"H"))
    						}
    					}
    				}
    			}
    			Yaw := HexToFloat(Convert(ReadMemory(ClientSoldier+0x4D8,PROGRAM),"H"))
    			angle := -Yaw
    			if Spotting = 1
    			{
    			if pPlayerTeamID != %ClientPlayerTeamID%
    				{
    				SpottingTargetComponentData := Convert(ReadMemory(pSoldier+0xBF0,PROGRAM,5),"H")
    				SpotType := ReadMemory(SpottingTargetComponentData+0x50,PROGRAM)
    				if (SpotType = 0 && ClientHealth > 0)
    					WriteMemory(0x1,SpottingTargetComponentData+0x50,PROGRAM)
    				}	
    			}
    			if PlayerRadar = 1
    			{	
    				IfNotEqual, pPlayerTeamID,  %ClientPlayerTeamID% ; if other team 
    				{
    					RColor = 0xFFFF0000
    				}
    			else
    				{
    				if ShowTeam = 1
    					RColor = 0xFF0000FF
    				Else
    					RColor = 0x00000000
    				}
    				if pHealth <= 1
    				{
    					RColor = 0x00000000
    				}
    				Distance:
    				xD := Round(PositionX - pPositionX)	
    				yD := Round(PositionY - pPositionY)
    				zD := Round(PositionZ - pPositionZ)
    				pDistance := Round(sqrt((xD * xD) + (yD * yD) + (zD * zD)))
    				ArrayCount++
    				RC%ArrayCount% := RColor
    				xD%ArrayCount% := pPositionX
    				yD%ArrayCount% := pPositionY
    				zD%ArrayCount% := pPositionZ
    				%ArrayCount% := pDistance 
    				Ry := positionZ - zD%ArrayCount%
    				Rx := PositionX - xD%ArrayCount%
    				if (pDistance < 150)
    				{
    					if (pDistance = 0)
    						continue
    					xR%ArrayCount% := (Rx*Cos(angle)-Ry*Sin(angle))+(PosCX+(Straal/2))
    					yR%ArrayCount% := (Rx*Sin(angle)+Ry*Cos(angle))+(PosCY+(Straal/2))
    					pBrush6 := Gdip_BrushCreateSolid(RC%ArrayCount%)
    					Gdip_FillRoundedRectangle(G3, pBrush6, xR%ArrayCount%, yR%ArrayCount% , 5, 5, 2.5)
    					Gdip_DeleteBrush(pBrush6)
    				}
    			} 
    	}	;End While Loop
    if PlayerRadar = 1
    {
    UpdateLayeredWindow(hwnd3, hdc3, 0, 0, Width3, Height3)
    SelectObject(hdc3, obm3)
    DeleteObject(hbm3)
    DeleteDC(hdc3)
    Gdip_DeleteGraphics(G3)
    }
    if PlayerRadar = 0
    {
    	Gui, 4: Destroy
    }
    ArrayCount = 0
    ide = 0
    return
    
    Base:
    IfWinActive,Battlefield 4
    {
        Base := getProcessBaseAddress(PROGRAM)
    	DeployScreen := ReadMemory(Base+0x21caee0+0x110,PROGRAM,5)
    	if DeployScreen = 0
    	{
    		Angles := ReadMemory(Base+0x21caee0,PROGRAM,5)
    		if Angles != -1
    		{
    			CFiring := ReadMemory(Angles+0x49c0,PROGRAM,5)
    			if CFiring != -1
    			{
    				CurrentWeaponName := ReadMemory(CFiring+0x01c8,PROGRAM,5)
    				if CurrentWeaponName != -1
    				{
    					CurrentWeaponName2 := ReadMemory(CurrentWeaponName+0x130,PROGRAM,5)
    					if CurrentWeaponName2 != -1
    					{				
    						CurrentWeaponName3 := ReadMemoryStr(CurrentWeaponName2+0x0,PROGRAM)	
    					}
    				}
    				PrimaryFire := 	ReadMemory(CFiring+0x0128,PROGRAM,5)
    				if PrimaryFire != -1
    				{
    					FiringFunctionData := ReadMemory(PrimaryFire+0x0010,PROGRAM,5)
    					if FiringFunctionData != -1
    					{
    						BulletEntityData := ReadMemory(FiringFunctionData+0x00B0,PROGRAM,5)
    					}
    				}
    				WeaponSway := ReadMemory(CFiring+0x0078,PROGRAM,5)
    				if WeaponSway != -1
    				{
    					WeaponSwayData := ReadMemory(WeaponSway+0x0008,PROGRAM,5)
    				}
    			}
    		}
    		GameContext := ReadMemory(Base+0x24abd20,PROGRAM,5)
    		if (GameContext != -1)
    		{
    			ClientPlayerManager := ReadMemory(GameContext+0x60,PROGRAM,5)
    			if (ClientPlayerManager != -1)
    			{
    				ClientPlayer := ReadMemory(ClientPlayerManager+0x540,PROGRAM,5)
    				if ClientPlayer != -1
    				{
    					InVehicle := ReadMemory(ClientPlayer+0x14c0,PROGRAM)
    					PlayerName := ReadMemoryStr(ClientPlayer+0x40,PROGRAM)
    					ClientPlayerTeamID := ReadMemory(ClientPlayer+0x13cc,PROGRAM)
    					ClientSoldier := ReadMemory(ClientPlayer+0x14d0,PROGRAM,5)
    					if ClientSoldier != -1
    					{
    						SoldierWeaponComponent := ReadMemory(ClientSoldier+0x570,PROGRAM,5)
    						if SoldierWeaponCompnent != -1
    						{
    							ActiveSlot := ReadMemory(SoldierWeaponComponent+0x0a98,PROGRAM) +2
    							Done :=  ActiveSlot = 2 OR ActiveSlot = 3 OR ActiveSlot = 11
    						}
    						ClientReplication := ReadMemory(ClientSoldier+0x490,PROGRAM,5)
    						breathControlHandler := ReadMemory(ClientSoldier+0x588,PROGRAM,5)
    						HealthComponent := ReadMemory(ClientSoldier+0x140,PROGRAM,5) 
    					}
    				}
    			}
    		}
    	}
    }
    return
    /*
    	;----------------LocelPlayer--------------------
    	;ClientPlayer := Convert(ReadMemory(ClientPlayerManager+0x540,PROGRAM),"H") 
    	;ClientSoldier := Convert(ReadMemory(ClientPlayer+0x14d0,PROGRAM),"H")
    	;ClientReplication := Convert(ReadMemory(ClientSoldier+0x490,PROGRAM),"H")
    	;SoldierWeaponsComponent := Convert(ReadMemory(ClientSoldier+0x570,PROGRAM),"H")
    	;breathControlHandler := Convert(ReadMemory(ClientSoldier+0x588,PROGRAM),"H")
    	;HealthComponent := Convert(ReadMemory(ClientSoldier+0x140,PROGRAM),"H")
    	;ClientHealth := Convert(ReadMemory(HealthComponent+0x20,PROGRAM),"H")
    	;PlayerName := ReadMemoryStr(ClientPlayer+0x40,PROGRAM)
    	;ClientPlayerTeamID := ReadMemory(ClientPlayer+0x13cc,PROGRAM)
    	;cActiveSlot := Convert(ReadMemory(SoldierWeaponComponent+0x0a98,PROGRAM),"H")
    	;Done :=  ActiveSlot = 2 OR ActiveSlot = 3 OR ActiveSlot = 11
    	;InVehicle := Convert(ReadMemory(ClientPlayer+0x14c0,PROGRAM),"H")
    	;CorrectedFiring := Convert(ReadMemory(Angles+0x49c0,PROGRAM),"H")
    	;CurrentWeaponName := Convert(ReadMemory(CorrectedFiring+0x01c8,PROGRAM),"H")
    	;PrimaryFire := 	Convert(ReadMemory(CorrectedFiring+0x0128,PROGRAM),"H")
    	;WeaponSway := Convert(ReadMemory(CorrectedFiring+0x0078,PROGRAM),"H")
    	WeaponSwayData := Convert(ReadMemory(WeaponSway+0x0008,PROGRAM),"H")
    	SpreadBase := Round(HexToFLoat(Convert(ReadMemory(WeaponSwayData+0x0430,PROGRAM),"H"))*100)
    	Recoil1 := Convert(ReadMemory(WeaponSwayData+0x0440,PROGRAM),"H")
    	Recoil2 := Convert(ReadMemory(WeaponSwayData+0x0444,PROGRAM),"H")
    	FiringFunctionData := Convert(ReadMemory(PrimaryFire+0x0010,PROGRAM),"H")
    	MuzzleVelo := HexToFloat(Convert(ReadMemory(FiringFunctionData+0x0088,PROGRAM),"H"))
    	BulletEntityData := Convert(ReadMemory(FiringFunctionData+0x00B0,PROGRAM),"H")
    	Gravity := HexToFloat(Convert(ReadMemory(BulletEntityData+0x0130,PROGRAM),"H"))
    	ClientROFAuto := HexToFloat(Convert(ReadMemory(FiringFunctionData+0x1c8,PROGRAM),"H"))
    	ClientROFBurst := HexToFloat(Convert(ReadMemory(FiringFunctionData+0x1cc,PROGRAM),"H"))
    	;CurrentWeaponName2 := Convert(ReadMemory(CurrentWeaponName+0x130,PROGRAM),"H")
    	;CurrentWeaponName3 := ReadMemoryStr(CurrentWeaponName2+0x0,PROGRAM)	
    	MuzzleVelocity := Convert(ReadMemory(FiringFunctionData+0x88,PROGRAM),"H")
    	ROFSettings := Convert(ReadMemory(FiringFunctionData+0x1c8,PROGRAM),"H")
    	SpreadBase := Convert(ReadMemory(WeaponSwayData+0x0430,PROGRAM),"H")
    */
    
    
    WriteMemory(WVALUE,MADDRESS,PROGRAM) 
    { 
    winget, pid, PID, %PROGRAM% 
    ProcessHandle := DllCall("OpenProcess", "int", 2035711, "char", 0, "UInt", PID, "UInt") 
    DllCall("WriteProcessMemory", "UInt", ProcessHandle, "UInt", MADDRESS, "Uint*", WVALUE, "Uint", 4, "Uint *", 0) 
    
    return 
    }
    
    HexToFloat(x) {
       Return (1-2*(x>>31)) * (2**((x>>23 & 255)-150)) * (0x800000 | x & 0x7FFFFF)
    }
    
    HexToDouble(x) { ; may be wrong at extreme values
       Return (2*(x>0)-1) * (2**((x>>52 & 0x7FF)-1075)) * (0x10000000000000 | x & 0xFFFFFFFFFFFFF)
    }
    
    FloatToHex(f) {
       form := A_FormatInteger
       SetFormat Integer, HEX
       v := DllCall("MulDiv", Float,f, Int,1, Int,1, UInt)
       SetFormat Integer, %form%
       Return v
    }
    
    DoubleToHex(d) {
       form := A_FormatInteger
       SetFormat Integer, HEX
       v := DllCall("ntdll.dll\RtlLargeIntegerShiftLeft",Double,d, UChar,0, Int64)
       SetFormat Integer, %form%
       Return v
    }
    
    ReadMemory(MADDRESS=0,PROGRAM="",BYTE=4,MVALUE=" ")
    {
    	Static OLDPROC, ProcessHandle
    	if MVALUE := " " 
    	VarSetCapacity(MVALUE,4,0)
    	If PROGRAM != %OLDPROC%
    	{
    		WinGet, pid, pid, % OLDPROC := PROGRAM
    		ProcessHandle := ( ProcessHandle ? 0*(closed:=DllCall("CloseHandle"
    		,"UInt",ProcessHandle)) : 0 )+(pid ? DllCall("OpenProcess"
    		,"Int",16,"Int",0,"UInt",pid) : 0)
    	}
    	If (ProcessHandle) && DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",MADDRESS,"str",MVALUE,"UInt",BYTE,"UInt *",0)
    	return *(&MVALUE+4)<<32 | *(&MVALUE+3)<<24 | *(&MVALUE+2)<<16 | *(&MVALUE+1)<<8 | *(&MVALUE)
    	return !ProcessHandle ? "Handle Closed: " closed : "-2"
    }
    
    getProcessBaseAddress(WindowTitle, windowMatchMode := "3")    ;WindowTitle can be anything ahk_exe ahk_class etc
    {
        if (windowMatchMode && A_TitleMatchMode != windowMatchMode)
        {
            mode := A_TitleMatchMode ; This is a string and will not contain the 0x prefix
            StringReplace, windowMatchMode, windowMatchMode, 0x ; remove hex prefix as SetTitleMatchMode will throw a run time error. This will occur if integer mode is set to hex and matchmode param is passed as an number not a string.
            SetTitleMatchMode, %windowMatchMode%    ;mode 3 is an exact match
        }
        WinGet, hWnd, ID, %WindowTitle%
        if mode
            SetTitleMatchMode, %mode%    ; In case executed in autoexec
        if !hWnd
            return ; return blank failed to find window
        return DllCall(A_PtrSize = 4     ; If DLL call fails, returned value will = 0
            ? "GetWindowLong"
            : "GetWindowLongPtr"
            , "Ptr", hWnd, "Int", -6, A_Is64bitOS ? "Int64" : "UInt")  
            ; For the returned value when the OS is 64 bit use Int64 to prevent negative overflow when AHK is 32 bit and target process is 64bit 
            ; however if the OS is 32 bit, must use UInt, otherwise the number will be huge (however it will still work as the lower 4 bytes are correct)      
            ; Note - it's the OS bitness which matters here, not the scripts/AHKs
    }   
    
    ReadMemoryStr(MADDRESS=0, PROGRAM = "", length = 0 , terminator = "")  ; "" = Null
    { 
        Static OLDPROC, ProcessHandle
    
        If (PROGRAM != OLDPROC || !ProcessHandle)
        {
            WinGet, pid, pid, % OLDPROC := PROGRAM
            ProcessHandle := ( ProcessHandle ? 0*(closed:=DllCall("CloseHandle"
            ,"UInt",ProcessHandle)) : 0 )+(pid ? DllCall("OpenProcess"
            ,"Int",16,"Int",0,"UInt",pid) : 0) ;PID is stored in value pid
        }
        ; length depends on the encoding too
        VarSetCapacity(Output, length ? length : 1, 0)
        If !length ; read until terminator found or something goes wrong/error
    	{
            Loop
            { 
                success := DllCall("ReadProcessMemory", "UInt", ProcessHandle, "UInt", MADDRESS++, "str", Output, "Uint", 1, "Uint *", 0) 
                if (ErrorLevel || !success || Output = terminator) 
                    break
                teststr .= Output 
    		} 
    	}		
    	Else ; will read X length
    	{
            DllCall("ReadProcessMemory", "UInt", ProcessHandle, "UInt", MADDRESS, "str", Output, "Uint", length, "Uint *", 0) 
            ;  Loop % length
            ;     teststr .= chr(NumGet(Output, A_Index-1, "Char"))      
            teststr := StrGet(&Output, length, "UTF-8")
    	}
    	return teststr  
    }
    
    ;H for Hex D for Dec
    Convert(Number=0, ConvertTo="") {
    	TmpNum := Number
    	Ok := False
    	If TmpNum Is Integer
    		Ok := True
    	Else If TmpNum Is Xdigit
    	{
    		Ok := True
    		TmpNum := "0x" TmpNum
    	} Else If (InStr(TmpNum, "0x"))
    		Ok := True
    	Else
    		Return -1
    	If (Ok)
    		If (ConvertTo = "D" ) {
    			SetFormat Integer, D
    			TmpNum += 0
    			SetFormat Integer, H
    			Return TmpNum
    		} Else If (ConvertTo = "H") {
    			SetFormat Integer, H
    			TmpNum += 0
    			SetFormat Integer, D
    			Return TmpNum
    		} Else
    			Return -2
    	Else
    		Return -3
    }
    
    SaveSettings:
    IniWrite,%NoSpread%,Settings.dfd,Settings,Spread
    IniWrite,%NoRecoil%,Settings.dfd,Settings,Recoil
    IniWrite,%Overlay%,Settings.dfd,Settings,Overlay
    IniWrite,%Breath%,Settings.dfd,Settings,Breath
    IniWrite,%Spotting%,Settings.dfd,Settings,Spotting
    IniWrite,%PlayerRadar%,Settings.dfd,Settings,PlayerRadar
    IniWrite,%ShowTeam%,Settings.dfd,Settings,ShowTeam
    IniWrite,%PosCX1%,Settings.dfd,Settings,PosCX1
    IniWrite,%PosCY1%,Settings.dfd,Settings,PosCY1
    iniWrite,%ROFAuto%,Settings.dfd,Settings,ROFAuto
    IniWrite,%Auto%,Settings.dfd,Settings,Auto
    IniWrite,%GravitySet%,Settings.dfd,Settings,Gravity
    iniWrite,%MuzzleVel%,Settings.dfd,Settings,MuzzleSet
    iniWrite,%MuzzleV%,Settings.dfd,Settings,MuzzleVelocity
    return
    im still getting the error

  4. #4
    emlor's Avatar
    Join Date
    Dec 2014
    Gender
    male
    Posts
    62
    Reputation
    10
    Thanks
    1,523
    Quote Originally Posted by iamSxlvatore View Post
    thank you so much!! +1

    - - - Updated - - -



    im still getting the error
    Do you have it with the GDI+ and are you in-game before launching?

    I was actually JUST using it to troll people with explosive tip arrows

    also are you running in windowedBorderless?
    Last edited by emlor; 01-10-2016 at 07:49 PM.

  5. #5
    iamSxlvatore's Avatar
    Join Date
    Jan 2016
    Gender
    male
    Posts
    8
    Reputation
    10
    Thanks
    0
    My Mood
    Sad
    Quote Originally Posted by emlor View Post
    Do you have it with the GDI+ and are you in-game before launching?

    I was actually JUST using it to troll people with explosive tip arrows

    also are you running in windowedBorderless?
    yes, i am doing all of the above.

Similar Threads

  1. Does any got the addies for no recoil and no reload ???
    By EDWINSEE in forum Combat Arms Hack Coding / Programming / Source Code
    Replies: 2
    Last Post: 07-20-2010, 04:51 PM
  2. is there a tutorial for ava for no recoil?
    By negative6 in forum Suggestions, Requests & General Help
    Replies: 0
    Last Post: 12-31-2009, 04:21 AM
  3. [Help] error for CSS
    By Justin12321 in forum CounterStrike (CS) 1.6 Hacks / Counter Strike: Source (CSS) Hacks
    Replies: 5
    Last Post: 10-12-2009, 03:32 PM
  4. Server error for free locked gun
    By iamsoawesome in forum Combat Arms Hacks & Cheats
    Replies: 3
    Last Post: 01-02-2009, 07:32 AM
  5. [HELP] VB6 error while no-recoile
    By SteeL in forum WarRock - International Hacks
    Replies: 19
    Last Post: 11-06-2007, 11:08 PM