SA-MP Forums Archive
Get player 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: Get player ammo (/showthread.php?tid=469052)



Get player ammo - x96664 - 11.10.2013

Hi guys, I have a simple question, but I can't find out how to do it. I want to get the player ammo for certain weapon and return it in a message.
Example message is:
Код:
The player has 7 ammo of AK-47.
Thanks in advance.


Re: Get player ammo - xVIP3Rx - 11.10.2013

pawn Код:
New Weapon, Ammo, String[128], WepName[32], pName[MAX_PLAYER_NAME];
GetPlayerWeapon(playerid, Weapon);
GetPlayerAmmo(playerid, Ammo);
GetWeaponName(Weapon, WepName, sizeof(wepName);
GetPlayerName(playerid, pName, sizeof(pName);
format(String, sizeof(string), "%s has %d ammo of %s", pName, Ammo, WepName);
SendClientMessage(playerid, Color, String);
GetPlayerWeaponData Might be helpful too


Re: Get player ammo - x96664 - 11.10.2013

Quote:
Originally Posted by xVIP3Rx
Посмотреть сообщение
pawn Код:
New Weapon, Ammo, String[128], WepName[32], pName[MAX_PLAYER_NAME];
GetPlayerWeapon(playerid, Weapon);
GetPlayerAmmo(playerid, Ammo);
GetWeaponName(Weapon, WepName, sizeof(wepName);
GetPlayerName(playerid, pName, sizeof(pName);
format(String, sizeof(string), "%s has %d ammo of %s", pName, Ammo, WepName);
SendClientMessage(playerid, Color, String);
GetPlayerWeaponData Might be helpful too
Ok, thank you for the fast response. REP+