CLEO Help Rustler/Hunter NoSpread Bullet

CLEO related
Status
Not open for further replies.

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
268
Location
Pluto
Hi all, I Know how to adjust the spread value of Player Actor weapons using weapon.dat pointers with this links:
http://ugbase.eu/index.php?threads/bullet-gravity-and-velocity.21608/#post-126605
http://gtamodding.ru/wiki/Адреса_Памяти_(SA)
http://hotmist.ddo.jp/struct.html

But I was wondering how to make bullet armed vehicles like Rustler and Hunter to not spread its bullets when firing. This flying vehicles autoaims on targets, but like normal guns, the bullet does spread on its autoaimed target which sucks. That's why I want to make its bullets not spread.

I have researched about this bullet types:
  • Rustler Bullet = M4 Bullet
  • Hunter Bullet = Minigun Bullet
I tried to change the value of accuracy pointers into 1000.0(nospread):
  • M4
    • C8B880 = 0x70(31 + 0) + 0xC8AAB8 + 0x38 <---------- for std
    • C8C370 = 0x70(31 + 25) + 0xC8AAB8 + 0x38 <---------- for poor
    • C8C840 = 0x70(31 + 36) + 0xC8AAB8 + 0x38 <---------- for pro
  • Minigun
    • C8BB90 = 0x70(38 + 0) + 0xC8AAB8 + 0x38 <---------- for std
    • C8C680 = 0x70(38 + 25) + 0xC8AAB8 + 0x38 <---------- for poor
    • C8CB50 = 0x70(38 + 36) + 0xC8AAB8 + 0x38 <---------- for pro
But it only changes the Actor carried M4 and Minigun weapon, rustler and hunter bullet still spreads.

Does anybody know how to make both rustler and hunter bullet to not spread? It will be really helpful even if it is just a memory address/demonstration/working script. Thank you!
 
Last edited:

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
268
Location
Pluto
Hi all, I Know how to adjust the spread value of Player Actor weapons using weapon.dat pointers with this links:
http://ugbase.eu/index.php?threads/bullet-gravity-and-velocity.21608/#post-126605
http://gtamodding.ru/wiki/Адреса_Памяти_(SA)
http://hotmist.ddo.jp/struct.html

But I was wondering how to make bullet armed vehicles like Rustler and Hunter to not spread its bullets when firing. This flying vehicles autoaims on targets, but like normal guns, the bullet does spread on its autoaimed target which sucks. That's why I want to make its bullets not spread.

I have researched about this bullet types:
  • Rustler Bullet = M4 Bullet
  • Hunter Bullet = Minigun Bullet
I tried to change the value of accuracy pointers into 1000.0(nospread):
  • M4
    • C8B880 = 0x70(31 + 0) + 0xC8AAB8 + 0x38 <---------- for std
    • C8C370 = 0x70(31 + 25) + 0xC8AAB8 + 0x38 <---------- for poor
    • C8C840 = 0x70(31 + 36) + 0xC8AAB8 + 0x38 <---------- for pro
  • Minigun
    • C8BB90 = 0x70(38 + 0) + 0xC8AAB8 + 0x38 <---------- for std
    • C8C680 = 0x70(38 + 25) + 0xC8AAB8 + 0x38 <---------- for poor
    • C8CB50 = 0x70(38 + 36) + 0xC8AAB8 + 0x38 <---------- for pro
But it only changes the Actor carried M4 and Minigun weapon, rustler and hunter bullet still spreads.

Does anybody know how to make both rustler and hunter bullet to not spread? It will be really helpful even if it is just a memory address/demonstration/working script. Thank you!

Edited. Readers please recheck

Do you have test server ?
I use these two test servers:
37.252.189.76:7778
samp.ugbase.eu:7777

Even on these servers, the rustler and hunter bullets still spreads. If you would like to take a look on what I have done so far:
Code:
{$CLEO .cs}
0000: No Spread All Actor and Vehicle Weapons by ajom

jump @defaultactivate

:Activate
0001: wait 0 ms
00D6: if
0ADC:   test_cheat "SPREAD"
004D: jump_if_false @Activate
:defaultactivate
for 0@ = 22 to 38
    0AB1: @PatchWeaponValue 5 {Weapon Number} 0@ {Offset} 0x38 {STD Value} 1000.0 {POOR Value} 1000.0 {PRO Value} 1000.0 {Return Old Value} {std} 1@ {poor} 2@ {pro} 3@

    0AD3: 4@s = format "a%d" 0@ // occupies 4@ and 5@
    0AF3: write_float 1@ to_ini_file "cleo\backupdata.ini" section "Accuracy" key 4@s

    0AD3: 4@s = format "b%d" 0@ // occupies 4@ and 5@
    0AF3: write_float 2@ to_ini_file "cleo\backupdata.ini" section "Accuracy" key 4@s

    0AD3: 4@s = format "c%d" 0@ // occupies 4@ and 5@
    0AF3: write_float 3@ to_ini_file "cleo\backupdata.ini" section "Accuracy" key 4@s
end
0ACD: show_text_highpriority "No Spread: ~g~ON~n~~w~by ~y~ajom" time 1000

// Deactivation Stage
:Deactivate
0001: wait 0 ms
00D6: if
0ADC:   test_cheat "SPREAD"
004D: jump_if_false @Deactivate
for 0@ = 22 to 38
    0AD3: 4@s = format "a%d" 0@ // occupies 4@ and 5@
    0AF2: 1@ = get_float_from_ini_file "cleo\backupdata.ini" section "Accuracy" key 4@s

    0AD3: 4@s = format "b%d" 0@ // occupies 4@ and 5@
    0AF2: 2@ = get_float_from_ini_file "cleo\backupdata.ini" section "Accuracy" key 4@s

    0AD3: 4@s = format "c%d" 0@ // occupies 4@ and 5@
    0AF2: 3@ = get_float_from_ini_file "cleo\backupdata.ini" section "Accuracy" key 4@s

    0AB1: @PatchWeaponValue 5 {Weapon Number} 0@ {Offset} 0x38 {STD Value} 1@ {POOR Value} 2@ {PRO Value} 3@ {Return Old Value} {std} 1@ {poor} 2@ {pro} 3@
end
0ACD: show_text_highpriority "No Spread: ~r~OFF~n~~w~by ~y~ajom" time 1000

0002: jump @Activate

// 0AB1: @PatchWeaponValue 5 {Weapon Number} 0@ {Offset} 0x38 {STD Value} 1000.0 {POOR Value} 1000.0 {PRO Value} 1000.0 {Return Old Value} {std} 1@ {poor} 1@ {pro} 1@
// 0AB1: @PatchWeaponValue 5 {Weapon Number} 0@ {Offset} 0x68 {STD Value} 0.0 {POOR Value} 0.0 {PRO Value} 0.0 {Return Old Value} {std} 1@ {poor} 1@ {pro} 1@
:PatchWeaponValue
    // weapon.dat current weapon element block offset
    0085: 31@ = 0@
    31@ += 0 // std = 0 , poor = 25 , pro = 36
    31@ *= 0x70 // block size of each element
    31@ += 0xC8AAB8 // weapon.dat base pointer
    //
    005A: 31@ += 1@ // 0x38 = accuracy // 0x68 = weapon spread
    0A8D: 30@ = read_memory 31@ size 4 virtual_protect 0
    0AD1: show_formatted_text_highpriority "Mode: %d STD~n~Weapon: %d~n~Value: %f" time 2000 1@ 0@ 30@
    0A8C: write_memory 31@ size 4 value 2@ virtual_protect 1
    
    // weapon.dat current weapon element block offset
    0085: 31@ = 0@
    31@ += 25 // std = 0 , poor = 25 , pro = 36
    31@ *= 0x70
    31@ += 0xC8AAB8
    //
    005A: 31@ += 1@ // 0x38 = accuracy // 0x68 = weapon spread
    0A8D: 29@ = read_memory 31@ size 4 virtual_protect 0
    0AD1: show_formatted_text_highpriority "Mode: %d STD~n~Weapon: %d~n~Value: %f" time 2000 1@ 0@ 29@
    0A8C: write_memory 31@ size 4 value 3@ virtual_protect 1
    
    // weapon.dat current weapon element block offset
    0085: 31@ = 0@
    31@ += 36 // std = 0 , poor = 25 , pro = 36
    31@ *= 0x70
    31@ += 0xC8AAB8
    //
    005A: 31@ += 1@ // 0x38 = accuracy // 0x68 = weapon spread
    0A8D: 28@ = read_memory 31@ size 4 virtual_protect 0
    0AD1: show_formatted_text_highpriority "Mode: %d STD~n~Weapon: %d~n~Value: %f" time 2000 1@ 0@ 28@
    0A8C: write_memory 31@ size 4 value 4@ virtual_protect 1
    
ret 3 30@ 29@ 28@

The Goal of the above code is to make the bullet of all Actor Weapons and Vehicle Weapons not spread when fired continuously. But the current result of this script has a problem on both rustler and hunter bullets, it spreads. I think I am missing some address for vehicle bullets. I can't find any documentary in the internet regarding "vehicle weapon stats".
 

Trou

Member
Joined
Sep 3, 2018
Messages
21
Reaction score
4
I Think You Can't Change It. Because Vehicle Weapons Sync In Game. After Change Too Will Be Only Sync For You
 

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
268
Location
Pluto
I Think You Can't Change It. Because Vehicle Weapons Sync In Game. After Change Too Will Be Only Sync For You

I think both actor and vehicle bullet works the same thing, as a certain bullet was fired, a bullet data sync was made. If you have a NoSpread MOD, that MOD just changes the weapon.dat accuracy of actor weapons, but has no problems when it comes to syncing aim data and bullet data. So changing the spread/accuracy value of vehicle weapons will do the same trick as that.

I just don't know what are the memory address to change the rustler/hunter firing accuracy.

How you get weapon on vehicle?
I never used something like that.
I tried inspecting RAKNET Outcoming Packet + RPC, it seems that SAMPFUNCS cannot intercept the bullet of rustler and hunter. Everytime I fire a bullet, there is no "PACKET_BULLET_SYNC" or even "RPC_GIVETAKEDAMAGE" Data detected to be delivered.
 

Trou

Member
Joined
Sep 3, 2018
Messages
21
Reaction score
4
You Are Not Sending Bullet Data When Shooting In Vehicle. Its About Key Sync You Can Try It Like That When Someone Shooting Hunter Disable Incoming Vehicle Sync From Her Except Key Data He Will Keep Shotting Last Position To Same Direction On Your Screen
 

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
268
Location
Pluto
You Are Not Sending Bullet Data When Shooting In Vehicle. Its About Key Sync You Can Try It Like That When Someone Shooting Hunter Disable Incoming Vehicle Sync From Her Except Key Data He Will Keep Shotting Last Position To Same Direction On Your Screen

Can you give me the struct of key data sync?

I don't quite understand how the bullet will hit/damage the targets using key data sync. If it is just shooting but the bullet still spreads around the target, then the idea does not fix the bullet spread logic for vehicles.
 

Trou

Member
Joined
Sep 3, 2018
Messages
21
Reaction score
4
Code:
struct VehicleSyncData

uint16_t keysData;
..
..
}

If You Set Keys Data In Incoming Vehicle Data keysData |= (0 << 4) When Other Players Shooting In Vehicle Its Not Will Sync For You When You Just Disable Key Data LMB/CTRL
 

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
268
Location
Pluto
Code:
struct VehicleSyncData

uint16_t keysData;
..
..
}

If You Set Keys Data In Incoming Vehicle Data keysData |= (0 << 4) When Other Players Shooting In Vehicle Its Not Will Sync For You When You Just Disable Key Data LMB/CTRL

Ok, I get your Point. Keysdata is what makes your vehicle shoot on other player's screen. But I still want to try to make rustler/hunter bullet to not spread, I want to test what will happen if rustler bullets have 100% accuracy and hits targets without miss when autolocked...
 

Trou

Member
Joined
Sep 3, 2018
Messages
21
Reaction score
4
You Need Find Memory Adress But After You Change Memory For No Spread Its Sync Only Your Side When You Or Any Player Shooting In Hunter/Rustler Your Bullets Will Spread On Others Screen
 

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
268
Location
Pluto
You Need Find Memory Adress But After You Change Memory For No Spread Its Sync Only Your Side When You Or Any Player Shooting In Hunter/Rustler Your Bullets Will Spread On Others Screen
Yes I kept that in mind, that is why I am asking for help to find the memory address from the beginning. I am having a hard time finding it, maybe you or somebody can help me point out the proper memory addresses.
 

Parazitas

God
Joined
Jan 2, 2017
Messages
3,116
Solutions
5
Reaction score
882
Location
Lithuania
You can get current weapon id , but i can't see anything about spread.
PHP:
{$CLEO .cs}
{$INCLUDE SF}

0000:

REPEAT
    WAIT 0
UNTIL 0AFA:  SAMP_IS_READY

0BE2: setup_outcoming_packet_hook @Hooks

WHILE TRUE
    WAIT 0

IF 0AB1: @IsActorInDriverSeat 0
THEN
    IF
    0ADC:   test_cheat "M"
    THEN
        IF
        28@ == FALSE
        THEN
            28@ = TRUE
            0AD1: "ON" 1337 
        ELSE
            28@ = FALSE
            0AD1: "OFF" 1337 
        END    
    END
END

END

:IsActorInDriverSeat
{
    USE WITH >> IF STATEMENT:
    0AB1: @IsActorInDriverSeat 0
}
if
00DF:   actor $PLAYER_ACTOR in_car
then
    03C0: 0@ = actor $PLAYER_ACTOR car
    046C: 1@ = car 0@ driver
    if
    003B: 1@ == $PLAYER_ACTOR
    then
        0485:  return_true
    else
        059A:  return_false
    end
end
0AB2: ret 0

:Hooks
0BE5: raknet 31@ = get_hook_param PARAM_PACKETID

IF 28@ == TRUE
THEN  
    IF 31@ == PACKET_VEHICLE_SYNC
    THEN
        0BE5: 30@ = get_hook_param PARAM_BITSTREAM
        0AC8: 29@ = allocate_memory_size 64
        0BE8: bit_stream 30@ read_array 29@ size 64
        
        // uint8_t byteCurrentWeapon; + 54
        0C0C: 26@ = struct 29@ offset 55 size 1  
        chatmsg "%d" -1 26@
        // uint8_t byteCurrentWeapon; + 54        
        //0C0D: struct 29@ offset 55 size 1 = 0  
        
        0BEA: raknet bit_stream 30@ reset_write_pointer
        0B40: raknet bit_stream 30@ write 29@ type BS_TYPE_ARRAY size 64        
        0AC9: free_allocated_memory 29@     
    END 
END
0BE0: hook_ret TRUE
 

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
268
Location
Pluto
You Are Not Sending Bullet Data When Shooting In Vehicle. Its About Key Sync You Can Try It Like That When Someone Shooting Hunter Disable Incoming Vehicle Sync From Her Except Key Data He Will Keep Shotting Last Position To Same Direction On Your Screen

Looks like you really is right:
Code:
{$CLEO .cs}
0000: vehicle bullet test

0BE2: raknet setup_outcoming_packet_hook @outpacket

0BDE: pause_thread 0

// struct stInCarData ( size = 63 )
// uint16_t sVehicleID; + 0
// uint16_t sLeftRightKeys; + 2
// uint16_t sUpDownKeys; + 4
// uint16_t sKeys; + 6
// float fQuaternion[4]; + 8
// float fPosition[3]; + 24
// float fMoveSpeed[3]; + 36
// float fVehicleHealth; + 48
// uint8_t bytePlayerHealth; + 52
// uint8_t byteArmor; + 53
// uint8_t byteCurrentWeapon; + 54
// uint8_t byteSiren; + 55
// uint8_t byteLandingGearState; + 56
// uint16_t sTrailerID; + 57
// float fTrainSpeed; + 59

:outpacket
0BE5: raknet 31@ = get_hook_param PARAM_PACKETID

IF 31@ == PACKET_VEHICLE_SYNC
THEN
    0BE5: 30@ = get_hook_param PARAM_BITSTREAM
    0BEB: RakNet bit_stream 30@ ignore_bits 8  // packetId // 1 byte - packet ID - skip

    0AC8: 29@ = allocate_memory_size 63
    0BE8: bit_stream 30@ read_array 29@ size 63
    
    0C0C: 26@ = struct 29@ offset 6 size 2
    08BF: set 26@ bit 0 // 26@ = 0bnnnnnnn1 ~ make Least significant bit(vehicle secondary fire) into true
    0C0D: struct 29@ offset 28@ size 27@ = 26@ // remodify that parameter
    
    0BEA: raknet bit_stream 30@ reset_write_pointer
    0B40: raknet bit_stream 30@ write 29@ type BS_TYPE_ARRAY size 63
    0AC9: free_allocated_memory 29@
END
0BE0: raknet hook_ret true


After conducting experiments. It seems that the following damage/bullet parameters are done in the client side and was not received from the server:
  • Explosions - if an explosion within your near proximity happened, an explosion "RPC Take Damage" was sent to server)
  • Helicopter Blades(when a person hits the your helicopter blades, the client sends an "player instant death by you" towards the server)
  • Actor on Fire - when your player was burned, a Fire "RPC Take Damage" was sent to server. Meaning when you used a flame thrower to an enemy, the enemy's own client itself deals damage to himself.
  • Player Rammed by a Vehicle - if you are hit by a vehicle or is laying down under a car, your client sends a melee "RPC Take Damage" to the server. So you are just damaging your self behind the scenes.
  • Player Fall Collision - when your player is falling, your client sends multiple "PACKET_PLAYER_SYNC" and the server reads "sCurrentAnimationID" and "sAnimFlags" to detect if you are falling, the damage after the collision towards the ground will be based on "fMoveSpeed[3]" so the faster you are falling the more damage you will received after the fall.
  • Vehicle Bullets - you fire a bullet/missile weapon on a vehicle, all players streaming near you will receive your
    1. "PACKET_VEHICLE_SYNC" that have the info if you are firing a weapon by detecting the keys you currently pressed.
    2. "PACKET_AIM_SYNC" the direction of vehicle bullet will be read here.


All those Damage types are client sided and no "RPC GIVE DAMAGE" are received from the server. It also seems that this Damage can be evaded by:
  • Blocking "RPC TAKE DAMAGE"
  • Blocking Incoming "PACKET_BULLET_SYNC" where our player or car is hit by the bullet
Code:
{$CLEO .cs}
{$INCLUDE SF}
0000: anti-damage

const
    RAKNETVAR1 = 30@
    RAKNETVAR2 = 29@
end

0BE1: raknet setup_outcoming_rpc_hook @outRPC
0BE2: raknet setup_outcoming_packet_hook @outPACKET

while true
    wait 0
    02AB: set_actor $PLAYER_ACTOR immunities BP 1 FP 1 EP 1 CP 1 MP 1
    if 00DF:   actor $PLAYER_ACTOR driving
    then
        03C0: 31@ = actor $PLAYER_ACTOR car
        // 0A30: repair_car 31@
        02AC: set_car 31@ immunities BP 1 FP 1 EP 1 CP 1 MP 1
    end
end

:outRPC
if ISENABLED == true
then
    0BE5: raknet RAKNETVAR1 = get_hook_param PARAM_PACKETID
    if RAKNETVAR1 == RPC_GIVETAKEDAMAGE
    then
        0BE5: raknet RAKNETVAR1 = get_hook_param PARAM_BITSTREAM
        0BE7: raknet RAKNETVAR2 = bit_stream_read RAKNETVAR1 type BS_TYPE_BOOL    // give/take
        if RAKNETVAR2 == 1 // taking damage
        then
            0ACD: show_text_highpriority "damage packet blocked!" time 1000
            0BE0: raknet hook_ret false // block the packet
        end
    end
end
0BE0: raknet hook_ret true // accept the packet

:inPACKET
if ISENABLED == true
then
    0BE5: raknet RAKNETVAR1 = get_hook_param PARAM_PACKETID
    if RAKNETVAR1 == PACKET_BULLET_SYNC
    then
        0BE5: raknet RAKNETVAR1 = get_hook_param PARAM_BITSTREAM
        0BEB: RakNet bit_stream RAKNETVAR1 ignore_bits 8  // packetId // 1 byte - packet ID - skip
        
        0BE7: raknet RAKNETVAR2 = bit_stream_read RAKNETVAR1 type BS_TYPE_BYTE    // HitType
        if RAKNETVAR2 == 1 // Player Bullet Hit
        then
            0BE7: raknet RAKNETVAR2 = bit_stream_read RAKNETVAR1 type BS_TYPE_SHORT    // PlayerID
            0B2B: samp RAKNETVAR1 = get_player_id_by_actor_handle $PLAYER_ACTOR
            if 003B:   RAKNETVAR1 == RAKNETVAR2  // (int)
            then
                0ACD: show_text_highpriority "Player Bullet packet blocked!" time 1000
                0BE0: raknet hook_ret false // block the packet
            end
        else
            if and
                RAKNETVAR2 == 2 // Car Bullet Hit
                00DF:   actor $PLAYER_ACTOR driving
            then
                03C0: 0@ = actor $PLAYER_ACTOR car
                046C: 1@ = car 0@ driver
                if 07D6:   1@ == $PLAYER_ACTOR // @ == $ (int)
                then
                    0BE7: raknet RAKNETVAR2 = bit_stream_read RAKNETVAR1 type BS_TYPE_SHORT    // CarID
                    0B2C: samp RAKNETVAR1 = get_vehicle_id_by_car_handle 0@
                    if 003B:   RAKNETVAR1 == RAKNETVAR2  // (int)
                    then
                        0ACD: show_text_highpriority "Car Bullet packet blocked!" time 1000
                        0BE0: raknet hook_ret false // block the packet
                    end
                end
            end
        end
    end
end
0BE0: raknet hook_ret true


You can get current weapon id , but i can't see anything about spread.
It only sends what weapon does the actor currently holding while driving.

So yeah, changing the spread value will be useless since the damage of the vehicle bullets is conducted on the other player's client. So I will not try to dig up its memory address anymore. Thanks everyone.
 

Parazitas

God
Joined
Jan 2, 2017
Messages
3,116
Solutions
5
Reaction score
882
Location
Lithuania
Looks like you really is right:
Code:
{$CLEO .cs}
0000: vehicle bullet test

0BE2: raknet setup_outcoming_packet_hook @outpacket

0BDE: pause_thread 0

// struct stInCarData ( size = 63 )
// uint16_t sVehicleID; + 0
// uint16_t sLeftRightKeys; + 2
// uint16_t sUpDownKeys; + 4
// uint16_t sKeys; + 6
// float fQuaternion[4]; + 8
// float fPosition[3]; + 24
// float fMoveSpeed[3]; + 36
// float fVehicleHealth; + 48
// uint8_t bytePlayerHealth; + 52
// uint8_t byteArmor; + 53
// uint8_t byteCurrentWeapon; + 54
// uint8_t byteSiren; + 55
// uint8_t byteLandingGearState; + 56
// uint16_t sTrailerID; + 57
// float fTrainSpeed; + 59

:outpacket
0BE5: raknet 31@ = get_hook_param PARAM_PACKETID

IF 31@ == PACKET_VEHICLE_SYNC
THEN
    0BE5: 30@ = get_hook_param PARAM_BITSTREAM
    0BEB: RakNet bit_stream 30@ ignore_bits 8  // packetId // 1 byte - packet ID - skip

    0AC8: 29@ = allocate_memory_size 63
    0BE8: bit_stream 30@ read_array 29@ size 63
   
    0C0C: 26@ = struct 29@ offset 6 size 2
    08BF: set 26@ bit 0 // 26@ = 0bnnnnnnn1 ~ make Least significant bit(vehicle secondary fire) into true
    0C0D: struct 29@ offset 28@ size 27@ = 26@ // remodify that parameter
   
    0BEA: raknet bit_stream 30@ reset_write_pointer
    0B40: raknet bit_stream 30@ write 29@ type BS_TYPE_ARRAY size 63
    0AC9: free_allocated_memory 29@
END
0BE0: raknet hook_ret true


After conducting experiments. It seems that the following damage/bullet parameters are done in the client side and was not received from the server:
  • Explosions - if an explosion within your near proximity happened, an explosion "RPC Take Damage" was sent to server)
  • Helicopter Blades(when a person hits the your helicopter blades, the client sends an "player instant death by you" towards the server)
  • Actor on Fire - when your player was burned, a Fire "RPC Take Damage" was sent to server. Meaning when you used a flame thrower to an enemy, the enemy's own client itself deals damage to himself.
  • Player Rammed by a Vehicle - if you are hit by a vehicle or is laying down under a car, your client sends a melee "RPC Take Damage" to the server. So you are just damaging your self behind the scenes.
  • Player Fall Collision - when your player is falling, your client sends multiple "PACKET_PLAYER_SYNC" and the server reads "sCurrentAnimationID" and "sAnimFlags" to detect if you are falling, the damage after the collision towards the ground will be based on "fMoveSpeed[3]" so the faster you are falling the more damage you will received after the fall.
  • Vehicle Bullets - you fire a bullet/missile weapon on a vehicle, all players streaming near you will receive your
    1. "PACKET_VEHICLE_SYNC" that have the info if you are firing a weapon by detecting the keys you currently pressed.
    2. "PACKET_AIM_SYNC" the direction of vehicle bullet will be read here.


All those Damage types are client sided and no "RPC GIVE DAMAGE" are received from the server. It also seems that this Damage can be evaded by:
  • Blocking "RPC TAKE DAMAGE"
  • Blocking Incoming "PACKET_BULLET_SYNC" where our player or car is hit by the bullet
Code:
{$CLEO .cs}
{$INCLUDE SF}
0000: anti-damage

const
    RAKNETVAR1 = 30@
    RAKNETVAR2 = 29@
end

0BE1: raknet setup_outcoming_rpc_hook @outRPC
0BE2: raknet setup_outcoming_packet_hook @outPACKET

while true
    wait 0
    02AB: set_actor $PLAYER_ACTOR immunities BP 1 FP 1 EP 1 CP 1 MP 1
    if 00DF:   actor $PLAYER_ACTOR driving
    then
        03C0: 31@ = actor $PLAYER_ACTOR car
        // 0A30: repair_car 31@
        02AC: set_car 31@ immunities BP 1 FP 1 EP 1 CP 1 MP 1
    end
end

:outRPC
if ISENABLED == true
then
    0BE5: raknet RAKNETVAR1 = get_hook_param PARAM_PACKETID
    if RAKNETVAR1 == RPC_GIVETAKEDAMAGE
    then
        0BE5: raknet RAKNETVAR1 = get_hook_param PARAM_BITSTREAM
        0BE7: raknet RAKNETVAR2 = bit_stream_read RAKNETVAR1 type BS_TYPE_BOOL    // give/take
        if RAKNETVAR2 == 1 // taking damage
        then
            0ACD: show_text_highpriority "damage packet blocked!" time 1000
            0BE0: raknet hook_ret false // block the packet
        end
    end
end
0BE0: raknet hook_ret true // accept the packet

:inPACKET
if ISENABLED == true
then
    0BE5: raknet RAKNETVAR1 = get_hook_param PARAM_PACKETID
    if RAKNETVAR1 == PACKET_BULLET_SYNC
    then
        0BE5: raknet RAKNETVAR1 = get_hook_param PARAM_BITSTREAM
        0BEB: RakNet bit_stream RAKNETVAR1 ignore_bits 8  // packetId // 1 byte - packet ID - skip
       
        0BE7: raknet RAKNETVAR2 = bit_stream_read RAKNETVAR1 type BS_TYPE_BYTE    // HitType
        if RAKNETVAR2 == 1 // Player Bullet Hit
        then
            0BE7: raknet RAKNETVAR2 = bit_stream_read RAKNETVAR1 type BS_TYPE_SHORT    // PlayerID
            0B2B: samp RAKNETVAR1 = get_player_id_by_actor_handle $PLAYER_ACTOR
            if 003B:   RAKNETVAR1 == RAKNETVAR2  // (int)
            then
                0ACD: show_text_highpriority "Player Bullet packet blocked!" time 1000
                0BE0: raknet hook_ret false // block the packet
            end
        else
            if and
                RAKNETVAR2 == 2 // Car Bullet Hit
                00DF:   actor $PLAYER_ACTOR driving
            then
                03C0: 0@ = actor $PLAYER_ACTOR car
                046C: 1@ = car 0@ driver
                if 07D6:   1@ == $PLAYER_ACTOR // @ == $ (int)
                then
                    0BE7: raknet RAKNETVAR2 = bit_stream_read RAKNETVAR1 type BS_TYPE_SHORT    // CarID
                    0B2C: samp RAKNETVAR1 = get_vehicle_id_by_car_handle 0@
                    if 003B:   RAKNETVAR1 == RAKNETVAR2  // (int)
                    then
                        0ACD: show_text_highpriority "Car Bullet packet blocked!" time 1000
                        0BE0: raknet hook_ret false // block the packet
                    end
                end
            end
        end
    end
end
0BE0: raknet hook_ret true



It only sends what weapon does the actor currently holding while driving.

So yeah, changing the spread value will be useless since the damage of the vehicle bullets is conducted on the other player's client. So I will not try to dig up its memory address anymore. Thanks everyone.

You did great job mate.
 
Status
Not open for further replies.
Top