Need help GivePlayerAmmo(playerid, weapon, ammo);
#1

I want to make a shop that a player can buy only ammo for his weapon. I mean that if he hasn't got combat shotgun and want to buy ammo it will say him that he hasn't got this weapon to buy this ammo.

I don't want to give a weapon to a player, i want to give him only ammo for his weapon.

I don't know if this exist GivePlayerAmmo(playerid, weapon, ammo);

I searched but didn't find nothing.


Thanks
Reply
#2

I kinda didn't get what you just said but on the ammo thingy here :

pawn Код:
SetPlayerAmmo(playerid, weaponslot, GetPlayerAmmo(playerid));
Reply
#3

Quote:
Originally Posted by ViruZZzZ_ChiLLL
Посмотреть сообщение
I kinda didn't get what you just said but on the ammo thingy here :

pawn Код:
SetPlayerAmmo(playerid, weaponslot, GetPlayerAmmo(playerid));
Can you give me an example for how to use this thing... BTW just read more carefull.

EDIT: I don't want to set players ammo, i want to give them more ammo. I don't want to give a weapon to a player, i want to give him only ammo for his weapon.
GivePlayerAmmo(playerid, weapon, ammo);
Reply
#4

Okay, well here :
pawn Код:
new Ammo = GetPlayerAmmo(playerid);
SetPlayerAmmo(playerid, weaponslot, Ammo+3);
Then, that will give me +3 ammo on a certain weapon slot.
Reply
#5

setplayerammo doesnt work in 0.3
Reply
#6

I think this stock will work, it gives ammo to his current weapon

pawn Код:
stock GivePlayerAmmo2(playerid, ammo)
{
    GivePlayerWeapon(playerid,GetPlayerWeapon(playerid),ammo);
}
Reply
#7

also u should add getplayerweaponslot
Reply
#8

Quote:
Originally Posted by KyleSmith
Посмотреть сообщение
I think this stock will work, it gives ammo to his current weapon

pawn Код:
stock GivePlayerAmmo2(playerid, ammo)
{
    GivePlayerWeapon(playerid,GetPlayerWeapon(playerid),ammo);
}

Ye but can you show me an example how to give ammo to a weapon?
Reply
#9

try on the wiki to search GivePlayerAmmo i think it's there im not sure
Reply
#10

new ammo = GetPlayerAmmo(playerid);
SetPlayerAmmo(playerid, GetPlayerWeapon(playerid), ammo); works for me, just use that.
Remember to add + behind ammo and then how much he typed, you can do that yourself with new ammobuy = strval(tmp); and so on.. Then it would be.
SetPlayerAmmo(playerid, GetPlayerWeapon(playerid), ammo+ammobuy);
I think that would work
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)