GetPlayerSerial: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
		
	
| No edit summary | No edit summary | ||
| Line 9: | Line 9: | ||
| ===Required Arguments=== | ===Required Arguments=== | ||
| *'''thePlayer:''' A player object referencing the specified player. | *'''thePlayer:''' A [[player]] object referencing the specified player. | ||
| ==Returns== | |||
| Returns the serial as a string if it was found, ''false'' otherwise. | Returns the serial as a ''string'' if it was found, ''false'' otherwise. | ||
| ==Example== | |||
| <section name="Server" class="server" show="true"> | |||
| This example creates a command with which player can check their own serial. | |||
| <syntaxhighlight lang="lua"> | |||
| function checkMySerial( thePlayer, command ) | |||
|     local theSerial = getPlayerSerial( thePlayer ) | |||
|     if theSerial then | |||
|         outputChatBox( "Your serial is: " .. theSerial, thePlayer ) | |||
|     else | |||
|         outputChatBox( "Sorry, you have no serial. =(" ) | |||
|     end | |||
| end | |||
| addCommandHandler( "serial", checkMySerial ) | |||
| </syntaxhighlight> | |||
| </section> | |||
| ==See Also== | ==See Also== | ||
| {{Serial functions}} | {{Serial functions}} | ||
Revision as of 17:57, 2 June 2008
This function returns the serial for a specified player.
Syntax
string getPlayerSerial ( player thePlayer )
Required Arguments
- thePlayer: A player object referencing the specified player.
Returns
Returns the serial as a string if it was found, false otherwise.
Example
Click to collapse [-]
ServerThis 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. =(" )
    end
end
addCommandHandler( "serial", checkMySerial )