<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.gtaconnected.com/wiki/index.php?action=history&amp;feed=atom&amp;title=ScriptingExamples%2FPlayerWeapon</id>
	<title>ScriptingExamples/PlayerWeapon - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.gtaconnected.com/wiki/index.php?action=history&amp;feed=atom&amp;title=ScriptingExamples%2FPlayerWeapon"/>
	<link rel="alternate" type="text/html" href="https://wiki.gtaconnected.com/wiki/index.php?title=ScriptingExamples/PlayerWeapon&amp;action=history"/>
	<updated>2026-04-28T23:46:21Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.15</generator>
	<entry>
		<id>https://wiki.gtaconnected.com/wiki/index.php?title=ScriptingExamples/PlayerWeapon&amp;diff=4667&amp;oldid=prev</id>
		<title>Mex at 17:44, 3 February 2019</title>
		<link rel="alternate" type="text/html" href="https://wiki.gtaconnected.com/wiki/index.php?title=ScriptingExamples/PlayerWeapon&amp;diff=4667&amp;oldid=prev"/>
		<updated>2019-02-03T17:44:54Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{DISPLAYTITLE:Player Weapon Command}}&lt;br /&gt;
== Description ==&lt;br /&gt;
This code gives a weapon to the player who types the &amp;lt;code&amp;gt;/w weapon ammo active&amp;lt;/code&amp;gt; command.&amp;lt;br&amp;gt;&lt;br /&gt;
Default weapon id is &amp;lt;code&amp;gt;21&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
Default ammunition is &amp;lt;code&amp;gt;500&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
Default active weapon status is &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Lua, Client-Side, GTAC versions 1.0.72 and newer:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
{{LuaCode|1=addCommandHandler(&amp;quot;w&amp;quot;, function(cmd,args)&lt;br /&gt;
	args = split(args)&lt;br /&gt;
	local weapon = tonumber(args[1]) or 21&lt;br /&gt;
	local ammo = tonumber(args[2]) or 500&lt;br /&gt;
	local active = tonumber(args[3]) ~= 0&lt;br /&gt;
	localPlayer:giveWeapon(weapon, ammo, active)&lt;br /&gt;
end)&lt;br /&gt;
&lt;br /&gt;
{{ScriptingExamples/UtilityCode/Lua/split}}}}&lt;/div&gt;</summary>
		<author><name>Mex</name></author>
	</entry>
</feed>