Age-Based Visitor Filter

From ZenMondo Wormser, 1 Year ago, written in Linden Scripting, viewed 355 times.
URL http://flynnos.org/flynnbin/view/90544867 Embed
Download Paste or View Raw
  1. /////////////////////////////////////////
  2. // Teleport Noobs Home by ZenMondo Wormser
  3. //
  4. // When an avatar enters a parcel younger than a defined age,
  5. // the avatar is teleported home and sent a message.
  6. //
  7. // NOTE: This script must be placed in an object that has the samne
  8. // same owner as the owner of the land. If the land is group owned, it
  9. // must be deeded to the group that owns the land.
  10. /////////////////////////////////////////////////
  11.  
  12.  
  13. //Change age to number of days old
  14. integer newb_age = 7;
  15.  
  16. key age_query;
  17. key avatar_key;
  18.  
  19. string avatar_name;
  20.  
  21.  
  22.  
  23. integer date2days(string data)
  24. {
  25.     integer result;
  26.     list parse_date = llParseString2List(data, ["-"], []);
  27.     integer year = llList2Integer(parse_date, 0);
  28.  
  29.     result = (year - 2000) * 365; // Bias Number to year 2000 (SL Avatars Born After Date)
  30.     list days = [ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 ];
  31.  
  32.     result += llList2Integer(days, (llList2Integer(parse_date, 1) - 1));
  33.     if (year/4 == llRound(year/4)) result += 1;
  34.     result += llList2Integer(parse_date, 2);
  35.  
  36.     return result;
  37. }
  38.  
  39. {
  40.     state_entry()
  41.     {
  42.         llSensorRepeat("", NULL_KEY, AGENT, 96.0, PI, 0.5);
  43.     }
  44.  
  45.     sensor(integer num_detected)
  46.     {
  47.             avatar_name = llDetectedName(0);
  48.             avatar_key = llDetectedKey(0);
  49.             age_query = llRequestAgentData(llDetectedKey(0), DATA_BORN);
  50.          
  51.     }
  52.    
  53.     dataserver(key queryid, string data)
  54.     {
  55.         if(queryid == age_query)
  56.         {
  57.             string born_on = data;  //Get the Date Avatar was born
  58.             string today = llGetDate();
  59.            
  60.             integer born_on_day =  date2days(born_on);
  61.             integer today_day = date2days(today);
  62.            
  63.             integer total_days_old = today_day - born_on_day;
  64.                            
  65.        
  66.             if(total_days_old <= newb_age)
  67.             {  
  68.                 llTeleportAgentHome(avatar_key);
  69.                 llInstantMessage(avatar_key, "Sorry " + avatar_name + " but due to recent circumstances, your account is too young to be admitted to this parcel.");
  70.             }
  71.        
  72.            
  73.                  
  74.         }  
  75.     }  
  76.    
  77.    
  78. }

Reply to "Age-Based Visitor Filter"

Here you can reply to the paste above

captcha