open.mp forum
[Pawn] How to detect bullet collision on object? - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
--- Thread: [Pawn] How to detect bullet collision on object? (/showthread.php?tid=2531)



How to detect bullet collision on object? - ZynxLinclon - 2023-12-28

Hi i'm curious how to detect collision when bullet hit an object in samp like have a print like "You hit a object"


RE: How to detect bullet collision on object? - JasonRiggs - 2023-12-29

As for the collision, you can use ColAndreas plugin, you can find here https://github.com/Pottus/ColAndreas


RE: How to detect bullet collision on object? - plonkarchivist - 2024-02-28

https://github.com/Pottus/ColAndreas is really helpful


RE: How to detect bullet collision on object? - N0FeaR - 2024-03-03

(2023-12-28, 01:30 PM)ZynxLinclon Wrote: Hi i'm curious how to detect collision when bullet hit an object in samp like have a print like "You hit a object"

Here is an example

PHP Code:
forward OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ);

public 
OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ)
{
    if (hittype == BULLET_HIT_TYPE_OBJECT)
    {
        SendClientMessage(playeridCOLOR_YELLOW"You hit an object!");
        // You can add further actions here if needed
    }
    return 1;