CLEO Help Who is shooting at my car

CLEO related
Status
Not open for further replies.

Ravenous

Active member
Joined
Jan 21, 2016
Messages
61
Reaction score
4
Hi, i am trying to get the actor handle of the player who is shooting at my car
Here is what i tried but it doesn't work and it wouldn't be very efficient either.
Code:
                FOR 12@ = 0 to 999
                  IF
                  SAMP.IsPlayerConnected(12@)
                  THEN
                        IF 13@ = SAMP.GetActorHandleByPlayerID(12@)
                        THEN
                            if
                            051C:   has_car_been_damaged_by_char 0@ char 13@
                            then
                            15@ = samp.GetPlayerNickname(12@)
                            chatmsg "%s" -1 15@
                            end
                        end
                    end
                end

I found this: http://ugbase.eu/index.php?threads/releas-who-shoots-cs.2319/ but it can only detect the player shooting at me not at my car, is there any way to do this? I also want to be able to detect if someone pops my tires.
 

_Safa

Well-known member
Joined
Sep 22, 2019
Messages
295
Reaction score
100
Location
UGBASE
There are a couple methods you can use, seeing as that you're strictly using CLEO though.

1) Hook for incoming ID_BULLET_SYNC packets and read HitType for "BULLET_HIT_TYPE_VEHICLE " (2)
2) Hook for incoming ID_BULLET_SYNC, check if ray from shooting pos to end pos intersects your vehicle's boundaries. You're better off going with the 1st method.
 

Ravenous

Active member
Joined
Jan 21, 2016
Messages
61
Reaction score
4
There are a couple methods you can use, seeing as that you're strictly using CLEO though.

1) Hook for incoming ID_BULLET_SYNC packets and read HitType for "BULLET_HIT_TYPE_VEHICLE " (2)
2) Hook for incoming ID_BULLET_SYNC, check if ray from shooting pos to end pos intersects your vehicle's boundaries. You're better off going with the 1st method.
well i did that but i have a nasty problem, when i am reading the bitstream which has this structure:https://wiki.sa-mp.com/wiki/OnPlayerWeaponShot if i read the first parameter as BS_TYPE_BYTE and the id of the player who did the damage is less than 255 all works fine but if his id is bigger than 255 than all the parameters that follow get screwed up, it only works if i read it as BS_TYPE_SHORT so i don't know how to determine if i should read it as byte or short.
 
Status
Not open for further replies.
Top