SA-MP Forums Archive
Weapon Ammo Limit PLEASE HELP - 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: Weapon Ammo Limit PLEASE HELP (/showthread.php?tid=366663)



Weapon Ammo Limit PLEASE HELP - NinjaChicken - 07.08.2012

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


Re: Weapon Ammo Limit PLEASE HELP - Devilxz97 - 07.08.2012

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


Re: Weapon Ammo Limit PLEASE HELP - NinjaChicken - 07.08.2012

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


Re: Weapon Ammo Limit PLEASE HELP - shitbird - 07.08.2012

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?


Re: Weapon Ammo Limit PLEASE HELP - you10 - 07.08.2012

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



Re: Weapon Ammo Limit PLEASE HELP - NinjaChicken - 07.08.2012

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

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


Re: Weapon Ammo Limit PLEASE HELP - NinjaChicken - 08.08.2012

please anyone is really urgent


Re: Weapon Ammo Limit PLEASE HELP - [KHK]Khalid - 08.08.2012

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


Re: Weapon Ammo Limit PLEASE HELP - NinjaChicken - 08.08.2012

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


Re: Weapon Ammo Limit PLEASE HELP - [KHK]Khalid - 08.08.2012

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.