ZH-CN/isGuestAccount
Jump to navigation
Jump to search
他的功能检查帐户是否为临时帐户。临时帐户是在用户加入服务器时自动为其创建的帐户,在用户退出或登录到另一个帐户时被删除。存储在临时帐户中的数据在玩家离开服务器后不会被存储。因此,此功能将检查玩家是否已登录.
语法
bool isGuestAccount ( account theAccount )
OOP 语法 什么是OOP?
- 方法: account:isGuest(...)
- 变量: .guest
必填参数
- theAccount: 被检查的那个账户.
返回值
如果帐户是临时帐户,则返回“true”,否则返回“false”.
示例
此示例演示如何创建只能由注册用户运行的“call_admin”函数.
function callAdmin ( playerSource ) -- 首先获取尝试使用此函数的用户的帐户 sourceAccount = getPlayerAccount ( playerSource ) -- 如果他们是临时账户 if isGuestAccount ( sourceAccount ) then -- 提示他们注册正式账户 outputConsole ( "Please register to use this function!", playerSource ) else -- your code to call the admin would go here end end -- attach the function 'callAdmin' as a handler to the command "call_admin" addCommandHandler ( "call_admin", callAdmin )
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