Difference between revisions of "GetPedFightingStyle"

From Multi Theft Auto: Wiki
Jump to: navigation, search
Line 1: Line 1:
{{Server function}}
+
{{Shared function}}
 
__NOTOC__
 
__NOTOC__
 
Retrieves the fighting style a player/ped is currently using.
 
Retrieves the fighting style a player/ped is currently using.
 
+
Client side version of this function can be used only on client side peds.
 
==Syntax==  
 
==Syntax==  
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">

Revision as of 12:05, 13 February 2019

Retrieves the fighting style a player/ped is currently using. Client side version of this function can be used only on client side peds.

Syntax

int getPedFightingStyle ( ped thePed ) 

OOP Syntax Help! I don't understand this!

Method: ped:getFightingStyle(...)
Variable: .fightingStyle
Counterpart: setPedFightingStyle

Required Arguments

  • thePed: the ped whose current fighting style ID you wish to retrieve.

Returns

Returns the ped's current fighting style as an integer ID, false if it fails to retrieve a value.

Fighting Styles:

Fighting Style ID
STYLE_STANDARD 4
STYLE_BOXING 5
STYLE_KUNG_FU 6
STYLE_KNEE_HEAD 7
STYLE_GRAB_KICK 15
STYLE_ELBOWS 16

Example

This will allow any player to check what fighting style they are currently using, by typing the 'getfightingstyle' command.

function getPlayerFightStyle ( thePlayer, commandName )
	local playerstyle = getPedFightingStyle ( thePlayer )   -- store the fighting style in a variable
	outputChatBox ( tostring(playerstyle), thePlayer )         -- output it to the player
end
addCommandHandler ( "getfightingstyle", getPlayerFightStyle )

See Also