MKKJ Posted May 22, 2016 Share Posted May 22, 2016 (edited) (zooms camera) While cleo scripting there are some things i've been wondered about. I want to ask since i either can't figure it out or prefer someone else confirm it. 1. What happen if actors/cars/spheres/markers/pickups left unreleased, and what happen to their variables? As far as i know it would stuff up memory, and if i overwrite their variable it's just difficult to destroy them since you no longer have the pointer. 2. How can i read player's weapon poor/gangster/skill? But not with comparing values from weapon.dat since it can be easily edited. 3. Related with previous question, how can i get player's weapon id from this list? Some things might be easier if i could get those ids instead. Edited September 3, 2016 by MKKJ Link to comment Share on other sites More sharing options...
Silent Posted May 22, 2016 Share Posted May 22, 2016 1. I doubt they'll cause lags and crashes but yeah, you could run out of space in pools if you left them unreleased. 2. Not sure if it works on CJ - it should though. 0A96: [email protected] = actor $PLAYER_ACTOR [email protected] += 0x72C0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0If I recall correctly, 0 is Poor, 1 is Gangster, 2 is Hitman. 3. GET_CURRENT_CHAR_WEAPON Link to comment Share on other sites More sharing options...
MKKJ Posted May 23, 2016 Author Share Posted May 23, 2016 2. Not working? It crashes my game... 3. How about poor and hitman animations? This opcode ignores them and only returns 'default' ids (0 - 46). I know some 'things' distinguish actor's weapon skill via id list above. Link to comment Share on other sites More sharing options...
Silent Posted May 23, 2016 Share Posted May 23, 2016 For 2. you need CLEO - not going to work without it. And yes, 3 only returns those IDs - you use the skill parameter from 2. to distinguish instead. Link to comment Share on other sites More sharing options...
Wesser Posted May 23, 2016 Share Posted May 23, 2016 (edited) If you are familiar with CLEO function calls, you can save all the time writing your own routine by making good use of this information: enum eWeaponSkill{ WEAPONSKILL_POOR, WEAPONSKILL_STD, WEAPONSKILL_PRO, WEAPONSKILL_COP};0x005E3B60 - eWeaponSkill __thiscall CPed::GetWeaponSkill(eWeaponType weaponType)0x005E6580 - eWeaponSkill __thiscall CPed::GetWeaponSkill(void)0x00743C60 - CWeaponInfo *__cdecl CWeaponInfo::GetWeaponInfo(eWeaponType weaponType, eWeaponSkill weaponSkill)0x00743CD0 - int __cdecl CWeapon::GetSkillStatIndex(eWeaponType weaponType)Retrieving the statistics index of a particular weapon is only useful to show how much you still have to get practice for the next level up. The game handles it internally to obtain the right weapon skill for players, whereas it just reads a CPed's member (+0x072C) for pedestrians which is always 3 for cops (or better yet anyone with COP pedtype set). Edited May 23, 2016 by Wesser Silent, The_GTA, fastman92 and 1 other 4 012 345 678 9A BCD EFG HIJK LMN OPQR STUV WX YZ Link to comment Share on other sites More sharing options...
MKKJ Posted May 23, 2016 Author Share Posted May 23, 2016 (edited) Awesome, Wesser. Though i totally have no slightest idea about functions, fortunately i found an example of how you did it from old post. 0A96: [email protected] = actor $PLAYER_ACTOR struct0470: [email protected] = actor $PLAYER_ACTOR current_weapon0AA8: call_function_method 0x5E6580 struct [email protected] num_params 0 pop 0 cSkillIndex [email protected]: call_function 0x743C60 num_params 2 pop 2 cSkillIndex 1[email protected] sWeaponType [email protected] pclWeaponInfo [email protected] I assume this address i found ([email protected]) is start of weapon entry from weapon.dat, yes? And it seems each entry is sorted the same way like ids list i wrote in first post. So it's easy to get these ids from here. Coincidentally, my actual intention is actually trying to obtain weapon damage from weapon.dat as well, which is like the way you did in the old post. 0A8E: [email protected] = [email protected] + 0x22 // Weapon Damage0A8D: [email protected] = read_memory [email protected] size 2 virtual_protect 1 So i pretty much found (more than) what i need. Much thanks, Wesser and Silent. Have some cookies Edited May 23, 2016 by MKKJ Link to comment Share on other sites More sharing options...
MKKJ Posted September 1, 2016 Author Share Posted September 1, 2016 (edited) [redacted] Edited September 3, 2016 by MKKJ Link to comment Share on other sites More sharing options...
phFC Posted May 22, 2017 Share Posted May 22, 2017 1. I doubt they'll cause lags and crashes but yeah, you could run out of space in pools if you left them unreleased. 2. Not sure if it works on CJ - it should though. 0A96: [email protected] = actor $PLAYER_ACTOR [email protected] += 0x72C0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0If I recall correctly, 0 is Poor, 1 is Gangster, 2 is Hitman. 3. GET_CURRENT_CHAR_WEAPON Could you tell me what memory address corresponds to the GTA3script weapon_accuracy information: SET_WEAPON_ACCURACY or the function that does not exist ... GET_WEAPON_ACCURACY) of the ped (not weapon_skill [0,1,2]). Based on this page ... Http://gtag.gtagaming.com/sanandreas/peds/ Corresponds to the same address you previously reported, but when trying to retrieve this value, I can only get the value 2 (int), regardless of the ped skill (already previously defined) Thanks! Link to comment Share on other sites More sharing options...
Jack Posted May 22, 2017 Share Posted May 22, 2017 0A96: [email protected] = actor [email protected] [email protected] += 0x71A0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0 case COMMAND_SET_CHAR_ACCURACY: CRunningScript::CollectParameters((CRunningScript *)this, 2); *(_BYTE *)(CPool<CPed>::atHandle((int)CPools::ms_pPedPool, *(_DWORD *)&ScriptParams) + offsetof(CPed, m_nWeaponAccuracy)) = *((_BYTE *)&ScriptParams + 4); return 0; results of CPed.m_nWeaponAccuracy:0x5E83EB mov [esi+71Ah], 3Ch ; CPed::CPed0x5D2E10 mov byte ptr [eax+71Ah], 64h ; CPlayerPed::CPlayerPed0x60D822 mov byte ptr [ecx+71Ah], 64h ; CPlayerPed::SetupPlayerPed 0x685A46 add cl, 64h0x685A49 mov [esi+71Ah], cl ; CTaskSimplePlayerOnFoot::ProcessPlayerWeapon 0x5DDCE6 mov byte ptr [esi+71Ah], 3Ch ; CCopPed::CCopPed0x5DDDC3 mov byte ptr [esi+71Ah], 44h ; CCopPed::CCopPed0x5DDE03 mov byte ptr [esi+71Ah], 4Ch ; CCopPed::CCopPed0x5DDE43 mov byte ptr [esi+71Ah], 54h ; CCopPed::CCopPedLast 4 discovered by DexX back in 2006 (page 16). Also documented in the database.I don't know about the rest of them. phFC 1 Wanted Level Editor End Phone Call in Vice City My YouTube Channel Link to comment Share on other sites More sharing options...
phFC Posted May 22, 2017 Share Posted May 22, 2017 0A96: [email protected] = actor [email protected] [email protected] += 0x71A0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0 case COMMAND_SET_CHAR_ACCURACY: CRunningScript::CollectParameters((CRunningScript *)this, 2); *(_BYTE *)(CPool<CPed>::atHandle((int)CPools::ms_pPedPool, *(_DWORD *)&ScriptParams) + offsetof(CPed, m_nWeaponAccuracy)) = *((_BYTE *)&ScriptParams + 4); return 0; results of CPed.m_nWeaponAccuracy: 0x5E83EB mov [esi+71Ah], 3Ch ; CPed::CPed0x5D2E10 mov byte ptr [eax+71Ah], 64h ; CPlayerPed::CPlayerPed0x60D822 mov byte ptr [ecx+71Ah], 64h ; CPlayerPed::SetupPlayerPed 0x685A46 add cl, 64h0x685A49 mov [esi+71Ah], cl ; CTaskSimplePlayerOnFoot::ProcessPlayerWeapon 0x5DDCE6 mov byte ptr [esi+71Ah], 3Ch ; CCopPed::CCopPed0x5DDDC3 mov byte ptr [esi+71Ah], 44h ; CCopPed::CCopPed0x5DDE03 mov byte ptr [esi+71Ah], 4Ch ; CCopPed::CCopPed0x5DDE43 mov byte ptr [esi+71Ah], 54h ; CCopPed::CCopPedLast 4 discovered by DexX back in 2006 (page 16). Also documented in the database.I don't know about the rest of them. Thank you very much Jack, that's exactly what I need, just this simple address (0x71A) that I could not find in any post or website. I tested it here and it's functional! Again, thank you very much. See you... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now