SetPlayerFightingStyle: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(Deprecated function)
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__
{{Deprecated|setPedFightingStyle}}
 
Changes a player's fighting style, most only change the 'special attack' which is done using the Aim and Enter keys.
Changes a player's fighting style, most only change the 'special attack' which is done using the Aim and Enter keys.


STYLE_STANDARD = 4,
{{Fighting Styles}}
STYLE_BOXING = 5
STYLE_KUNG_FU = 6
STYLE_KNEE_HEAD = 7
// various melee weapon styles
STYLE_GRAB_KICK = 15
STYLE_ELBOWS = 16
(can someone fill in the rest and tidy it up =))


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">setPlayerFightingStyle ( player, int style ) </syntaxhighlight>  
<syntaxhighlight lang="lua">setPlayerFightingStyle ( player thePlayer, int style ) </syntaxhighlight>  


===Required Arguments===  
===Required Arguments===  
*'''Player:''' Tells the function to give the fighting style to a player
*'''thePlayer:''' Tells the function to give the fighting style to a player
*'''Style:''' A whole integer specifying the style of fighting you want to give to the player
*'''style:''' A whole integer specifying the style of fighting you want to give to the player
 
==Example==
<section name="Server" class="server" show="true"> 
This example sets the player's fighting style to the desired style when he types "setstyle" followed by a number from 4 to 16 in console.
<syntaxhighlight lang="lua">
function consoleSetFightingStyle ( thePlayer, commandName, id )
if ( thePlayer and id ) then                                                -- If player and ID are specified
local status = setPlayerFightingStyle ( thePlayer, tonumber(id) )    -- set the fighting style
if ( not status ) then                                              -- if that failed
outputConsole ( "Failed to set fighting style.", thePlayer ) -- show a message
end
end
end
addCommandHandler ( "setstyle",  consoleSetFightingStyle )


==Example== 
</syntaxhighlight> </section>
This example sets the player's fighting style to the desired style when he types "style" folldowed by a number from 4 to 16 in console.
<syntaxhighlight lang="lua">addCommandHandler ( "style", "style" ) -- add a command handler for setcash
function style ( player, command, id ) --when the style function is called
setPlayerFightingStyle ( player, id ) --set players fighting style
end</syntaxhighlight>


==See Also==
==See Also==
{{Player functions}}
{{Player functions}}
{{Server function}}

Latest revision as of 01:08, 11 September 2016


Emblem-important.png This function is deprecated. This means that its use is discouraged and that it might not exist in future versions.

Please use setPedFightingStyle instead.


Changes a player's fighting style, most only change the 'special attack' which is done using the Aim and Enter keys.

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

Syntax

setPlayerFightingStyle ( player thePlayer, int style ) 

Required Arguments

  • thePlayer: Tells the function to give the fighting style to a player
  • style: A whole integer specifying the style of fighting you want to give to the player

Example

Click to collapse [-]
Server

This example sets the player's fighting style to the desired style when he types "setstyle" followed by a number from 4 to 16 in console.

function consoleSetFightingStyle ( thePlayer, commandName, id )
	if ( thePlayer and id ) then                                                 -- If player and ID are specified
		local status = setPlayerFightingStyle ( thePlayer, tonumber(id) )    -- set the fighting style
		if ( not status ) then                                               -- if that failed
			outputConsole ( "Failed to set fighting style.", thePlayer ) -- show a message
		end
	end
end
addCommandHandler ( "setstyle",  consoleSetFightingStyle )

See Also

Shared