setplayerammo
#1

Hi,

This function setplayerammo changes ammo or add ammo?
Reply
#2

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
Reply
#3

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

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
Reply
#5

https://sampwiki.blast.hk/wiki/SetPlayerAmmo
Reply
#6

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.
Reply
#7

Bots function are same? if i want just add ammo
Reply
#8

Use GivePlayerWeapon if you want to add ammo.
Reply
#9

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.

Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)