Difference between revisions of "Blacklist and Remote Kill"

From Second Life Wiki
Jump to navigation Jump to search
m (<lsl> tag to <source>)
 
(One intermediate revision by one other user not shown)
Line 15: Line 15:
==The Script==
==The Script==


<lsl>
<source lang="lsl2">
//© 2009 Chase Quinnell and TerraCo Designs
//© 2009 Chase Quinnell and TerraCo Designs
//      http://www.terracodesigns.com
//      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


list blacklist = ["name 1", "name2", "name3"];


//  put your avatar's uuid here
key creator = "YOUR AVATAR UUID KEY HERE";




list blacklist=["name 1","name2","name3"]; //This is our blacklist.
integer adminChannel = 901;
key creator = "YOUR AVATAR UUID KEY HERE"; //this identifies the object creator.  Hardcode your key in this spot
 
 
integer AChan=901; //This is the admin channel to listen for creator commands




default
default
{
{
    on_rez(integer start)
    {
        llResetScript();
        llListen(adminChannel,"","","");
    }
     state_entry()
     state_entry()
     {
     {
         //llRequestPermissions(llGetOwner(),PERMISSION_ATTACH); //this is used if you need to DETACH from avatar
        //  the next line is required to make detaching possible
       
         //llRequestPermissions(llGetOwner(),PERMISSION_ATTACH);
          
 
         //CHECK BLACKLIST
         key ownerKey = llGetOwner();
         if (llListFindList(blacklist,[llKey2Name(llGetOwner())])!=-1)  
         string ownerName = llKey2Name(ownerKey);
         integer found = ~llListFindList(blacklist, [ownerName]);
 
        if (found)
         {
         {
             //if new owner is in blacklist, tell them to go away
             llOwnerSay("WARNING:"
        llOwnerSay("Warning: You are not allowed to use this item, you have been blacklisted by the creator. Item has been self-destructed. Have a nice day, " + (llKey2Name(llGetOwner())));
                + "\n\tYou are not allowed to use this item, you have been blacklisted by the creator."
        llSleep(2);
                + "\n\tItem will bee self-destructing. Have a nice day, " + ownerName + ".");
         //llDie(); //deletes object
            llSleep(0.5);
         //llDetachFromAvatar; //detaches from avatar, requires the request permissions function.
 
         // llDie();
 
        // the next line is required if you want to detach
         // llDetachFromAvatar;
         }
         }
     }
     }
     on_rez(integer start)
 
     listen(integer channel, string name, key id, string message)
     {
     {
         llResetScript(); //resets script, makes sure it knows who owns it
         key ownerKey = llGetOwner();
        llListen(AChan,"","","");
        key ownername = llKey2Name(ownerKey);
 
        if (message == llToLower("kill:" + (string)ownername) && channel == adminChannel && id == creator)
        {
            //if the message equals kill:currentownernamehere
            //and the channel is the admin channel
            //and the person is the creator
   
            //then tell the person their thing has been nerfed...
            llOwnerSay("Self destruct initiated...");
            llInstantMessage(creator, "/me owned by " + ownerName +" has self-destructed.");
            llSleep(0.5);
            llRemoveInventory("otherscripthere..");
            llSleep(0.5);
            llRemoveInventory(llGetScriptName());
        }
     }
     }


     listen(integer CH, string name, key id, string msg)
     run_time_permissions(integer perm)
     {
     {
         key ownername = (llKey2Name(llGetOwner()));
         if (!(perm & PERMISSION_ATTACH))
       
            llResetScript();
    if (msg==llToLower("kill:"+(string)ownername) && CH==AChan && id==creator)
        {
        //if the message equals kill:currentownernamehere
        //and the channel is the admin channel
        //and the person is the creator
       
        //then tell the person their thing has been nerfed...
        llOwnerSay("Self destruct initiated...");
        llInstantMessage(creator, "/me owned by " +(llKey2Name(llGetOwner())) +" has self-destructed");
        llSleep(1);
        llRemoveInventory("otherscripthere..");
        llSleep(1);
        llRemoveInventory(llGetScriptName());
        }
     }
     }
}
}
</lsl>
</source>

Latest revision as of 18:28, 24 January 2015

Blacklist and Remote Kill

This script explains how to set up a blacklist and incorporate a remote kill script for something.

Blacklist

The Blacklist is a list of avatar names you can input which will be denied access to your object. The script will check the blacklist on rez and if the owner is on it, the object will delete, clean scripts, or detach.

Remote Kill

Allows you to delete something owned by someone else by saying something like "kill:ownername" on a private admin channel to delete, clean scripts, or detach their object.

The Script

//© 2009 Chase Quinnell and TerraCo Designs
//      http://www.terracodesigns.com
//Please keep this open source and leave my name reference here

list blacklist = ["name 1", "name2", "name3"];

//  put your avatar's uuid here
key creator = "YOUR AVATAR UUID KEY HERE";


integer adminChannel = 901;


default
{
    on_rez(integer start)
    {
        llResetScript();
        llListen(adminChannel,"","","");
    }

    state_entry()
    {
        //  the next line is required to make detaching possible
        //llRequestPermissions(llGetOwner(),PERMISSION_ATTACH);

        key ownerKey = llGetOwner();
        string ownerName = llKey2Name(ownerKey);
        integer found = ~llListFindList(blacklist, [ownerName]);

        if (found)
        {
            llOwnerSay("WARNING:"
                + "\n\tYou are not allowed to use this item, you have been blacklisted by the creator."
                + "\n\tItem will bee self-destructing. Have a nice day, " + ownerName + ".");
            llSleep(0.5);

        //  llDie();

        //  the next line is required if you want to detach
        //  llDetachFromAvatar;
        }
    }

    listen(integer channel, string name, key id, string message)
    {
        key ownerKey = llGetOwner();
        key ownername = llKey2Name(ownerKey);

        if (message == llToLower("kill:" + (string)ownername) && channel == adminChannel && id == creator)
        {
            //if the message equals kill:currentownernamehere
            //and the channel is the admin channel
            //and the person is the creator
    
            //then tell the person their thing has been nerfed...
            llOwnerSay("Self destruct initiated...");
            llInstantMessage(creator, "/me owned by " + ownerName +" has self-destructed.");
            llSleep(0.5);
            llRemoveInventory("otherscripthere..");
            llSleep(0.5);
            llRemoveInventory(llGetScriptName());
        }
    }

    run_time_permissions(integer perm)
    {
        if (!(perm & PERMISSION_ATTACH))
            llResetScript();
    }
}