getPlayerSerial | Multi Theft Auto: Wiki Skip to content

getPlayerSerial

Client-side
Server-side
Shared

Manual Review Required

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


This function returns the serial for a specified player.

Note

It's possible for a player to fake the value returned from getPlayerSerial when used on the clientside. For this reason you should only trust the value returned by this function when used serverside.

Important

You should use this function in conjunction with account system (e.g: login & password ) - especially for critical things, because serials could be invalid (as in, non-unique or faked ). See: Script security .

OOP Syntax Help! I don't understand this!

  • Method:player:getSerial(...)
  • Variable: .serial

Syntax

string getPlayerSerial ( player thePlayer )
Required Arguments
  • thePlayer: A player object referencing the specified player.

Returns

  • string: value

Returns the serial as a string if it was found, false otherwise.

Code Examples

server

This example creates a command with which player can check their own serial.

function checkMySerial( thePlayer, command )
local theSerial = getPlayerSerial( thePlayer )
if theSerial then
outputChatBox( "Your serial is: " .. theSerial, thePlayer )
else
outputChatBox( "Sorry, you have no serial. =(", thePlayer )
end
end
addCommandHandler( "myserial", checkMySerial )

See Also