Quantcast

Jump to content

» «
Photo

CPed and CWanted

8 replies to this topic
Jack
  • Jack

    firearms and adrenaline

  • Feroci
  • Joined: 06 Dec 2011
  • Colombia

#1

Posted 23 July 2014 - 12:20 PM Edited by Jack..., 23 July 2014 - 12:21 PM.

Here's what I know:

gtaIII    CPed+0x53C=CWanted
gta VC    CPed+0x5F4=CWanted

And I need this offset for SA:

gta SA    CPed+0x???=CWanted

Is it possible to calculate the offset if we have CPed and CWanted?

Why do I need this? - There is no opcode for CWanted but for CPed we can use 0A96:

Thanks.


Silent
  • Silent

    Moderating Cookie Monster

  • Modding Staff
  • Joined: 01 Feb 2010
  • Poland
  • Contribution Award [Mods]
    Best Script/Plugin 2014 [SilentPatch]
    Most Respected 2014
    Most Helpful [Mods] 2014
    Most Helpful [GTA] 2013
    Most Helpful [Mods] 2013
    Most Talented [Modding] 2013
    Best Map 2013 [ViceCityStories PC Edition]
    Best Vehicle 2013 [III Aircraft]
    Most Helpful [Mods] 2012
    Modder of the Year 2012

#2

Posted 23 July 2014 - 12:56 PM Edited by Silent, 23 July 2014 - 12:57 PM.

afaik there's no CWanted pointer in SA CPed, but when the subclass is CPlayerPed, it stores a CPlayerPedData pointer which has CWanted. In other words, check if CPed+0x480 is nonzero, and if it's not, get a pointer to CWanted from the memory which is pointed to by CPed+0x480 (CWanted is stored at CPlayerPedData+0).

SCMy, it'd be

0A96: 0@ = actor $PLAYER_ACTOR struct
0@ += 0x480
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
if not 0@ == 0
then
    0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
end
  • Jack likes this

Jack
  • Jack

    firearms and adrenaline

  • Feroci
  • Joined: 06 Dec 2011
  • Colombia

#3

Posted 23 July 2014 - 01:03 PM Edited by Jack..., 23 July 2014 - 01:04 PM.

It works :lol:. There're 2 offsets. Thank you SPL.

 

One question. Where did you find that 480 offset?


Silent
  • Silent

    Moderating Cookie Monster

  • Modding Staff
  • Joined: 01 Feb 2010
  • Poland
  • Contribution Award [Mods]
    Best Script/Plugin 2014 [SilentPatch]
    Most Respected 2014
    Most Helpful [Mods] 2014
    Most Helpful [GTA] 2013
    Most Helpful [Mods] 2013
    Most Talented [Modding] 2013
    Best Map 2013 [ViceCityStories PC Edition]
    Best Vehicle 2013 [III Aircraft]
    Most Helpful [Mods] 2012
    Modder of the Year 2012

#4

Posted 23 July 2014 - 01:05 PM

It's been in the public IDBs since ages.

Jack
  • Jack

    firearms and adrenaline

  • Feroci
  • Joined: 06 Dec 2011
  • Colombia

#5

Posted 23 July 2014 - 01:07 PM

It's been in the public IDBs since ages.

You mean in III other section for mem add?


DK22Pac
  • DK22Pac

  • Feroci
  • Joined: 12 Apr 2009
  • Ukraine
  • Best WIP Mod 2014 [Grand Theft Auto 3D Contribution]
    Contribution Award [Mods]

#6

Posted 23 July 2014 - 01:30 PM

0000 physical        CPhysical ?
0138 m_pedAudio      CAEPedAudioEntity ?
0294 m_pedSpeech     CAEPedSpeechAudioEntity ?
0394 m_weaponAudio   CAEPedWeaponAudioEntity ?
043C field_43C       db 36 dup(?)
0460 field_460       db 8 dup(?)
0468 field_468       dd ?
046C m_dwPedFlags    dd 4 dup(?)
047C m_pIntelligence dd ?                    ; CPedIntelligence *
0480 m_pPlayerData   dd ?                    ; CPlayerData *
0484 m_nCreatedBy    db ?                    ; 1 - game, 2 - script, 3 - ?
0485 _pad0           db 3 dup(?)
0488 m_apPedBones    dd 19 dup(?)            ; AnimBlendFrameData *
04D4 m_dwAnimGroup   dd ?
04D8 m_vAnimMovingShiftLocal CVector2D ?
04E0 m_acquaintance  CPedAcquaintance ?
04F4 m_pWeaponObject dd ?                    ; RpAtomic *
04F8 m_pGunflashObject dd ?                  ; RpAtomic *
04FC m_pGogglesObject dd ?                   ; RpAtomic *
0500 m_pGogglesState dd ?                    ; unsigned char *
0504 weaponGunflashAlphaMP1 dw ?
0506 field_506       dw ?
0508 weaponGunflashAlphaMP2 dw ?
050A field_50A       dw ?
050C m_pedIK         CPedIK ?
052C field_52C       dd ?
0530 m_dwPedState    dd ?                    ; enum ePedState
0534 m_dwMoveState   dd ?
0538 field_538       dd ?
053C field_53C       dd ?
0540 m_fHealth       dd ?
0544 m_fMaxHealth    dd ?
0548 m_fArmour       dd ?
054C m_dwTimeTillWeNeedThisPed dd ?
0550 m_vAnimMovingShift CVector2D ?
0558 m_fCurrentRotation dd ?
055C m_fAimingRotation dd ?
0560 m_fHeadingChangeRate dd ?
0564 m_dwMoveAnim    dd ?                    ; 1 - on foot, 4 - starting to move, 6 - walking/running, 7 - sprinting
0568 field_568       dd ?
056C field_56C       RwV3D ?
0578 field_578       RwV3D ?
0584 m_pContactEntity dd ?                   ; CEntity *
0588 m_pLastVehicle  dd ?                    ; CVehicle *
058C m_pVehicle      dd ?                    ; CVehicle *
0590 field_590       dd ?
0594 field_594       dd ?
0598 m_nPedType      dd ?                    ; ePedType
059C m_pStats        dd ?                    ; CPedStat *
05A0 m_aWeapons      CWeapon 13 dup(?)
070C m_nSavedWeapon  dd ?                    ; when we need to hide ped weapon, we save it temporary here
0710 m_nDelayedWeapon dd ?                   ; 'delayed' weapon is like an additional weapon, f.e., simple cop has a nitestick as current and pistol as delayed weapons
0714 m_dwDelayedWeaponAmmo dd ?
0718 m_nActiveWeaponSlot db ?
0719 m_nWeaponShootingRate db ?
071A m_nWeaponAccuracy db ?
071B _pad            db ?
071C m_pTargetedObject dd ?                  ; CObject *
0720 field_720       dd ?
0724 field_724       dd ?
0728 field_728       dd ?
072C m_nWeaponSkill  db ?
072D m_nFightingStyle db ?
072E m_nAllowedAttackMoves db ?
072F field_72F       db ?
0730 m_pFire         dd ?                    ; CFire *
0734 field_734       dd ?
0738 m_pLookAtEntity dd ?                    ; offset
073C m_fLookHeading  dd ?
0740 m_dwWeaponModelId dd ?
0744 field_744       dd ?
0748 m_dwLookTime    dd ?
074C field_74C       dd ?
0750 m_dwTimeWhenDead dd ?                   ; this is used for making blood foot prints
0754 m_nBodypartToRemove db ?
0755 field_755       db ?
0756 m_wMoneyCount   dw ?
0758 field_758       dd ?
075C field_75C       dd ?
0760 m_nLastWeaponDamage db ?                ; eWeaponType
0761 field_761       db 3 dup(?)
0764 m_pLastEntityDamaged dd ?               ; CPed *
0768 field_768       dd ?
076C m_vTurretOffset CVector ?
0778 m_fTurretAngleA dd ?
077C m_fTurretAngleB dd ?
0780 m_dwTurretPosnMode dd ?
0784 m_dwTurretAmmo  dd ?
0788 m_pCoverPoint   dd ?                    ; CCoverPoint *, related to CTaskComplexKillPedOnFootArmed
078C m_pEnex         dd ?                    ; CEnEx *
0790 m_fRemovalDistMultiplier dd ?           ; float
0794 m_wSpecialModelIndex dw ?
0796 field_796       db 2 dup(?)
0798 field_798       dd ?
  • Jack likes this

Jack
  • Jack

    firearms and adrenaline

  • Feroci
  • Joined: 06 Dec 2011
  • Colombia

#7

Posted 23 July 2014 - 02:00 PM

Is there a CPedWeaponAccuracy offset? Direct value change cause the crash on US (not the case with EU):

0x5E83F1    // 60 default

DK22Pac
  • DK22Pac

  • Feroci
  • Joined: 12 Apr 2009
  • Ukraine
  • Best WIP Mod 2014 [Grand Theft Auto 3D Contribution]
    Contribution Award [Mods]

#8

Posted 23 July 2014 - 02:07 PM

Did you set virtual_protect to 1?

Jack
  • Jack

    firearms and adrenaline

  • Feroci
  • Joined: 06 Dec 2011
  • Colombia

#9

Posted 23 July 2014 - 02:10 PM Edited by Jack..., 23 July 2014 - 02:19 PM.

Yes. Also tried with CE editing - same thing happened.

 

EDIT: CCopPedWeaponAccuracy works fine on both - no crash.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users