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


Messages In This Thread
Bug with throwing grenades? - by Midzi - 21.07.2015, 20:48
Re: Bug with throwing grenades? - by Abagail - 21.07.2015, 21:14

Forum Jump:


Users browsing this thread: 1 Guest(s)