Group Authorization

From Second Life Wiki
Revision as of 17:22, 18 October 2009 by Chase Quinnell (talk | contribs)
Jump to navigation Jump to search

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>