aStiffSausage Posted June 28, 2013 Share Posted June 28, 2013 (edited) So, as most of you know, you can read current ammo in clip with this little snippet: 0A96: [email protected] = actor $PLAYER_ACTOR struct [email protected] += 0x718 // Current Weapon Slot0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0 0A96: [email protected] = actor $PLAYER_ACTOR struct [email protected] += 0x5A0 // Start of weapon data (28 bytes)[email protected] *= 28 005A: [email protected] += [email protected] // Get weapon [email protected] += 8 // Pointer to "Ammo in clip"0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0 // Ammo in clip But, what about getting the maximum ammo in clip? EDIT: Oh, and how I can disable automatic reload when there is no ammo in clip? Edited June 28, 2013 by oksa8 Link to comment Share on other sites More sharing options...
Yezz007 Posted June 29, 2013 Share Posted June 29, 2013 You can set the player idle when the player is reloading, so no reload animation. 05B9: AS_actor $PLAYER_ACTOR stay_idle 1 ms If the weapon ammo is reloaded by itself, you can write to the memories right? The current ammo in clip and the current ammo remaining. idk if it can works. Link to comment Share on other sites More sharing options...
aStiffSausage Posted June 29, 2013 Author Share Posted June 29, 2013 I tried few things, like checking when ammo in clip is zero, then waiting until weapon state is set to 2 (reloading), and then writing it to 0. It almost worked, player did the reload-animation but the ammo in clip stayed at 0, but as soon as you fire, the clip ammo goes to maximum. Link to comment Share on other sites More sharing options...
Wesser Posted June 29, 2013 Share Posted June 29, 2013 Take this snippet to get the maximum ammo in clip: {$CLEO}const FIRETYPE_MELEE = 0 FIRETYPE_INSTANT_HIT = 1 FIRETYPE_PROJECTILE = 2 FIRETYPE_AREA_EFFECT = 3 FIRETYPE_CAMERA = 4 FIRETYPE_USE = 5end0000: NOPwhile true wait 0 0470: [email protected] = actor $PLAYER_ACTOR current_weapon 0A96: [email protected] = actor $PLAYER_ACTOR struct 0AA8: call_function_method 0x5E6580 struct [email protected] num_params 0 pop 0 cSkillIndex [email protected] // CPed__getWeaponSkillIndex 0AA7: call_function 0x743C60 num_params 2 pop 2 cSkillIndex [email protected] sWeaponType [email protected] pclWeaponInfo [email protected] // getWeaponInfo //[email protected] += 0x00 // CWeaponInfo.m_eFireType 0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 if [email protected] == FIRETYPE_INSTANT_HIT then [email protected] += 0x20 // CWeaponInfo.m_sMaxClipAmmo 0A8D: [email protected] = read_memory [email protected] size 2 virtual_protect 0 // [email protected] will contain the maximum ammo in clip. endend As regards disabling the automatic reload, I have to check. 012 345 678 9A BCD EFG HIJK LMN OPQR STUV WX YZ Link to comment Share on other sites More sharing options...
aStiffSausage Posted June 29, 2013 Author Share Posted June 29, 2013 Thank you, it works like a charm! And well, just a question about disabling the automatic reload, is it basically just disabling the function that calls reload when ammo in clip is zero? Link to comment Share on other sites More sharing options...
HeresOtis Posted June 29, 2013 Share Posted June 29, 2013 You can try the same method you but use -------> 0792: disembark_instantly_actor $PLAYER_ACTOR Link to comment Share on other sites More sharing options...
Wesser Posted June 29, 2013 Share Posted June 29, 2013 (edited) Okey, after few hours I drew up a proper reload script which is seemingly what are you asking for: {$CLEO}const FIRETYPE_MELEE = 0 FIRETYPE_INSTANT_HIT = 1 FIRETYPE_PROJECTILE = 2 FIRETYPE_AREA_EFFECT = 3 FIRETYPE_CAMERA = 4 FIRETYPE_USE = 5endconst FIRESTATE_IDLE = 0 FIRESTATE_FIRE = 1 FIRESTATE_RELOAD = 2 // There are probably more.endvar [email protected]: Integer [email protected]: Integerend0000: [email protected] = [email protected] = 0// Disable automatic reload when scrolling weapons.0A8C: write_memory 0x0060B4DA size 4 value 0xEB08C483 virtual_protect 10A8C: write_memory 0x0060B4DE size 1 value 0x21 virtual_protect 1while true wait 0 0A96: [email protected] = actor $PLAYER_ACTOR struct 0AA8: call_function_method 0x5E6580 struct [email protected] num_params 0 pop 0 cSkillIndex [email protected] // CPed__getWeaponSkillIndex 0470: [email protected] = actor $PLAYER_ACTOR current_weapon 0AA7: call_function 0x743C60 num_params 2 pop 2 cSkillIndex [email protected] sWeaponType [email protected] pclWeaponInfo [email protected] // getWeaponInfo 0A8E: [email protected] = [email protected] + 0x00 // CWeaponInfo.m_eFireType 0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 if [email protected] == FIRETYPE_INSTANT_HIT then 0A8E: [email protected] = [email protected] + 0x0718 // CPed.m_cWeaponSlot 0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0 [email protected] *= 0x1C // sizeof(CWeaponSlot) 0A8E: [email protected] = [email protected] + 0x5A0 // CPed.m_aclWeaponSlots 005A: [email protected] += [email protected] 0A8E: [email protected] = [email protected] + 0x04 // CWeaponSlot.m_iFireState 0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 if and [email protected] == true not [email protected] == FIRESTATE_RELOAD then // Disable automatic reload when the weapon clip is empty. 0A8C: write_memory 0x006860D2 size 2 value 0xE990 virtual_protect 1 0A8C: write_memory 0x0060F1F5 size 2 value 0x15EB virtual_protect 1 0992: set_player $PLAYER_CHAR weapons_scrollable 1 [email protected] = false end 0A8E: [email protected] = [email protected] + 0x20 // CWeaponInfo.m_sMaxClipAmmo 0A8D: [email protected] = read_memory [email protected] size 2 virtual_protect 0 0A8E: [email protected] = [email protected] + 0x08 // CWeaponSlot.m_sClipAmmo 0A8D: [email protected] = read_memory [email protected] size 2 virtual_protect 0 if or [email protected] > [email protected] [email protected] == 0 then if and [email protected] == false [email protected] > 250 0AB0: key_pressed 0x52 // R then if not [email protected] == FIRESTATE_RELOAD then 0A8C: write_memory [email protected] size 4 value FIRESTATE_RELOAD virtual_protect 0 end 01BD: [email protected] = current_time_in_ms 0AA8: call_function_method 0x743D70 struct [email protected] num_params 0 pop 0 iTime [email protected] // CWeaponInfo__getReloadTime 005A: [email protected] += [email protected] 0A8E: [email protected] = [email protected] + 0x10 // CWeaponSlot.m_iLastBulletTime 0A8C: write_memory [email protected] size 4 value [email protected] virtual_protect 0 // Enable automatic reload when the weapon clip is empty. 0A8C: write_memory 0x006860D2 size 2 value 0x840F virtual_protect 1 0A8C: write_memory 0x0060F1F5 size 2 value 0xBE0F virtual_protect 1 0992: set_player $PLAYER_CHAR weapons_scrollable 0 [email protected] = true [email protected] = 0 end end endend There might be a better way to achieve the same thing but not that much sophisticated than the current script. //Edit: script updated. Edited July 13, 2013 by Wesser 012 345 678 9A BCD EFG HIJK LMN OPQR STUV WX YZ Link to comment Share on other sites More sharing options...
aStiffSausage Posted June 29, 2013 Author Share Posted June 29, 2013 Heh, will probably take a while to get full knowledge on what everything does in your script, but anyways, thanks a lot! If I could, I'd kiss 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