GetPlayerWeapon: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
__NOTOC__
__NOTOC__
This function tells you which weapon type is in a player's weapon slot.
This function tells you which weapon type is in a player's weapon slot. See *[[weapon|Weapon Info]]


==Syntax==
==Syntax==
Line 14: Line 14:


===Returns===
===Returns===
Returns an [[int]] indicating the type of the weapon the player has in the specified slot. See [[weapon info]]
Returns an [[int]] indicating the type of the weapon the player has in the specified slot.


==Example==
==Example==

Revision as of 18:23, 13 December 2006

This function tells you which weapon type is in a player's weapon slot. See *Weapon Info

Syntax

int getPlayerWeapon ( player thePlayer, [ int weaponSlot = current ] )

Required Arguments

  • thePlayer: the player you want to get the weapon type from.

Optional Arguments

  • weaponSlot: an integer representing the weapon slot (set to the players current slot if not given)

Returns

Returns an int indicating the type of the weapon the player has in the specified slot.

Example

This example will display a player's current weapon type. In this case, it is hard coded to use the player called someguy.

-- Find a player called someguy and find his current weapon id.
weaponType = getPlayerWeapon ( findPlayer ( "someguy" ) )
-- If a weapon type was returned then
if ( weaponType ) then
  outputChatBox ( "Someguy's current Weapon-type: " .. weaponType .. "." ) -- Display the weapon type in the chat box
end

See Also