SetPlayerRotation: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
 
(15 intermediate revisions by 8 users not shown)
Line 1: Line 1:
[[Category:Incomplete]]
{{Server client function}}
{{Needs_Checking|Incomplete/Possibly not functional}}  
{{Deprecated|setElementRotation}}


__NOTOC__  
__NOTOC__  
This fake function is for use with blah & blah and does blahblahblabhalbhl
This function allows you to set the current rotation of the specified player.


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool setPlayerRotation ( element player, float rotation )         
bool setPlayerRotation ( player thePlayer, float rotation )         
</syntaxhighlight>  
</syntaxhighlight>  


===Required Arguments===  
===Required Arguments===  
*'''argumentName:''' description
*'''thePlayer:''' The [[player]] to set the rotation of
 
*'''rotation:''' A [[float]] specifying the desired rotation in degrees.
===Optional Arguments===
{{OptionalArg}}
*'''argumentName2:''' descriptiona
*'''argumentName3:''' description


===Returns===
===Returns===
Returns ''true'' if blah, ''false'' otherwise.
Returns ''true'' if successful, ''false'' otherwise.


==Example==  
==Example==  
This example does...
This example allows a player to type the command 'disco', which will result in the player being rotated to a random direction every 1 second, infinite times.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">function discoTime ( player )
--This line does...
    -- Randomly choose a new player rotation and set it
blabhalbalhb --abababa
    newRotation = math.random ( 0, 360 )
--This line does this...
    setPlayerRotation ( player, newRotation )
mooo
end
</syntaxhighlight>
 
function initiateDiscoMode ( player, commandName )
    --Trigger a random change in player rotation every second
    --Send the stored 'activating player' to the discoTime
    --function, so his rotation will be changed.
    setTimer (discoTime, 1000, 0, player )
end
addCommandHandler ( "disco", initiateDiscoMode )</syntaxhighlight>


==See Also==
==See Also==
{{FunctionArea_Functions}}
{{Player functions}}

Latest revision as of 22:13, 5 July 2014

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 setElementRotation instead.


This function allows you to set the current rotation of the specified player.

Syntax

bool setPlayerRotation ( player thePlayer, float rotation )         

Required Arguments

  • thePlayer: The player to set the rotation of
  • rotation: A float specifying the desired rotation in degrees.

Returns

Returns true if successful, false otherwise.

Example

This example allows a player to type the command 'disco', which will result in the player being rotated to a random direction every 1 second, infinite times.

function discoTime ( player )
     -- Randomly choose a new player rotation and set it
     newRotation = math.random ( 0, 360 )
     setPlayerRotation ( player, newRotation )
end

function initiateDiscoMode ( player, commandName )
     --Trigger a random change in player rotation every second
     --Send the stored 'activating player' to the discoTime
     --function, so his rotation will be changed.
     setTimer (discoTime, 1000, 0, player )
end
addCommandHandler ( "disco", initiateDiscoMode )

See Also