SetPlayerWantedLevel: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (→See Also) |
||
(10 intermediate revisions by 7 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
This function is used to set a player's wanted level. The wanted level is indicated by the amount of stars a player has on the HUD. | {{Server function}} | ||
This function is used to set a player's wanted level. The wanted level is indicated by the amount of stars a player has on the GTA HUD. | |||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool | bool setPlayerWantedLevel ( player thePlayer, int stars ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
[[File:Stars.png|thumb|Wanted level indicator on hud]] | |||
{{OOP||[[player]]:setWantedLevel|wantedLevel|getPlayerWantedLevel}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*'''thePlayer:''' The player whose wanted level is to be set | *'''thePlayer:''' The player whose wanted level is to be set | ||
Line 18: | Line 20: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- assume that there exists a collision shape named 'policeStation' | -- assume that there exists a collision shape named 'policeStation' | ||
function policeStationHit ( thePlayer ) | function policeStationHit ( thePlayer ) | ||
setPlayerWantedLevel ( thePlayer, 6 ) -- set the player's wanted level to 6 stars | setPlayerWantedLevel ( thePlayer, 6 ) -- set the player's wanted level to 6 stars | ||
outputChatBox ( | outputChatBox ( getPlayerName ( thePlayer ) .. " entered the police station!" ) | ||
end | end | ||
-- call 'policeStationHit' when a player enters the collision shape: | |||
addEventHandler ( "onColShapeHit", policeStation, policeStationHit ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Player functions}} | {{Player functions|server}} |
Latest revision as of 22:44, 6 September 2024
This function is used to set a player's wanted level. The wanted level is indicated by the amount of stars a player has on the GTA HUD.
Syntax
bool setPlayerWantedLevel ( player thePlayer, int stars )
OOP Syntax Help! I don't understand this!
- Method: player:setWantedLevel(...)
- Variable: .wantedLevel
- Counterpart: getPlayerWantedLevel
Required Arguments
- thePlayer: The player whose wanted level is to be set
- stars: An integer from 0 to 6 representing the wanted level
Returns
Returns true if the wanted level was set successfully, false if any of the arguments were invalid.
Example
This example sets a player's wanted level to six stars if they enter a certain colshape:
-- assume that there exists a collision shape named 'policeStation' function policeStationHit ( thePlayer ) setPlayerWantedLevel ( thePlayer, 6 ) -- set the player's wanted level to 6 stars outputChatBox ( getPlayerName ( thePlayer ) .. " entered the police station!" ) end -- call 'policeStationHit' when a player enters the collision shape: addEventHandler ( "onColShapeHit", policeStation, policeStationHit )
See Also
- getAlivePlayers
- getDeadPlayers
- getPlayerACInfo
- getPlayerAnnounceValue
- getPlayerCount
- getPlayerIdleTime
- getPlayerIP
- getPlayerVersion
- getRandomPlayer
- isPlayerMuted
- redirectPlayer
- resendPlayerACInfo
- resendPlayerModInfo
- setPlayerAnnounceValue
- setPlayerMuted
- setPlayerScriptDebugLevel
- setPlayerTeam
- setPlayerVoiceBroadcastTo
- setPlayerVoiceIgnoreFrom
- setPlayerWantedLevel
- spawnPlayer
- takePlayerScreenShot
- Shared
- 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