SetPlayerRotation: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (→Example) |
||
Line 19: | Line 19: | ||
This example code makes the player named Cheesepie look south. | This example code makes the player named Cheesepie look south. | ||
<syntaxhighlight lang="lua">function discoTime ( player, command ) | <syntaxhighlight lang="lua">function discoTime ( player, command ) | ||
-- Randomly choose a new playe rotation and set it | |||
newRotation = math.random ( 0, 360 ) | |||
setPlayerRotation ( player, newRotation ) | |||
end | end | ||
--When 'disco' command is typed | --When 'disco' command is typed | ||
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 who activated discoTime to the function so his rotation will be changed. | --Send the player who activated discoTime to the function so his rotation will be changed. | ||
setTimer (discoTime, 1000, 0, player ) | setTimer (discoTime, 1000, 0, player ) | ||
end | end | ||
addCommandHandler ( "disco", initiateDiscoMode )</syntaxhighlight> | addCommandHandler ( "disco", initiateDiscoMode )</syntaxhighlight> |
Revision as of 08:05, 11 October 2007
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.
Syntax
bool setPlayerRotation ( player thePlayer, float rotation )
Required Arguments
Returns
Returns true if successful, false otherwise.
Example
This example code makes the player named Cheesepie look south.
function discoTime ( player, command ) -- Randomly choose a new playe rotation and set it newRotation = math.random ( 0, 360 ) setPlayerRotation ( player, newRotation ) end --When 'disco' command is typed function initiateDiscoMode ( player, commandName ) --Trigger a random change in player rotation every second. --Send the player who activated discoTime to the 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