LlAddToLandPassList: Difference between revisions

From Second Life Wiki
Jump to navigation Jump to search
Strife Onizuka (talk | contribs)
No edit summary
Strife Onizuka (talk | contribs)
mNo edit summary
(18 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{LSL_Function|func_id=240|func_sleep=0.1|func_energy=10.0|func=llAddToLandPassList|sort=AddToLandPassList|p1_type=key|p1_name=avatar|p2_type=float|p2_name=hours
{{LSL_Function
|func_desc=Add '''avatar''' to the land pass list for '''hours'''
|inject-2={{LSL_Function/avatar|avatar}}
|return_text|spec|caveats|examples|helpers|related|also|notes}}[[Category:LSL_Functions]][[Category:LSL_Stub]]
|func=llAddToLandPassList
|sort=AddToLandPassList
|func_id=240|func_sleep=0.1|func_energy=10.0
|p1_type=key|p1_name=avatar
|p2_type=float|p2_name=hours
|p2_desc=range {{Interval|lte=144.0|gte=0.0|center=hours}}
|p2_hover=range {{Interval/Hover|lte=144.0|gte=0.0|center=hours}}
|func_desc=Add {{LSLP|avatar}} to the land pass list for {{LSLP|hours}}, or indefinitely if {{LSLP|hours}} is zero.
|return_text
|spec
|caveats=* The maximum usable value for {{LSLP|hours}} is 144.  Any value greater than 144 will be silently reduced to 144.
|examples=<lsl>// This is not a complete solution, requires full avatar names to work - even for unbanning someone!
// This is meant only as an example of the land ban and pass management functions.
// free to copy, use, modify, distribute - just don't ask me to debug your modified code. ;-)
//
// Commands are:
//  /5 ban:full_avatar_name
//  /5 tempban:full_avatar_name
//  /5 unban:full_avatar_name
//  /5 pass:full_avatar_name
//  /5 unpass:full_avatar_name
//  /5 clearban
//  /5 clearpass
 
string command;
 
default
{
    state_entry()
    {
        llListen(5, "", llGetOwner(), "");
    }
   
    on_rez(integer param)
    {
        llResetScript();
    }
 
    listen(integer chan, string name, key id, string message)
    {
        if (command != "")
        {
            llOwnerSay("Sorry, still processing last command, try again in a second.");
        }
       
        list args = llParseString2List(message,[":"],[]);
        command = llToLower(llList2String(args,0));
       
        if (command == "clearbans")
        {
            llResetLandBanList();
        }
        if (command == "clearpass")
        {
            llResetLandPassList();
        }
        else
        {
            llSensor(llList2String(args,1),NULL_KEY,AGENT,96,PI);
        }
    }
   
    no_sensor()
    {
        command = "";
    }
   
    sensor(integer num)
    {
        integer i;
        for (i=0; i< num; ++i)
        {
            if (command == "ban")
            {
                // Ban indefinetely
                llAddToLandBanList(llDetectedKey(i),0.0);
            }
            if (command == "tempban")
            {
                // Ban for 1 hour.
                llAddToLandBanList(llDetectedKey(i),1.0);
            }
            if (command == "unban")
            {
                llRemoveFromLandBanList(llDetectedKey(i));
            }
            if (command == "pass")
            {
                // Add to land pass list for 1 hour
                llAddToLandPassList(llDetectedKey(i),1.0);
            }
            if (command == "unpass")
            {
                llRemoveFromLandPassList(llDetectedKey(i));
            }
        }
        command = "";
    }
}</lsl>
|helpers
|related
|also_functions=
{{LSL DefineRow||[[llAddToLandBanList]]|}}
{{LSL DefineRow||[[llRemoveFromLandBanList]]|}}
{{LSL DefineRow||[[llRemoveFromLandPassList]]|}}
{{LSL DefineRow||[[llResetLandBanList]]|}}
{{LSL DefineRow||[[llResetLandPassList]]|}}
|also_events
|also_tests
|also_articles
|notes
|cat1=Security
|cat2=Parcel
|cat3
|cat4}}

Revision as of 09:01, 20 June 2012

Summary

Function: llAddToLandPassList( key avatar, float hours );
0.1 Forced Delay
10.0 Energy

Add avatar to the land pass list for hours, or indefinitely if hours is zero.

• key avatar avatar UUID
• float hours range [0.0, 144.0]

Caveats

  • This function causes the script to sleep for 0.1 seconds.
  • The maximum usable value for hours is 144. Any value greater than 144 will be silently reduced to 144.

Examples

<lsl>// This is not a complete solution, requires full avatar names to work - even for unbanning someone! // This is meant only as an example of the land ban and pass management functions. // free to copy, use, modify, distribute - just don't ask me to debug your modified code. ;-) // // Commands are: // /5 ban:full_avatar_name // /5 tempban:full_avatar_name // /5 unban:full_avatar_name // /5 pass:full_avatar_name // /5 unpass:full_avatar_name // /5 clearban // /5 clearpass

string command;

default {

   state_entry()
   {
       llListen(5, "", llGetOwner(), "");
   }
   
   on_rez(integer param)
   {
       llResetScript();
   }
   listen(integer chan, string name, key id, string message)
   {
       if (command != "")
       {
           llOwnerSay("Sorry, still processing last command, try again in a second.");
       }
       
       list args = llParseString2List(message,[":"],[]);
       command = llToLower(llList2String(args,0));
       
       if (command == "clearbans")
       {
           llResetLandBanList();
       }
       if (command == "clearpass")
       {
           llResetLandPassList();
       }
       else
       {
           llSensor(llList2String(args,1),NULL_KEY,AGENT,96,PI);
       }
   }
   
   no_sensor()
   {
       command = "";
   }
   
   sensor(integer num)
   {
       integer i;
       for (i=0; i< num; ++i)
       {
           if (command == "ban")
           {
               // Ban indefinetely 
               llAddToLandBanList(llDetectedKey(i),0.0);
           }
           if (command == "tempban")
           {
               // Ban for 1 hour.
               llAddToLandBanList(llDetectedKey(i),1.0);
           }
           if (command == "unban")
           {
               llRemoveFromLandBanList(llDetectedKey(i));
           }
           if (command == "pass")
           {
               // Add to land pass list for 1 hour
               llAddToLandPassList(llDetectedKey(i),1.0);
           }
           if (command == "unpass")
           {
               llRemoveFromLandPassList(llDetectedKey(i));
           }
       }
       command = "";
   }
}</lsl>

Deep Notes

Footnotes

  1. ^ The ranges in this article are written in Interval Notation.

Signature

function void llAddToLandPassList( key avatar, float hours );