<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.vc-mp.org/index.php?action=history&amp;feed=atom&amp;title=Scripting%2FSquirrel%2FFunctions%2FPlayer.GetAmmoAtSlot</id>
	<title>Scripting/Squirrel/Functions/Player.GetAmmoAtSlot - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.vc-mp.org/index.php?action=history&amp;feed=atom&amp;title=Scripting%2FSquirrel%2FFunctions%2FPlayer.GetAmmoAtSlot"/>
	<link rel="alternate" type="text/html" href="http://wiki.vc-mp.org/index.php?title=Scripting/Squirrel/Functions/Player.GetAmmoAtSlot&amp;action=history"/>
	<updated>2026-04-10T01:48:10Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>http://wiki.vc-mp.org/index.php?title=Scripting/Squirrel/Functions/Player.GetAmmoAtSlot&amp;diff=20142&amp;oldid=prev</id>
		<title>Human.: Created page with &quot;This function is used to get the ammo of the weapon that player is carrying at the entered slot ID.  == Syntax ==  &lt;pre&gt;Player.GetAmmoAtSlot( slot );&lt;/pre&gt;  == Arguments ==  *...&quot;</title>
		<link rel="alternate" type="text/html" href="http://wiki.vc-mp.org/index.php?title=Scripting/Squirrel/Functions/Player.GetAmmoAtSlot&amp;diff=20142&amp;oldid=prev"/>
		<updated>2018-10-02T14:09:57Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;This function is used to get the ammo of the weapon that player is carrying at the entered slot ID.  == Syntax ==  &amp;lt;pre&amp;gt;Player.GetAmmoAtSlot( slot );&amp;lt;/pre&amp;gt;  == Arguments ==  *...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This function is used to get the ammo of the weapon that player is carrying at the entered slot ID.&lt;br /&gt;
&lt;br /&gt;
== Syntax ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Player.GetAmmoAtSlot( slot );&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Arguments ==&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;int&amp;#039;&amp;#039; &amp;#039;&amp;#039;&amp;#039;slot&amp;#039;&amp;#039;&amp;#039; - The weapon slot ID.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&amp;lt;source lang=squirrel&amp;gt;&lt;br /&gt;
/* Comments about what each slot stores.&lt;br /&gt;
Slot 0: Hats, unarmed, Brass, etc...&lt;br /&gt;
Slot 1: Katana, chainsaw, hammer, etc...&lt;br /&gt;
Slot 2: Grenades, molotov, tear gas, etc...&lt;br /&gt;
Slot 3: Colt45, Python, etc...&lt;br /&gt;
Slot 4: Stubby, Spaz, Shotgun, etc...&lt;br /&gt;
Slot 5: Uzi, MP5, Ingram, etc...&lt;br /&gt;
Slot 6: M4, Ruger, etc...&lt;br /&gt;
Slot 7: M60, RPG, Minigun, etc...&lt;br /&gt;
Slot 8: Laser sniper, sniper, etc...&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
function onPlayerCommand( player, cmd, text )&lt;br /&gt;
{&lt;br /&gt;
	if ( cmd == &amp;quot;myweps&amp;quot; || cmd == &amp;quot;mywep&amp;quot; )&lt;br /&gt;
	{&lt;br /&gt;
		local wepID, wepAmmo;&lt;br /&gt;
&lt;br /&gt;
		for (local i = 0; i &amp;lt;= 8; i++)// Loops from slot 0 to 8.&lt;br /&gt;
		{&lt;br /&gt;
			wepID = player.GetWeaponAtSlot(i); // Will return the weapon&amp;#039;s ID&lt;br /&gt;
			wepAmmo = player.GetAmmoAtSlot(i); // Will return the weapon&amp;#039;s ammo&lt;br /&gt;
&lt;br /&gt;
			// Displays the weapon&amp;#039;s name and ammo of each slot( 0 - 8 )&lt;br /&gt;
			MessagePlayer( &amp;quot;Weapon at slot &amp;quot; + i + &amp;quot;: &amp;quot;+ GetWeaponName(wepID) +&amp;quot; (ammo: &amp;quot;+ wepAmmo +&amp;quot;)&amp;quot;, player ); &lt;br /&gt;
		} &lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
=== Notes ===&lt;br /&gt;
[[onPlayerCommand]], [[Scripting/Squirrel/Functions/GetWeaponName|GetWeaponName]], [[Scripting/Squirrel/Functions/MessagePlayer|MessagePlayer]] and [[Scripting/Squirrel/Functions/Player.GetWeaponAtSlot|Player.GetWeaponAtSlot]] were used in this example. More info about them in the corresponding pages.&lt;br /&gt;
&lt;br /&gt;
== Related Functions ==&lt;br /&gt;
&lt;br /&gt;
{{Scripting/Squirrel/Functions/Player_Functions}}&lt;br /&gt;
&lt;br /&gt;
== Related Functions ==&lt;br /&gt;
&lt;br /&gt;
{{Scripting/Squirrel/Functions/Player_Functions}}&lt;br /&gt;
[[Category:Scripting/Squirrel/Functions/Player_Functions]]&lt;/div&gt;</summary>
		<author><name>Human.</name></author>
	</entry>
</feed>