<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Justgerrardz</id>
	<title>Multi Theft Auto: Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Justgerrardz"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Justgerrardz"/>
	<updated>2026-05-15T15:33:33Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetPickupType&amp;diff=49875</id>
		<title>GetPickupType</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetPickupType&amp;diff=49875"/>
		<updated>2016-11-25T07:03:00Z</updated>

		<summary type="html">&lt;p&gt;Justgerrardz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function retrieves the type of a pickup, either a health, armour or weapon pickup.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int getPickupType ( pickup thePickup )        &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''thePickup:''' The pickup you wish to retrieve the type of.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''false'' if the pickup is invalid, or an integer of the type of the pickup, which include:&lt;br /&gt;
*'''0:''' Health pickup&lt;br /&gt;
*'''1:''' Armour pickup&lt;br /&gt;
*'''2:''' Weapon pickup&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example outputs a text according on the pickup type and it's contents to the player who picks it up.&lt;br /&gt;
&amp;lt;section show=&amp;quot;true&amp;quot; name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onPickupHitShow ( thePlayer )                        -- when someone hits a pickup&lt;br /&gt;
	local message = nil                                   -- define the 'message' variable&lt;br /&gt;
	local pickupType = getPickupType ( source )           -- get the pickup type and save it to the variable 'pickupType'&lt;br /&gt;
	if (pickupType == 0) then                             -- check the type of pickup, if it is a health pickup then...&lt;br /&gt;
		amount = getPickupAmount ( source )               -- get the amount of health in the pickup&lt;br /&gt;
		message = &amp;quot;You picked up &amp;quot; .. amount .. &amp;quot; health&amp;quot; -- save the message in the 'message' variable&lt;br /&gt;
	elseif (pickupType == 1) then                         -- if its a armour pickup then...&lt;br /&gt;
		amount = getPickupAmount(source)                  -- get the amount of amour in the pickup&lt;br /&gt;
		message = &amp;quot;You picked up &amp;quot; .. amount .. &amp;quot; armor&amp;quot;  -- save the message in the 'message' variable&lt;br /&gt;
	elseif (pickupType == 2) then                         -- if its a weapon pickup then..&lt;br /&gt;
		local weapon = getPickupWeapon ( source )         -- get the weapon id of the pickup&lt;br /&gt;
		local ammo = getPickupAmmo ( source )             -- get the ammo in the pickup&lt;br /&gt;
		message = &amp;quot;You picked up &amp;quot; .. getWeaponNameFromID(weapon) .. &amp;quot; with &amp;quot; .. ammo .. &amp;quot; ammo&amp;quot; -- save the message in the 'message' variable&lt;br /&gt;
	else&lt;br /&gt;
		message = &amp;quot;Unknown pickup type&amp;quot;      -- if it's neither of the above types, set the 'message' variable accordingly&lt;br /&gt;
	end&lt;br /&gt;
	outputChatBox ( message, thePlayer )             -- output the message to the player in the chatbox&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPickupHit&amp;quot;, getRootElement(), onPickupHitShow ) -- add an event handler for onPickupHit&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
* [http://www.papdan.com/iphone-and-mobile-development.php Mobile Development]&lt;br /&gt;
* [http://www.papdan.com/seo-services-search-engine-optimisation.php SEO Melbourne]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Pickup functions}}&lt;/div&gt;</summary>
		<author><name>Justgerrardz</name></author>
	</entry>
</feed>