Bug with throwing grenades?
#1

Hello.

When we throw grenade and fast change weapon - grenade won't be throwned.
But.. OnPlayerKeyStateChange of course is called (KEY_FIRE).

It must be repaired..

Or is GTA:SA bug?


FIX:
Код:
new throwned[MAX_PLAYERS];

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
     new weaponid = GetPlayerWeapon(playerid);

     if(newkeys & KEY_FIRE && weaponid == 16)
     {
          if(!throwned)
          {
               throwned = true;

               SendClientMessage(playerid, -1, "Grenade has been throwned.");
          }
          else
          {
                 new weap[12], ammo[12];

                 for(new x = 0; x < 12; x++)
                 {
                       if(x == 8) continue; // No grenades

                       GetPlayerWeaponData(playerid, x, weap[x], ammo[x]);
                 }

                 ResetPlayerWeapons(playerid);

                 for(new x = 0; x < 12; x++)
                 {
                       if(x == 8) continue; // No grenades

                       GivePlayerWeapon(playerid, weap[x], ammo[x]);
                 }
          }
     }

     return 1;
}
Reply
#2

Sounds like a GTA bug to me, though you do press the key however if you change weapons before the animation is complete; the grenade probably isn't even thrown and cancels out.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)