GetPlayerSerial: Difference between revisions
Jump to navigation
Jump to search
m (→Example 2) |
No edit summary |
||
Line 4: | Line 4: | ||
==Syntax== | ==Syntax== | ||
<section name="Server" class="server" show="true"> | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
string getPlayerSerial ( player thePlayer ) | string getPlayerSerial ( player thePlayer ) | ||
Line 10: | Line 11: | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''thePlayer:''' A [[player]] object referencing the specified player. | *'''thePlayer:''' A [[player]] object referencing the specified player. | ||
</section> | |||
{{New feature|3.0110|1.1| | |||
<section name="Client" class="client" show="true"> | |||
<syntaxhighlight lang="lua"> | |||
string getPlayerSerial ( ) | |||
</syntaxhighlight> | |||
</section> | |||
}} | |||
==Returns== | ==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== | ==Example== |
Revision as of 13:42, 6 November 2010
This function returns the serial for a specified player.
Syntax
Click to collapse [-]
Serverstring getPlayerSerial ( player thePlayer )
Required Arguments
- thePlayer: A player object referencing the specified player.
Click to collapse [-]
Clientstring getPlayerSerial ( )
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. =(", thePlayer ) end end addCommandHandler( "serial", checkMySerial )
Example 2
Click to collapse [-]
ServerThis 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 )