SetPlayerRotation: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
{{Server function}}
{{Needs_Checking|The rotation must be a varible, it cannot be an actual number. For example, getplayerrotation and set it to a varible, then set player rotation to that varible + 10. Vehicle rotation function worked with a number. Other rotation functions may not be accepting numbers too, but vehicle did. So I doubt it. -Ransom}}
{{Needs_Checking|The rotation must be a varible, it cannot be an actual number. For example, getplayerrotation and set it to a varible, then set player rotation to that varible + 10. Vehicle rotation function worked with a number. Other rotation functions may not be accepting numbers too, but vehicle did. So I doubt it. -Ransom}}
[[Category:Incomplete]]
[[Category:Incomplete]]


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


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


===Required Arguments===  
===Required Arguments===  
*'''theplayer:''' An [[player]] referring to a player.
*'''thePlayer:''' The [[player]] to set the rotation of
*'''rotation:''' A [[float]] specifying the desired rotation.
*'''rotation:''' A [[float]] specifying the desired rotation.


Line 18: Line 19:


==Example==  
==Example==  
This example does...
This example code makes the player named Cheesepie look south.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- rotate the player, so that he looks to the south
cheesepie = getPlayerFromNick ( "Cheesepie" )    -- try to get the player by his nick
setPlayerRotation ( player, 180 )
if ( cheesepie ) then                            -- make sure we found him (there may be no player named Cheesepie on the server)
    setPlayerRotation ( cheesepie, 180 )         -- set his roation
end
</syntaxhighlight>
</syntaxhighlight>



Revision as of 21:51, 15 August 2007

Dialog-information.png This article needs checking.

Reason(s): The rotation must be a varible, it cannot be an actual number. For example, getplayerrotation and set it to a varible, then set player rotation to that varible + 10. Vehicle rotation function worked with a number. Other rotation functions may not be accepting numbers too, but vehicle did. So I doubt it. -Ransom


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.

Returns

Returns true if successful, false otherwise.

Example

This example code makes the player named Cheesepie look south.

cheesepie = getPlayerFromNick ( "Cheesepie" )     -- try to get the player by his nick
if ( cheesepie ) then                             -- make sure we found him (there may be no player named Cheesepie on the server)
    setPlayerRotation ( cheesepie, 180 )          -- set his roation
end

See Also