LlGetPermissionsKey

来自人工智能助力教育知识百科
跳转至: 导航搜索

Template:Needs Translation/


函数名
Function: key llGetPermissionsKey( );
参数: 无
返回值:返回上次授予或拒绝脚本权限的化身(密钥)。

如果既没有授予也没有拒绝权限(例如,权限对话框被取消或忽略),则返回空密钥。

注意事项
示例
示例1
// 1. 恢复立方体
// 2.创建新脚本并粘贴
// 3.保存脚本
// 4.在基本体上单击鼠标右键,然后选择“附加”
// 5.摸一摸原色
 
announce_permissions_key()
{
    key permissionsKey = llGetPermissionsKey();
 
    llSay(0, "key llGetPermissionsKey() = '" + (string)permissionsKey + "'");
}
 
default
{
    state_entry()
    {
        announce_permissions_key();
 
        key owner = llGetOwner();
        llRequestPermissions(owner, PERMISSION_ATTACH);
    }
 
    touch_start(integer num_detected)
    {
        key id = llDetectedKey(0);
        key owner = llGetOwner();
        key permissionsKey = llGetPermissionsKey();
 
        if (id == owner)
        {
            if (permissionsKey == owner)
                llDetachFromAvatar();
            else
                llSay(0, "Can't detach from you, you have not granted ATTACH perms.");
        }
        else
            llSay(0, "Sorry, you're not the owner!");
    }
 
    run_time_permissions(integer perm)
    {
        if (perm & PERMISSION_ATTACH)
            announce_permissions_key();
    }
}
相关函数
llGetPermissions

llRequestPermissions

相关事件
run_time_permissions