getServerPassword | Multi Theft Auto: Wiki Skip to content

getServerPassword

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

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


This function returns the current password required to join the server.

Syntax

getServerPassword ( )

Code Examples

server

This example prints the serverpassword to the player

function viewPassword ( thePlayer, command )
-- Put the password in a var
local password = getServerPassword ()
-- Check if the server has a password
-- If the server has an password, echo it
if password then
outputChatBox ( "The server password is " .. password, thePlayer )
-- Else print that there isnt any password
else
outputChatBox ( "The server doesn't have any password set", thePlayer )
end
end
-- Add console command 'viewpassword'
addCommandHandler ( "viewpassword", viewPassword )