GetPlayerSerial: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 23: Line 23:
         outputChatBox( "Your serial is: " .. theSerial, thePlayer )
         outputChatBox( "Your serial is: " .. theSerial, thePlayer )
     else
     else
         outputChatBox( "Sorry, you have no serial. =(" )
         outputChatBox( "Sorry, you have no serial. =(", thePlayer )
     end
     end
end
end

Revision as of 17:58, 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 [-]
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 )

See Also