SA-MP Forums Archive
Help me, weapons and ammunition - 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: Help me, weapons and ammunition (/showthread.php?tid=628724)



Help me, weapons and ammunition - huansohn - 14.02.2017


How to make the max ammo, for example M4 is 50-450 example, if taken further, it is, "You can not get more ammunition, weapons can not accommodate you," someone help me with



anyone give me suggestions or code


Re: Help me, weapons and ammunition - gamersx - 14.02.2017

The code..


Re: Help me, weapons and ammunition - huansohn - 14.02.2017

I do not know English, you can suggest me to look in the wiki you say that I do not know what you say


Re: Help me, weapons and ammunition - Ryan50 - 14.02.2017

Quote:
Originally Posted by huansohn
Посмотреть сообщение
I do not know English, you can suggest me to look in the wiki you say that I do not know what you say
Try


Код:
public OnPlayerSpawn(playerid)
{
        GivePlayerWeapon(playerid, 31, 450);
	return 1;
}



Re: Help me, weapons and ammunition - Luis- - 14.02.2017

https://sampwiki.blast.hk/wiki/GivePlayerWeapon
https://sampwiki.blast.hk/wroot/index.ph...=SetPlayerAmmo
https://sampwiki.blast.hk/wiki/GetPlayerAmmo

Код:
CMD:giveammo(playerid, params[])
{
	if(GetPlayerWeapon(playerid) == WEAPON_M4)
	{
		new ammo = GetPlayerAmmo(playerid)
		if(ammo <= 50 || ammo >= 450)
		{
			SetPlayerAmmo(playerid, 450);
		}
		else 
		{
			SendClientMessage(playerid, -1, "You can't have more then 50 ammo!");
		}
	}
	return true;
}
I'm not 100% sure what you wanted. Presuming something like that.

Haven't tested the code, no idea if it'll actually work.


Re: Help me, weapons and ammunition - huansohn - 14.02.2017

Quote:
Originally Posted by Luis-
Посмотреть сообщение
https://sampwiki.blast.hk/wiki/GivePlayerWeapon
https://sampwiki.blast.hk/wroot/index.ph...=SetPlayerAmmo
https://sampwiki.blast.hk/wiki/GetPlayerAmmo

Код:
CMD:giveammo(playerid, params[])
{
	if(GetPlayerWeapon(playerid) == WEAPON_M4)
	{
		new ammo = GetPlayerAmmo(playerid)
		if(ammo <= 50 || ammo >= 450)
		{
			SetPlayerAmmo(playerid, 450);
		}
		else 
		{
			SendClientMessage(playerid, -1, "You can't have more then 50 ammo!");
		}
	}
	return true;
}
I'm not 100% sure what you wanted. Presuming something like that.

Haven't tested the code, no idea if it'll actually work.
I mean, government organizations took bullets in the closet can only get 500 bullets is 450-50, while 500 did not get enough can get more


Re: Help me, weapons and ammunition - Luis- - 14.02.2017

Not much I can do without seeing any code you have, that's if you have any.