Workaround for OnPlayerWeaponShot
#1

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

PHP код:
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 код:
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?
Reply


Messages In This Thread
Workaround for OnPlayerWeaponShot - by TwinkiDaBoss - 21.06.2016, 22:21
Re: Workaround for OnPlayerWeaponShot - by TwinkiDaBoss - 21.06.2016, 22:39

Forum Jump:


Users browsing this thread: 1 Guest(s)