Weapon Ammo Limit PLEASE HELP
#1

ok, so basically im trying to make my script dynamic as possible, as the current state when a player gets a weapon he has unlimited ammo,

pawn Код:
GivePlayerValidWeapon(giveplayerid, 27, 60000);
now i could go through every line of code and change it to a set amount but thats not very easy, so i want something like this at the top of my script

pawn Код:
new unlimitedammo = 1
so basically if its set to 1 when a player gets a gun it will give them unlimited, but if its set to 0 when a player gets a gun it will give them the define ammount of ammo i have defined so i need help making this and the part where it gets the defined ammo ammounts please help asap.

EDIT: then can it be something like this
pawn Код:
GivePlayerValidWeapon(giveplayerid, 27, ammo);
The, ammo being the defined amount n shit

But yea i have no idea of how to do any of this , but if you help me make it and it works 100% il pay you
Reply
#2

pawn Код:
GivePlayerWeapon(playerid, 27, 99999);
infinite ammo.
Reply
#3

you honestly dont get it dude, read everything again not just the first line
Reply
#4

pawn Код:
#define unlimited_ammo 99999
#define limited_ammo 500

new bool: gUnlimitedAmmo;

switch (gUnlimitedAmmo)
{
    case 0: GivePlayerWeapon(playerid, 27, limited_ammo);
    case 1: GivePlayerWeapon(playerid, 27, unlimited_ammo);
}
Something like this?
Reply
#5

Do you mean something like this
pawn Код:
public GivePlayerValidWeapon(playerid, weaponid, ammo)
{
    if(unlimitedammo == 1)
    {
        GivePlayerWeapon(playerid, weaponid, 99999);
    }
    else
    {
        GivePlayerWeapon(playerid, weaponid, ammo);
   }
}
Reply
#6

Bingo you but i need a define for it and what do i change all my

[PAWNO]GivePlayerValidWeapon(giveplayerid, 27, 99999)[/PAWNO] to?
Reply
#7

please anyone is really urgent
Reply
#8

Yep, just CTRL+H and replace GivePlayerWeapon with GivePlayerValidWeapon.
Reply
#9

dude wtf are you talking about you have no idea on what the fuck i need
Reply
#10

Al you need is just forwarding the function that you10 gave you:

pawn Код:
forward GivePlayerValidWeapon(playerid, weaponid, ammo); // forwards it
public GivePlayerValidWeapon(playerid, weaponid, ammo)
{
    if(unlimitedammo == 1)
    {
        GivePlayerWeapon(playerid, weaponid, 99999);
    }
    else
    {
        GivePlayerWeapon(playerid, weaponid, ammo);
   }
   return 1;
}
Then you'll be able to use GivePlayerValidWeapon to give a player a weapon with limited/unlimited amount of ammo depending on the value of your "unlimitedammo" variable.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)