Bug with throwing grenades? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP (
https://sampforum.blast.hk/forumdisplay.php?fid=3)
+--- Forum: Bug Reports (
https://sampforum.blast.hk/forumdisplay.php?fid=20)
+--- Thread: Bug with throwing grenades? (
/showthread.php?tid=582599)
Bug with throwing grenades? -
Midzi - 21.07.2015
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;
}
Re: Bug with throwing grenades? -
Abagail - 21.07.2015
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.