SA-MP Forums Archive
Game not responding after shoot all ammo - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Game not responding after shoot all ammo (/showthread.php?tid=591982)



Game not responding after shoot all ammo - Zeddclarity - 19.10.2015

I had add for my gamemode which all the gun will have bullets.But after shoot out all the ammo, my game is not reponding, all the time which i try to test shoot out the ammo again the game is not responding and stop working all the time
Please help me


Re: Game not responding after shoot all ammo - Crystallize - 19.10.2015

show us public onplayerweaponshot


Re: Game not responding after shoot all ammo - Aerotactics - 19.10.2015

If you are trying to do something when you have 0 ammo, your "detector" has to be:

pawn Код:
//Example
new ammo = (GetPlayerAmmo(playerid) - 1);
I found that with GetPlayerAmmo, it always returns ammo + 1, which is probably why when you run out of ammo, the game removes your weapon when it returns with 1 ammo. So if you detect if (using the sample above):

pawn Код:
if(ammo == 0)
Without subtracting 1 from GetPlayerAmmo, you will never reach 0, so the script will never respond.

Source: Personal knowledge.