GetPlayerSerial: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server function}}
{{Server client function}}
This function returns the [[serial]] for a specified [[player]].
This function returns the [[serial]] for a specified [[player]].



Revision as of 12:01, 13 September 2011

This function returns the serial for a specified player.

Syntax

Click to collapse [-]
Server
string getPlayerSerial ( player thePlayer )

Required Arguments

  • thePlayer: A player object referencing the specified player.
Click to collapse [-]
Client
string getPlayerSerial ( )

Returns

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

Example

Click to collapse [-]
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( "serial", checkMySerial )

Example 2

Click to collapse [-]
Server

This example add command to ban player serial.

function banSerial( source, command, noob, reason )
   if ( noob ) then
      local theNoob = getPlayerFromName( noob )
      local theNoobSerial = getPlayerSerial( theNoob )
      if ( theNoob ) then
         addBan( theNoobSerial, source, reason )
      end
   end
end
addCommandHandler( "banserial", banSerial )

Example 3

<section name="Client" class="client" show="true"> This example add command to get client's serial.

function getMySerial( )
      local theSerial = getPlayerSerial()
      outputChatBox("Your serial is: "..tostring(theSerial))
     end
end
addCommandHandler( "serial", getMySerial )

See Also