getPlayerWantedLevel | Multi Theft Auto: Wiki Skip to content

getPlayerWantedLevel

Client-side
Server-side
Shared

Pair: setPlayerWantedLevel

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function gets a player's current wanted level. The wanted level is indicated by the amount of stars a player has on the GTA HUD.

Syntax

getPlayerWantedLevel ( )

Code Examples

server

This example finds which players in the server have a wanted level:

local players = getElementsByType ( "player" ) -- get a table of all the players in the server
for theKey,thePlayer in ipairs(players) do -- use a generic for loop to step through each player
local level = getPlayerWantedLevel ( thePlayer ) -- get the wanted level of the player
if ( level > 0 ) then -- if the player has any stars, announce it in the chat:
outputChatBox ( getPlayerName ( thePlayer ) .. " has a wanted level of " .. level .. " stars!" )
end
end

See Also