GetPlayerWeapon

From Multi Theft Auto: Wiki
Revision as of 11:41, 13 August 2007 by Jbeta (talk | contribs) (Fixed example, added example section, minor changes)
Jump to navigation Jump to search

This function tells you which weapon type is in the player's current slot (clientside, you can optionally specify a slot other than the current one). See Weapon Info

Syntax

Click to expand [+]
Server
Click to expand [+]
Client

Example

Click to collapse [-]
Example

This serverside 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.
local weaponType = getPlayerWeapon ( getPlayerFromNick ( "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