IsGuestAccount: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 14: | Line 14: | ||
==Example== | ==Example== | ||
This example shows how you could create a ''call_admin'' function that only could be run by registered users. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
addCommandHandler ( "call_admin", callAdmin ) | |||
function callAdmin ( playerSource, commandName ) | |||
sourceAccount = getClientAccount ( playerSource ) -- get the account for the user trying to use this function | |||
if ( isGuestAccount ( sourceAccount ) == true ) then -- see if they're a guest | |||
outputConsole ( "Please register to use this function!", playerSource ) -- if they are, tell them to register | |||
else | |||
-- Your code here | |||
end | |||
end | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Account_functions}} | {{Account_functions}} |
Revision as of 11:54, 12 September 2006
This function checks to see if an account is a guest account. A guest account is an account automatically created for a user when they join the server and deleted when they quit or login to another account. Data stored in a guest account is not stored after the player has left the server.
Syntax
bool isGuestAccount ( account theAccount )
Required Arguments
- theAccount: The account you want to check to see if it is a guest account.
Returns
Returns true if the account is a guest account, false otherwise.
Example
This example shows how you could create a call_admin function that only could be run by registered users.
addCommandHandler ( "call_admin", callAdmin ) function callAdmin ( playerSource, commandName ) sourceAccount = getClientAccount ( playerSource ) -- get the account for the user trying to use this function if ( isGuestAccount ( sourceAccount ) == true ) then -- see if they're a guest outputConsole ( "Please register to use this function!", playerSource ) -- if they are, tell them to register else -- Your code here end end
See Also
- addAccount
- copyAccountData
- getAccount
- getAccountData
- getAccountName
- getAccountPlayer
- getAccountSerial
- getAccounts
- getAccountsBySerial
- getAllAccountData
- getPlayerAccount
- isGuestAccount
- logIn
- logOut
- removeAccount
- setAccountData
- setAccountPassword
- getAccountByID
- getAccountID
- getAccountIP
- getAccountsByData
- getAccountsByIP
- setAccountName