SetPlayerRotation: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
mNo edit summary |
||
(6 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{Server function}} | {{Server client function}} | ||
{{Deprecated|setElementRotation}} | |||
__NOTOC__ | __NOTOC__ | ||
This | This function allows you to set the current rotation of the specified player. | ||
==Syntax== | ==Syntax== | ||
Line 11: | Line 12: | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''thePlayer:''' The [[player]] to set the rotation of | *'''thePlayer:''' The [[player]] to set the rotation of | ||
*'''rotation:''' A [[float]] specifying the desired rotation. | *'''rotation:''' A [[float]] specifying the desired rotation in degrees. | ||
===Returns=== | ===Returns=== | ||
Line 17: | Line 18: | ||
==Example== | ==Example== | ||
This 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. | ||
<syntaxhighlight lang="lua">function discoTime ( player | <syntaxhighlight lang="lua">function discoTime ( player ) | ||
-- Randomly choose a new player rotation and set it | |||
newRotation = math.random ( 0, 360 ) | |||
setPlayerRotation ( player, newRotation ) | |||
end | end | ||
function initiateDiscoMode ( player, commandName ) | function initiateDiscoMode ( player, commandName ) | ||
--Trigger a random change in player rotation every second | --Trigger a random change in player rotation every second | ||
--Send the player | --Send the stored 'activating player' to the discoTime | ||
setTimer (discoTime, 1000, 0, player ) | --function, so his rotation will be changed. | ||
setTimer (discoTime, 1000, 0, player ) | |||
end | end | ||
addCommandHandler ( "disco", initiateDiscoMode )</syntaxhighlight> | addCommandHandler ( "disco", initiateDiscoMode )</syntaxhighlight> | ||
Line 34: | Line 35: | ||
==See Also== | ==See Also== | ||
{{Player functions}} | {{Player functions}} | ||
Latest revision as of 22:13, 5 July 2014
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
- getPlayerTeam
- getPlayerBlurLevel
- setPlayerBlurLevel
- getPlayerSerial
- forcePlayerMap
- getPlayerScriptDebugLevel
- getPlayerFromName
- getPlayerMoney
- getPlayerName
- getPlayerNametagColor
- getPlayerNametagText
- getPlayerPing
- getPlayerWantedLevel
- givePlayerMoney
- isPlayerMapForced
- isPlayerNametagShowing
- setPlayerHudComponentVisible
- setPlayerMoney
- setPlayerNametagColor
- setPlayerNametagShowing
- setPlayerNametagText
- takePlayerMoney
- countPlayersInTeam
- getPlayersInTeam
- isVoiceEnabled
- setControlState
- getControlState