Difference between revisions of "Group Authorization"
Jump to navigation
Jump to search
Kireji Haiku (talk | contribs) (added missing run_time_permissions event) |
|||
Line 9: | Line 9: | ||
<lsl> | <lsl> | ||
// | // © 2009 Chase Quinnell and TerraCo Designs | ||
// http://www.terracodesigns.com | |||
// | // Please keep this open source and leave my name reference here | ||
//Please keep this open source and leave my name reference here | |||
// This is the group key for the authorized group. | |||
//This is the group key for the authorized group. | |||
string authgroupkey = "INSERT YOUR GROUP KEY HERE"; | string authgroupkey = "INSERT YOUR GROUP KEY HERE"; | ||
Unauthorized() | Unauthorized() | ||
{ | { | ||
llOwnerSay(" | string thisScript = llGetScriptName(); | ||
llOwnerSay("/me [" + thisScript + "]: Sorry, you're wearing the wrong group tag."); | |||
llDetachFromAvatar(); | llDetachFromAvatar(); | ||
llDie(); | llRemoveInventory(thisScript); | ||
llDie(); | |||
} | } | ||
default | default | ||
{ | { | ||
on_rez(integer start_param) | |||
{ | |||
llResetScript(); | |||
} | |||
state_entry() | state_entry() | ||
{ | { | ||
key ownerKey = llGetOwner(); | |||
llRequestPermissions( | llRequestPermissions(ownerKey, PERMISSION_ATTACH); | ||
key | |||
key thisPrimsKey = llGetKey(); | |||
string groupKey = llList2String(llGetObjectDetails(thisPrimsKey, [OBJECT_GROUP]), 0); | |||
if (groupKey != authgroupkey) | |||
if ( | Unauthorized(); | ||
else | |||
else | |||
llOwnerSay("Authorization passed"); | llOwnerSay("Authorization passed"); | ||
} | } | ||
run_time_permissions(integer perm) | |||
{ | { | ||
llResetScript(); | if (!(perm & PERMISSION_ATTACH)) | ||
llResetScript(); | |||
} | } | ||
} | } | ||
</lsl> | </lsl> |
Revision as of 07:04, 13 October 2012
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Group Authorization
This script is used to check whether the object is set to the appropriate group (by group key).
The Script
<lsl> // © 2009 Chase Quinnell and TerraCo Designs // http://www.terracodesigns.com // Please keep this open source and leave my name reference here
// This is the group key for the authorized group. string authgroupkey = "INSERT YOUR GROUP KEY HERE";
Unauthorized() {
string thisScript = llGetScriptName();
llOwnerSay("/me [" + thisScript + "]: Sorry, you're wearing the wrong group tag."); llDetachFromAvatar(); llRemoveInventory(thisScript); llDie();
}
default {
on_rez(integer start_param) { llResetScript(); }
state_entry() { key ownerKey = llGetOwner(); llRequestPermissions(ownerKey, PERMISSION_ATTACH);
key thisPrimsKey = llGetKey(); string groupKey = llList2String(llGetObjectDetails(thisPrimsKey, [OBJECT_GROUP]), 0);
if (groupKey != authgroupkey) Unauthorized(); else llOwnerSay("Authorization passed"); }
run_time_permissions(integer perm) { if (!(perm & PERMISSION_ATTACH)) llResetScript(); }
} </lsl>