How to add more ammo..
#1

Well - I Was wondering - How to add more ammo ? Because I Was making a Clips system - So that.. Once you use a Clip - A Certain amount of Ammo get increased to the weapon , Like - if you have 10 bullets and you used a clip - you 'll get 20 bullet.. so - how to do it ? Xd
Reply
#2

Show us some codes?
Reply
#3

Well if you want to add to AK, then put this code to somewhere:
SetPlayerAmmo(playerid,30,500);
It will set 500 ammo.
Reply
#4

Mhm - You don't get me -How to UPDATE the ammo ? Like - to increase it..
Reply
#5

I guess it's a Mafia Wars server, so add it OnPlayerSpawn
For example
pawn Код:
public OnPlayerSpawn
{
 if(gTeam[playerid] == TEAM_POLICE)
    {
     GivePlayerWeapon(playerid,30)
     SetPlayerAmmo(playerid,30,500);
     }
     return 1;
}
Reply
#6

It could get a little buggy when players would lag. Just use OnPlayerKeyStateChange function. That's all you need.
Reply
#7

Guys.. It's not that hard to understand lol

- Let's say - now you have a gun and you are fighting with ? K ? and you have a CLIP to INCREASE "INCREASE" your Ammo - So once you use the - the BULLETS [Ammo] IN the WEAPON SHOULD INCREASE - so if you have 10 - it will be 20 - BUT if you have 20 - It will be 30 , Do you get it now ? lol
Reply
#8

Quote:
Originally Posted by Black Axe
Посмотреть сообщение
Guys.. It's not that hard to understand lol

- Let's say - now you have a gun and you are fighting with ? K ? and you have a CLIP to INCREASE "INCREASE" your Ammo - So once you use the - the BULLETS [Ammo] IN the WEAPON SHOULD INCREASE - so if you have 10 - it will be 20 - BUT if you have 20 - It will be 30 , Do you get it now ? lol
What's up with these weird people here on forums, lol...

Anyway here, i'll show you how it works:
pawn Код:
new ammo = GetPlayerAmmo(playerid); // Save your ammo amount into a variable.
new weapon = GetPlayerWeapon(playerid); // Same with the weapon ID.
ResetPlayerWeapons(playerid); // Remove player weapons. (you might want to ****** for 'RemovePlayerWeapon' function to remove only specific weapon.
GivePlayerWeapon(playerid, weaponid, ammo+10); // Gives the player it's weapon back with old + new (10) ammo.
I hope this helps you in some way.

EDIT: Or, actually by giving the player the same weapon that he already has, will increase the ammo.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)