Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

Workaround for OnPlayerWeaponShot

$
0
0
So okay, for some reason (I just noticed) OnPlayerWeaponShot doesn't get called with bombs and rocket launchers.

PHP Code:

public OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ) {
    print(
"OnPlayerWeaponShot called");
    
printf("Weapon ID: %i :: Ammo: %i",GetPlayerWeapon(playerid),GetPlayerAmmo(playerid));
    
printf("Weapon ID: %i :: Ammo: %i",weaponid,GetPlayerAmmo(playerid));
    return 
1;


Tested with that code.

Now, there is only 1 work around I found for bombs and thats it with KeyStateChange

PHP Code:

public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if ((
newkeys KEY_FIRE) && !(oldkeys KEY_FIRE)) {
        if(
GetPlayerWeapon(playerid) == 16) {
            
printf("Weapon ID: %i :: Ammo: %i",GetPlayerWeapon(playerid),GetPlayerAmmo(playerid));
        }
    }
    return 
1;


But is there another way for it?

Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>