getPlayerWantedLevel | Multi Theft Auto: Wiki Skip to content

getPlayerWantedLevel

Client-side
Server-side
Shared

Pair: setPlayerWantedLevel

Manual Review Required

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.

OOP Syntax Help! I don't understand this!

  • Method:player:getWantedLevel(...)
  • Variable: .wantedLevel

Syntax

int getPlayerWantedLevel ( )

Returns

  • int: value

Returns an int from 0 to 6 representing the player's wanted level, false if the player does not exist.

Code Examples

client

This script output your wanted level when you type /wanted.

function outputWantedLevel ()
local wantedLvl = getPlayerWantedLevel ( )
if wantedLvl == 0 then
outputChatBox ( "You clean", 0, 255, 0)
else
outputChatBox ( "You have "..wantedLvl.." wanted stars!", 255, 0, 0)
end
end
addCommandHandler ( "wanted", outputWantedLevel )

See Also