SA-MP Forums Archive
setplayerammo - 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: setplayerammo (/showthread.php?tid=615604)



setplayerammo - MerryDeer - 24.08.2016

Hi,

This function setplayerammo changes ammo or add ammo?


Re: setplayerammo - Konstantinos - 24.08.2016

I don't want to be rude but many of your questions can already be answered by just testing it - it won't take more than 5 minutes.

The wiki also answers it (in example script): https://sampwiki.blast.hk/wiki/SetPlayerAmmo
Код:
SetPlayerAmmo(playerid, WEAPON_SHOTGUN, 100); // Set ammo of Shotgun to 100 bullets



Re: setplayerammo - Stinged - 24.08.2016

It changes the ammo of a weaponid.
GivePlayerWeapon(playerid, weaponid, ammo) adds ammo if the player already has that weapon.


Re: setplayerammo - theonethatownz - 24.08.2016

Hope this helps.

SetPlayerAmmo sets the ammo, so if I had 100 bullets and I SetPlayerAmmo 50, I would then have 50.

https://sampwiki.blast.hk/wiki/SetPlayerAmmo


Re: setplayerammo - Shinja - 24.08.2016

https://sampwiki.blast.hk/wiki/SetPlayerAmmo


Re: setplayerammo - SyS - 24.08.2016

In wiki it clearly states that
Quote:

Set the ammo to 0 to remove a weapon from a player's inventory. Note that the weapon will still show up in GetPlayerWeaponData, albeit with 0 ammo.

so it means that it will set the player ammo not adding up.And you can use GivePlayerWeapon to add the ammo up.


Re: setplayerammo - MerryDeer - 24.08.2016

Bots function are same? if i want just add ammo


Re: setplayerammo - Marricio - 24.08.2016

Use GivePlayerWeapon if you want to add ammo.


Re: setplayerammo - Konstantinos - 24.08.2016

Quote:
Originally Posted by MerryDeer
Посмотреть сообщение
Bots function are same? if i want just add ammo
https://sampwiki.blast.hk/wiki/Category:NPC

Quote:

This doesn't mean that you can't use the normal player functions applied to your NPCs (like SetPlayerPos, for example) from inside a gamemode or filterscript.




Re: setplayerammo - Stinged - 24.08.2016

Quote:
Originally Posted by MerryDeer
Посмотреть сообщение
Bots function are same? if i want just add ammo
How are they the same? Everyone just told you the difference.