SA-MP Forums Archive
Maximum Ammo 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: Maximum Ammo Help (/showthread.php?tid=564980)



Maximum Ammo Help - kkeeii - 24.02.2015

Quote:

GivePlayerValidWeapon( playerid, WeaponID, Ammo )
{
if((PlayerInfo[playerid][pConnectTime] < 2 || PlayerInfo[playerid][pWRestricted] > 0) && WeaponID != 46 && WeaponID != 43) return 1;
switch( WeaponID )
{
case 0, 1:
{
PlayerInfo[playerid][pGuns][ 0 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 2, 3, 4, 5, 6, 7, 8, 9:
{
PlayerInfo[playerid][pGuns][ 1 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 22, 23, 24:
{
PlayerInfo[playerid][pGuns][ 2 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 25, 26, 27:
{
PlayerInfo[playerid][pGuns][ 3 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 28, 29, 32:
{
PlayerInfo[playerid][pGuns][ 4 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 30, 31:
{
PlayerInfo[playerid][pGuns][ 5 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 33, 34:
{
PlayerInfo[playerid][pGuns][ 6 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 35, 36, 37, 38:
{
PlayerInfo[playerid][pGuns][ 7 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 16, 17, 18, 39, 40:
{
PlayerInfo[playerid][pGuns][ 8 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 41, 42, 43:
{
PlayerInfo[playerid][pGuns][ 9 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 10, 11, 12, 13, 14, 15:
{
PlayerInfo[playerid][pGuns][ 10 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
case 44, 45, 46:
{
PlayerInfo[playerid][pGuns][ 11 ] = WeaponID;
GivePlayerWeapon( playerid, WeaponID, Ammo );
}
}
return 1;

Can someone help me? How can I edit the maximum ammo of all weapons into 500 and for pistol's are 50?
What should I change?
Because everytime I make myself a gun it gives me unlimited ammo, I want to change it to 500.
Can someone help me?


Re: Maximum Ammo Help - Golf - 24.02.2015

sorry fail


Re: Maximum Ammo Help - $$inSane - 24.02.2015

Maximum ammo from the function or server sided max ammo?


Re: Maximum Ammo Help - Aerotactics - 24.02.2015

That stock doesnt appear to have anything to do with:

Quote:

Because everytime I make myself a gun it gives me unlimited ammo




Re: Maximum Ammo Help - kkeeii - 24.02.2015

Quote:

/*if(PlayerInfo[playerid][pGunAmmo][2] > 45)
{
SetPlayerAmmo(playerid, PlayerInfo[playerid][pGuns][2], 45);
PlayerInfo[playerid][pGunAmmo][2] = 45;
}
if(PlayerInfo[playerid][pGuns][3] == 25 && PlayerInfo[playerid][pGunAmmo][3] > 20)
{
SetPlayerAmmo(playerid, PlayerInfo[playerid][pGuns][3], 20);
PlayerInfo[playerid][pGunAmmo][3] = 20;
}
if(PlayerInfo[playerid][pGuns][3] == 26 && PlayerInfo[playerid][pGunAmmo][3] > 30)
{
SetPlayerAmmo(playerid, PlayerInfo[playerid][pGuns][3], 30);
PlayerInfo[playerid][pGunAmmo][3] = 30;
}
if(PlayerInfo[playerid][pGuns][3] == 27 && PlayerInfo[playerid][pGunAmmo][3] > 25)
{
SetPlayerAmmo(playerid, PlayerInfo[playerid][pGuns][3], 25);
PlayerInfo[playerid][pGunAmmo][3] = 25;
}
if(PlayerInfo[playerid][pGunAmmo][4] > 80)
{
SetPlayerAmmo(playerid, PlayerInfo[playerid][pGuns][4], 80);
PlayerInfo[playerid][pGunAmmo][4] = 80;
}
if(PlayerInfo[playerid][pGunAmmo][5] > 85)
{
SetPlayerAmmo(playerid, PlayerInfo[playerid][pGuns][5], 85);
PlayerInfo[playerid][pGunAmmo][5] = 85;
}
if(PlayerInfo[playerid][pGuns][6] == 33 && PlayerInfo[playerid][pGunAmmo][6] > 30)
{
SetPlayerAmmo(playerid, PlayerInfo[playerid][pGuns][6], 30);
PlayerInfo[playerid][pGunAmmo][6] = 30;
}
if(PlayerInfo[playerid][pGuns][6] == 34 && PlayerInfo[playerid][pGunAmmo][6] > 20)
{
SetPlayerAmmo(playerid, PlayerInfo[playerid][pGuns][6], 20);
PlayerInfo[playerid][pGunAmmo][6] = 20;
}*/

What should I do in here?

Because the AMMO was unlimited, how can I change it?


Re: Maximum Ammo Help - kkeeii - 26.02.2015

HELLO, Can someone hlep me here? In my Gamemodes it is green and all the weapons are unlimited instead of following the ammo of the codes.

Quote:

//after each PlayerInfo[playerid][pGunAmmo][2] line
return 1;

I also add this but still the unlimited ammo.


Re: Maximum Ammo Help - Kenway - 26.02.2015

This a function that give gun...it should be like:
Код:
GivePlayerValidWeapon(playerid, 21, 50 );
Stop use NGG script please..You should learn to script from scratch