Group Authorization: Difference between revisions
Jump to navigation
Jump to search
Created page with '<lsl> //============================================================ //© 2009 Chase Quinnell and TerraCo Designs // http://www.terracodesigns.com //Please keep this open so...' |
No edit summary |
||
| Line 1: | Line 1: | ||
{{LSL Header}} | |||
==Group Authorization== | |||
This script is used to check whether the object is set to the appropriate [[group]] (by group key). | |||
==The Script== | |||
<lsl> | <lsl> | ||
//============================================================ | //============================================================ | ||
Revision as of 16:22, 18 October 2009
| 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
//AUTHORIZED GROUP KEYS
//This is the group key for the authorized group.
string authgroupkey = "INSERT YOUR GROUP KEY HERE";
//============================================================
Unauthorized()
{
llOwnerSay("Authorization failed.");
llDetachFromAvatar();
llDie();
}
default {
state_entry()
{
llRequestPermissions(llGetOwner(), PERMISSION_ATTACH);
key id = llGetOwner();
list group = llGetObjectDetails(llGetKey(), [OBJECT_GROUP]);
//gets the group key of the object
if ((llList2String(group,0) != authgroupkey))
//checks object group key
//if it does not match, then it is unauthorized
{
Unauthorized();
//queue unauthorized subroutine
}
else
{
llOwnerSay("Authorization passed");
}
}
on_rez(integer tcauth_chk)
{
llResetScript();
//resets script on_rez so that it knows who owns it.
}
}
</lsl>