Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Security Mango_Wylders_Security_Orb  

Mango_Wylders_Security_Orb

Mango Wylder's Security Orb

Category: Security
By : mangowylder
Created: 2012-09-10 Edited: 2012-09-10
Worlds: Second Life

the Zip file

Download all files for Mango_Wylders_Security_Orb
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Mango_Wylders_Security_Orb_1.lsl
Get file # 2. Mango_Wylders_Security_Orb_2.lsl
1 // Written by Mango Wylder except where noted
2 // Mods by Ferd Frederix for OpenSim on 3-1-2013
3 // Mods by Ferd from the Second Life wiki, thanks to a tip from Perrie Juran 5-29-2013
4 // Please see the notes below for usage
5
6 // I wrote this script a couple of years ago.
7 // Did some cleanup 09/10/2012
8 // Got rid of llInstantmessage
9 // Changed to llRegionSayto to get rid of delay
10 // Added some sanity checks
11 // Hope I didn't break anything :)
12 // If so let me know
13
14
15 // There is very little of the original code in this script.
16 // What original code is left is after sensor(integer nr)
17 // and little of that is left
18
19 // There is a problem with this script and the original script.
20 // http://www.free-lsl-scripts.com/cgi/freescripts.plx?ID=1119
21 // It uses llSleep when an avi is detected.
22 // Why is this a problem?
23 // Well if you invite someone to your parcel and they are not allowed,
24 // you can't do anything with the scanner once the avi is detected during the Warn Time period (sleep time)
25 // i.e You can't turn it off for example.
26 // The Avi will get booted then you will have to have to make changes to the Security Orb to
27 // allow the visitor.
28 // You might ask why not just use a timer?
29 // I'm using the timer to ensure no stray listens and to prevent writing to the wrong list in the
30 // event of no user input.
31 // I'm working on a major rewrite but for now it is what it is :)
32
33 // Mango Wylder
34
35 //Globals
36
37 // additional and untested modfications by Innula Zenovka to usernames rather than legacy names
38 // fix by Rolig Loon for issues with number of names allowed on whitelist
39 // fix by Rolig Loon to reset when rezzed from http://community.secondlife.com/t5/LSL-Scripting/Using-Mango-Wylders-Security-Orb/m-p/2026281/highlight/false#M17590
40 // you might also want to look at this link for case-sensitve names: http://community.secondlife.com/t5/LSL-Scripting/Help-With-a-List-Limit-Problem-Resolved-Thank-you-for-the-help/m-p/1825625/highlight/true#M15232
41
42 list gLstChoices = ["Show Admin", "Add Admin", "Del Admin", "Show White", "Add White", "Del White", "Turn On", "Turn Off", "Orb Status", "More", "Cancel"];
43 list gLstChoicesMore = ["ShowBan", "PurgeBan", "DelBan", "ShowEjected", "DelEject", "ClearEject", "Warn Time", "SetRange", "SetBanTime", "<< Back", "Group Mode", "Scan Rate"];
44 list gLstChoiceGroup = ["Group On", "Group Off"];
45 list gLstOwnerName = [];
46 list gLstAdminNames = [];
47 // scanner ignores anyone in this list
48 list gLstIgnore = [];
49 // ejected is where avi's are logged if scanner is on and not in White List
50 list gLstEjected = [];
51 // LstBan is where avi's are added with a timestamp if they return within BanTime
52 list gLstBan = [];
53 // LstEjectR is where avi's are add if they come back a second time within BanTime
54 // avi's will automatically be deleted from LstEjectR when added to LstBan
55 // this combination allows for the third visit within BanTime and LLTeleportHome
56 // Three strikes and you are out
57 list gLstEjectR = [];
58 // find out if the toucher is authorized
59 key gKeyToucherID;
60 // default scanner range is 30 meteres
61 float gFltRange = 30.0;
62 // default warning time is 30 seconds
63 float gFltWarnTime = 30;
64 float gFltScanRate = 30;
65 integer gIntChannel_Dialog;
66 integer gIntChannel_Chat;
67 integer gIntListen_Id;
68 integer gIntListen_Id_Chat;
69 // limit the white list to 25 users
70 integer gIntWhite_LstLen = 25;
71 // limit ejected list to 25 (25 plus the unix time stamp for each avi
72 integer gIntEject_LstLen = 50;
73 // limit admin list to 12 users
74 integer gIntAdmin_LstLen = 6;
75 // initial scanner range
76 integer gIntRange = 30;
77 // initial bantime in seconds (1 hour)
78 integer gIntBanTime = 3600;
79 // initial bantime in hours
80 integer gIntBanTimeH = 1;
81 integer gIntMasterRW = TRUE;
82 integer gIntWhiteAD;
83 integer gIntActive;
84 integer gIntSetBanTime;
85 integer gIntEjected;
86 integer gIntBanned;
87 integer gIntSetRange;
88 integer gIntWarnTime;
89 integer gIntSetWarnTime;
90 integer gIntSetScanRate;
91 integer gIntVectorX;
92 // scanner will ignore anyone with the same active group tag if activated
93 integer gIntGroupSet = 0;
94 string gStrWarnTime = "30";
95 string gStrBanTime = "1";
96 string gStrRange = "30";
97 string gStrScanRate = "30";
98 string gParcelName;
99 string gStrToucherName;
100 string gStrNewOwnerName;
101
102 string parcelName(vector p) {
104 }
105 //from the wiki https://wiki.secondlife.com/wiki/Category:LSL_Avatar/Name
106 string agentUsername(string agentLegacyName) {
107 return llDumpList2String(llParseString2List(llToLower(agentLegacyName)+" ", [" resident ", " "],[]), ".");
108 }
109
110
111 default{
113 {
114 gLstOwnerName = [gStrNewOwnerName = llGetUsername (llGetOwner())] + gLstOwnerName;
115 gLstIgnore = [gStrNewOwnerName] + gLstIgnore;
116 gIntChannel_Dialog = ( -1 * (integer)("0x"+llGetSubString((string)llGetKey(),-5,-1)) ); // set a negative integer chat channel for the dialog box
117 gIntChannel_Chat = 7; // Set a chat channel to listen to owners commands
118 gParcelName = parcelName(llGetPos());
119 }
120
121 touch_start(integer total_number)
122 {
123 gKeyToucherID = llDetectedKey(0);
124 gStrToucherName = llGetUsername(llDetectedKey(0)); // find out who is touching us
125 list vOwnerAdminNames = gLstOwnerName + gLstAdminNames;
126 if(~llListFindList(vOwnerAdminNames, [gStrToucherName])) // find out if the toucher is in the owners/admins list. If so they may proceed
127 {
128 gKeyToucherID = llDetectedKey(0);
129 llDialog(gKeyToucherID, "Please make a choice.", gLstChoices, gIntChannel_Dialog);
130 gIntListen_Id = llListen(gIntChannel_Dialog, "", gKeyToucherID, "");
131 gIntChannel_Chat = 7;
132 llSetTimerEvent(20); //set a time limit to llListen
133 }
134 else
135 {
136 llSay(0, "You are not authorized"); // if toucher isn't in the owner/admin list they get a warning
137 }
138 }
139
140 listen(integer channel, string name, key id, string choice)
141 {
142 if(channel == gIntChannel_Dialog)
143 {
144 if(~llListFindList(gLstChoices, [choice])) // verify dialog choice
145 {
146 if(choice == "Cancel")
147 {
148 llListenRemove(gIntListen_Id);
149 }
150 else if(choice == "More")
151 {
152 llDialog(gKeyToucherID, "Pick an option!", gLstChoicesMore, gIntChannel_Dialog); // present submenu on request
153 }
154 else if(choice == "Orb Status")
155 {
156 if(gIntActive == 1)
157 {
158 llRegionSayTo(gKeyToucherID, 0, "Security Orb is active and scanning at " + gStrRange + " meters in eject mode" + " Scan Rate is set at " + gStrScanRate + " seconds.");
159 llRegionSayTo(gKeyToucherID, 0, "Bantime is set at " + gStrBanTime + " hour(s)" + " Warning time is set at " + gStrWarnTime + " seconds");
160 }
161 else
162 {
163 llRegionSayTo(gKeyToucherID, 0, "Security Orb is turned off" + " Scan Rate is set at " + gStrScanRate + " seconds" );
164 llRegionSayTo(gKeyToucherID, 0, "Bantime is set at " + gStrBanTime + " hour(s)" + " Warning time is set at " + gStrWarnTime + " seconds");
165 }
166 llListenRemove(gIntListen_Id); //remove the listen on channel_dialog
167 }
168 else if(choice == "Turn On")
169 {
170 if(gIntActive == 1)
171 {
172 llRegionSayTo(gKeyToucherID, 0, "Security Orb is already armed and scanning at " + gStrRange + " meters. I will eject anyone I can find unless they're in your White list." );
173 llRegionSayTo(gKeyToucherID, 0, "Bantime is set at " + gStrBanTime + " hour(s)" + " Warning time is set at " + gStrWarnTime + " seconds" + " Scan Rate is set at " + gStrScanRate + " seconds.");
174 }
175 else
176 {
177 gIntActive = 1;
178 llRegionSayTo(gKeyToucherID, 0, "Security Orb is armed and scanning at " + gStrRange + " meters. I will eject anyone I can find unless they're in your White list." );
179 llRegionSayTo(gKeyToucherID, 0, "Bantime is set at " + gStrBanTime + " hour(s)" + " Warning time is set at " + gStrWarnTime + " seconds" + " Scan Rate is set at " + gStrScanRate + " seconds.");
180 llSensorRepeat( "", "", AGENT, gFltRange, PI, gFltScanRate );
181 }
182 llListenRemove(gIntListen_Id); //remove the listen on channel_dialog
183 }
184 else if(choice == "Turn Off")
185 {
187 gIntActive = 0;
188 llRegionSayTo(gKeyToucherID, 0, " Security Orb is turned off");
189 llListenRemove(gIntListen_Id); //remove the listen on channel_dialog
190 }
191 else if(choice == "Show White")
192 {
193 llRegionSayTo(gKeyToucherID, 0, "Here's your White list");
194 integer i;
195 integer s = llGetListLength(gLstIgnore);
196 do
197 llRegionSayTo(gKeyToucherID, 0, llList2String(gLstIgnore,i));
198 while(s>++i);
199 llListenRemove(gIntListen_Id); //remove the listen on channel_dialog
200 }
201 if(choice == "Add White")
202 {
203 if(llGetListLength(gLstIgnore) >= (gIntWhite_LstLen + gIntAdmin_LstLen + llGetListLength(gLstOwnerName)))//Rolig
204 {
205 llRegionSayTo(gKeyToucherID, 0, " You have reached the maximum allowed in the White List.");
206 llRegionSayTo(gKeyToucherID, 0, " If you want to the White List, you will need to delete one first");
207 }
208 else
209 {
210 gIntWhiteAD = 1;
211 if(gIntWhiteAD == 1) {
212 llRegionSayTo(gKeyToucherID, 0, "Please Enter name to Add in chat window on Channel /7");
213 gIntListen_Id_Chat = llListen(gIntChannel_Chat, "", gKeyToucherID, ""); // listen to user on chat channel
214 llListenRemove(gIntListen_Id); //remove the listen on channel_dialog
215 }
216 }
217 }
218 else if(choice == "Del White")
219 {
220 gIntWhiteAD = 2;
221 llRegionSayTo(gKeyToucherID, 0, "Please Enter name to Delete in chat window on Channel /7");
222 gIntListen_Id_Chat = llListen(gIntChannel_Chat, "", gKeyToucherID, ""); // listen to user on chat channel
223 llListenRemove(gIntListen_Id); //remove the listen on channel_dialog
224 }
225 else if(choice == "Add Admin")
226 {
227 if(llGetListLength(gLstAdminNames) >= gIntAdmin_LstLen)
228 {
229 llRegionSayTo(gKeyToucherID, 0, " You have reached the maximum allowed Administrators.");
230 llRegionSayTo(gKeyToucherID, 0, " If you want to add another Administrator, you will need to delete one first");
231 }
232 else if(~llListFindList(gLstOwnerName, [gStrToucherName]))
233 {
234 gIntWhiteAD = 3;
235 llRegionSayTo(gKeyToucherID, 0, "Please Enter name of the Administrator to Add in chat window on Channel /7");
236 gIntListen_Id_Chat = llListen(gIntChannel_Chat, "", gKeyToucherID, ""); // listen to user on chat channel
237 }
238 else
239 {
240 llSay(0, "You are not authorized to add to the administrators list"); // if toucher isn't in the owner they get a warning
241 }
242 llListenRemove(gIntListen_Id); //remove the listen on channel_dialog
243 }
244 else if(choice == "Show Admin")
245 {
246 if(gLstAdminNames == [])
247 {
248 llRegionSayTo(gKeyToucherID, 0, " The Administrators list is empty");
249 }
250 else
251 {
252 llRegionSayTo(gKeyToucherID, 0, "Here's your Administrators list");
253 llRegionSayTo(gKeyToucherID, 0, llList2CSV(gLstAdminNames));
254 }
255 llListenRemove(gIntListen_Id); //remove the listen on channel_dialog
256 }
257 else if(choice == "Del Admin")
258 {
259 if(~llListFindList(gLstOwnerName, [gStrToucherName]))
260 {
261 if(gLstAdminNames == [])
262 {
263 llRegionSayTo(gKeyToucherID, 0, " The Administrators list is empty");
264 }
265 else if(gLstAdminNames)
266 {
267 gIntWhiteAD = 4;
268 llRegionSayTo(gKeyToucherID, 0, "Please Enter name of the Admin to Delete in chat window on Channel /7");
269 gIntListen_Id_Chat = llListen(gIntChannel_Chat, "", gKeyToucherID, ""); // listen to user on chat channel
270 }
271 else
272 {
273 llRegionSayTo(gKeyToucherID, 0, "You are not authorized to remove from the administrators list"); // if toucher isn't in the owner they get a warning
274 }
275 }
276 llListenRemove(gIntListen_Id); //remove the listen on channel_dialog
277 }
278 }
279 if(~llListFindList(gLstChoicesMore, [choice])) // verify dialog choice
280 {
281 if(choice == "Warn Time")
282 {
283 gIntSetWarnTime = 1;
284 llRegionSayTo(gKeyToucherID, 0, "Please enter the new warning time on Channel /7");
285 gIntListen_Id_Chat = llListen(gIntChannel_Chat, "", gKeyToucherID, ""); // listen to user on chat channel
286 llListenRemove(gIntListen_Id); //remove the listen on gIntChannel_Dialog
287 }
288 else if(choice == "Scan Rate")
289 {
290 gIntSetScanRate = 1;
291 llRegionSayTo(gKeyToucherID, 0, "Please enter a Scan Rate from 5 to 60 seconds in the chat window on Channel /7");
292 gIntListen_Id_Chat = llListen(gIntChannel_Chat, "", gKeyToucherID, ""); // listen to user on chat channel
293 llListenRemove(gIntListen_Id); //remove the listen on channel_dialog
294 }
295 else if(choice == "SetRange")
296 {
297 gIntSetRange = 1;
298 llRegionSayTo(gKeyToucherID, 0, "Please enter the new scan range on Channel /7");
299 gIntListen_Id_Chat = llListen(gIntChannel_Chat, "", gKeyToucherID, ""); // listen to user on chat channel
300 llListenRemove(gIntListen_Id); //remove the listen on channel_dialog
301 }
302 else if(choice == "ShowEjected")
303 {
304 if(gLstEjected == [])
305 {
306 llRegionSayTo(gKeyToucherID, 0, " The ejected list is empty");
307 }
308 else
309 {
310 llRegionSayTo(gKeyToucherID, 0, "Here's your ejected list");
311 integer i;
312 integer s = llGetListLength(gLstEjected);
313 do
314 llRegionSayTo(gKeyToucherID, 0, llList2String(gLstEjected,i));
315 while(s>++i);
316 }
317 llListenRemove(gIntListen_Id); //remove the listen on channel_dialog
318 }
319 else if(choice == "DelEject")
320 {
321 if(gLstEjected == [])
322 {
323 llRegionSayTo(gKeyToucherID, 0, " The ejected list is empty");
324 }
325 else
326 {
327 gIntEjected = 1;
328 llRegionSayTo(gKeyToucherID, 0, "Please enter name to delete in chat window on Channel /7");
329 gIntListen_Id_Chat = llListen(gIntChannel_Chat, "", gKeyToucherID, ""); // listen to user on chat channel
330 }
331 llListenRemove(gIntListen_Id); //remove the listen on channel_dialog
332 }
333 else if(choice == "ClearEject")
334 {
335 if(gLstEjected == [])
336 {
337 llRegionSayTo(gKeyToucherID, 0, " The ejected list is already empty");
338 }
339 else
340 {
341 gIntEjected = 2;
342 llRegionSayTo(gKeyToucherID, 0, "This will clear the Ejected List. Do you wish to proceeed? Enter y or n on Channel /7");
343 gIntListen_Id_Chat = llListen(gIntChannel_Chat, "", gKeyToucherID, ""); // listen to user on chat channel
344 }
345 llListenRemove(gIntListen_Id); //remove the listen on channel_dialog
346 }
347 else if(choice == "DelBan")
348 {
349 if(gLstBan == [])
350 {
351 llRegionSayTo(gKeyToucherID, 0, " The Banned list is already empty");
352 }
353 else
354 {
355 gIntBanned = 1;
356 llRegionSayTo(gKeyToucherID, 0, "This will clear the Banned List. Do you wish to proceeed? Enter y or no on Channel /7");
357 gIntListen_Id_Chat = llListen(gIntChannel_Chat, "", gKeyToucherID, ""); // listen to user on chat channel
358 }
359 llListenRemove(gIntListen_Id); //remove the listen on channel_dialog
360 }
361 else if(choice == "PurgeBan")
362 {
363 if(gLstBan == [])
364 {
365 llRegionSayTo(gKeyToucherID, 0, " The ejected Ban list is empty");
366 }
367 else
368 {
369 integer length = llGetListLength(gLstBan); //purge avi's that have been gone longer than Ban Time
370 integer i = - 1;
371 integer BOOT_TIME = llGetUnixTime(); // store current time
372 for (; i < length; i += 2) // for all timestamps
373 {
374 if(BOOT_TIME - llList2Integer(gLstBan,i) > gIntBanTime) //compare timestamp with current time
375 {
376 integer j = i - 1;
377 gLstBan = llDeleteSubList(gLstBan, j, i);
378 i -= 2; // offset
379 length -= 2; // offset
380 }
381 }
382 llRegionSayTo(gKeyToucherID, 0, " The ejected Ban list has been purged of entries greater than " + gStrBanTime + " hour(s). Use Show Ban to see current entries.");
383 }
384 llListenRemove(gIntListen_Id); //remove the listen on channel_dialog
385 }
386 else if(choice == "ShowBan")
387 {
388 if(gLstBan == [])
389 {
390 llRegionSayTo(gKeyToucherID, 0, " The Banned list is empty");
391 }
392 else
393 {
394 llRegionSayTo(gKeyToucherID, 0, llList2CSV(gLstBan));
395 }
396 llListenRemove(gIntListen_Id); //remove the listen on channel_dialog
397 }
398 else if(choice == "SetBanTime")
399 {
400 gIntSetBanTime = 1;
401 llRegionSayTo(gKeyToucherID, 0, "Please enter Ban time in hours on Channel /7");
402 gIntListen_Id_Chat = llListen(gIntChannel_Chat, "", gKeyToucherID, ""); // listen to user on chat channel
403 llListenRemove(gIntListen_Id); //remove the listen on channel_dialog
404 }
405 else if(choice == "Group Mode")
406 {
407 llDialog(gKeyToucherID, "Please ensure the Security Console is set to the correct group before enabling this feature.", gLstChoiceGroup, gIntChannel_Dialog);
408 }
409 else if(choice == "<< Back")
410 {
411 llDialog(gKeyToucherID, "What do you want to do?", gLstChoices, gIntChannel_Dialog); // present main menu on request to go back
412 }
413 }
414 if(~llListFindList(gLstChoiceGroup, [choice])) // verify dialog choice
415 {
416 if(choice == "Group On")
417 {
418 gIntGroupSet = 1;
419 llRegionSayTo(gKeyToucherID, 0, "Group Mode protection is activated");
420 llListenRemove(gIntListen_Id); //remove the listen on channel_dialog
421 }
422 else if(choice == "Group Off")
423 {
424 gIntGroupSet = 0;
425 llRegionSayTo(gKeyToucherID, 0, "Group Mode protection is de-activated");
426 llListenRemove(gIntListen_Id); //remove the listen on channel_dialog
427 }
428 }
429 }
430 //end of channel_dialog
431
432 if(channel == gIntChannel_Chat)
433 {
434
435 if(gIntMasterRW = TRUE) // check to see if modifying any list is still allowwd (not timed out)
436
437 { if(~llListFindList([1,2,3,4],[gIntWhiteAD])){
438 choice = agentUsername (choice);
439 if(gIntWhiteAD == 1)//ensure we should be here adding to the White List
440 {
441 if(~llListFindList(gLstIgnore, [choice]))
442 {
443 llRegionSayTo(gKeyToucherID, 0, choice + " is already in the White List");
444 }
445 else if(~llListFindList(gLstEjected, [choice]))
446 {
447 integer i = llListFindList(gLstEjected, [choice]);
448 gLstEjected = llDeleteSubList(gLstEjected, i,i);
449 llRegionSayTo(gKeyToucherID, 0, choice + " was in the Ejected list " + choice + " has been removed from the Ejected list" );
450 if(~llListFindList(gLstBan, [choice]))
451 {
452 integer j = llListFindList(gLstBan, [choice]);
453 gLstBan = llDeleteSubList(gLstBan, j,j + 1 ); //remove the avi and their timestamp from the Ban List
454 }
455 gLstIgnore = gLstIgnore + [choice]; //mono optimized list append
456 }
457 else
458 {
459 gLstIgnore = gLstIgnore + [choice]; //mono optimized list append
460 llRegionSayTo(gKeyToucherID, 0, choice + " has been added to the White List");
461 }
462 llListenRemove(gIntListen_Id_Chat); //remove the listen on channel_chat
463 llListenRemove(gIntListen_Id); //remove the listen on channel_dialog
464 gIntWhiteAD = 0;
465 }
466 else if(gIntWhiteAD == 2) // ensure we should be here removing from the White List
467 {
468 if(~llListFindList(gLstOwnerName, [choice]))
469 {
470 llRegionSayTo(gKeyToucherID, 0, "You can not remove the owner name from the White list!");
471 }
472 else
473 {
474 integer j = llListFindList(gLstIgnore, [choice]);
475 if(j == -1)
476 {
477 gIntWhiteAD = 0;
478 llRegionSayTo(gKeyToucherID, 0, choice + " isn't in the White list");
479 llListenRemove(gIntListen_Id_Chat); //remove the listen on channel_chat
480 llListenRemove(gIntListen_Id_Chat); //remove the listen on channel_chat
481 return;
482 }
483 else {
484 gLstIgnore = llDeleteSubList(gLstIgnore, j,j);
485 llRegionSayTo(gKeyToucherID, 0, choice + " has been removed from the White list");
486 }
487 }
488 llListenRemove(gIntListen_Id_Chat); //remove the listen on channel_chat
489
490 }
491 else if(gIntWhiteAD == 3) // ensure we should be here adding to the Administrators List
492 {
493 if(~llListFindList(gLstAdminNames, [choice]))
494 {
495 llRegionSayTo(gKeyToucherID, 0, choice + " is already in the Admin List");
496 }
497 else if(~llListFindList(gLstIgnore, [choice]))
498 {
499 gLstAdminNames = gLstAdminNames + [choice];
500 llRegionSayTo(gKeyToucherID, 0, choice + " has been added to the Administrators list");
501 }
502 else if(~llListFindList(gLstEjected, [choice]))
503 {
504 integer j = llListFindList(gLstEjected, [choice]);
505 gLstEjected = llDeleteSubList(gLstEjected, j,j);
506 llRegionSayTo(gKeyToucherID, 0, choice + " was in the Ejected list " + choice + " has been removed from the Ejected list" );
507 if(~llListFindList(gLstBan, [choice]))
508 {
509 integer k = llListFindList(gLstBan, [choice]);
510 gLstBan = llDeleteSubList(gLstBan,k,k + 1 );
511 }
512 gLstAdminNames = gLstAdminNames + [choice];
513 gLstIgnore = gLstIgnore + [choice];
514 llRegionSayTo(gKeyToucherID, 0, choice + " has been added to the Administrators list");
515 }
516 else
517 {
518 gLstAdminNames = gLstAdminNames + [choice];
519 gLstIgnore = gLstIgnore + [choice];
520 llRegionSayTo(gKeyToucherID, 0, choice + " has been added to the Administrators list");
521 }
522 gIntWhiteAD = 0;
523 llListenRemove(gIntListen_Id_Chat); //remove the listen on channel_chat
524 }
525 else if(gIntWhiteAD == 4) // ensure we should be here to remove from Administrators list
526 {
527 integer j = llListFindList(gLstAdminNames, [choice]);
528 if( j == -1)
529 {
530 llRegionSayTo(gKeyToucherID, 0, choice + " isn't in the Administrators list");
531 }
532 else
533 {
534 gLstAdminNames = llDeleteSubList(gLstAdminNames, j,j); // remove the person from the admin list
535 llRegionSayTo(gKeyToucherID, 0, choice + " has been removed from the Administators list");
536 }
537 gIntWhiteAD = 0;
538 llListenRemove(gIntListen_Id_Chat); //remove the listen on channel_chat
539 }
540 }
541 else if(gIntSetRange == 1) // set the scanner range
542 {
543 gIntRange = (integer) choice;
544 if(gIntRange)
545 {
546 gStrRange = choice;
547 gFltRange = (float) gIntRange;
549 llSensorRepeat("", "", AGENT, gFltRange, PI, gFltScanRate);
550 gIntActive = 1;
551 llRegionSayTo(gKeyToucherID, 0, "Changed range to: " + gStrRange + " meters and restarted the scanner");
552 llRegionSayTo(gKeyToucherID, 0, "Bantime is set at " + gStrBanTime + " hour(s)" + " Warning time is set at " + gStrWarnTime + " seconds" + " Scan Rate is set at " + gStrScanRate + " seconds.");
553 }
554 else
555 {
556 llRegionSayTo(gKeyToucherID, 0, "Invalid entry. Please enter an integer in meters up to 96 meters.");
557 }
558 llListenRemove(gIntListen_Id_Chat); //remove the listen on channel_chat
559 gIntSetRange = 0;
560 }
561 else if(gIntSetWarnTime == 1) // set the scan warn time
562 {
563 gIntWarnTime = (integer) choice;
564 if(gIntWarnTime)
565 {
566 gStrWarnTime = choice;
567 gFltWarnTime = (integer) gIntWarnTime;
568 llRegionSayTo(gKeyToucherID, 0, " Warning time has been changed to " + gStrWarnTime + " seconds");
569 }
570 else
571 {
572 llRegionSayTo(gKeyToucherID, 0, "Invalid entry. Please try again!");
573 }
574
575 llListenRemove(gIntListen_Id_Chat); //remove the listen on channel_chat
576 gIntSetWarnTime = 0;
577 }
578 else if(gIntEjected == 1) // remove an avi from the Ejected list
579 {
580 integer j = llListFindList(gLstEjected, [choice]);
581 if( j == -1)
582 {
583 llRegionSayTo(gKeyToucherID, 0, choice + " isn't in the Ejected list");
584 llListenRemove(gIntListen_Id_Chat); // remove the listen on channel_chat
585 gIntEjected = 0;
586 return;
587 }
588 gLstEjected = llDeleteSubList(gLstEjected, j,j);
589 llRegionSayTo(gKeyToucherID, 0, choice + " has been removed from the Ejected list");
590 gIntEjected = 0;
591 llListenRemove(gIntListen_Id_Chat); // remove the listen on channel_chat
592 }
593 else if(gIntEjected == 2) // clear the Ejected list
594 {
595 if(choice == "y")
596 {
597 llRegionSayTo(gKeyToucherID, 0, "Resetting the Ejected List");
598 gLstEjected = [];
599 }
600 if(choice == "n")
601 {
602 llRegionSayTo(gKeyToucherID, 0, "Aborting");
603 }
604 gIntEjected = 0;
605 llListenRemove(gIntListen_Id_Chat); //remove the listen on channel_chat
606 }
607 else if(gIntBanned == 1) // clear the Ban list
608 {
609 if(choice == "y")
610 {
611 llRegionSayTo(gKeyToucherID, 0, "Resetting the Banned List");
612 gLstBan = [];
613 }
614 if(choice == "n")
615 {
616 llRegionSayTo(gKeyToucherID, 0, "Aborting");
617 }
618 gIntBanned = 0;
619 llListenRemove(gIntListen_Id_Chat); //remove the listen on channel_chat
620 }
621 else if(gIntSetBanTime == 1) // set the bantime in hours
622 {
623 gIntBanTime = (integer) choice;
624 if(gIntBanTime)
625 {
626 gIntBanTime = gIntBanTime * 3600; // convert hours entered to seconds (3600 seconds in an hour)
627 gIntBanTimeH = gIntBanTime / 3600;
628 gStrBanTime = (string) gIntBanTimeH;
629 string hours;
630 if(gIntBanTime > 3600)
631 {
632 hours = " hours";
633 }
634 else
635 {
636 hours = " hour";
637 }
638 llRegionSayTo(gKeyToucherID, 0, " Ban time set to " + gStrBanTime + hours);
639 }
640 else
641 {
642 llRegionSayTo(gKeyToucherID, 0, "Invalid entry. Please enter an integer in hours. i.e. Enter 2 for 2 hours");
643 }
644 gIntSetBanTime = 0;
645 llListenRemove(gIntListen_Id_Chat); // remove the listen on channel_chat
646 }
647 else if(gIntSetScanRate == 1) // set the scan rate in seconds
648 {
649 gFltScanRate = (float) choice;
650 if(gFltScanRate)
651 {
652 gStrScanRate = choice;
653 llRegionSayTo(gKeyToucherID, 0, "ScanRate set to " + gStrScanRate + " seconds. Restarted the scanner");
655 llSensorRepeat("", "", AGENT, gFltRange, PI, gFltScanRate);
656 gIntActive = 1;
657 llRegionSayTo(gKeyToucherID, 0, "Security Orb is active and scanning at " + gStrRange + " meters in eject mode" + " Scan Rate is set at " + gStrScanRate + " seconds.");
658 llRegionSayTo(gKeyToucherID, 0, "Bantime is set at " + gStrBanTime + " hour(s)" + " Warning time is set at " + gStrWarnTime + " seconds");
659 }
660 else
661 {
662 llRegionSayTo(gKeyToucherID, 0, "Invalid Entry. Please enter a Scan Rate between 10 and 60 seconds. i.e /7 30");
663 }
664 gIntSetScanRate = 0;
665 llListenRemove(gIntListen_Id_Chat); // remove the listen on channel_chat
666 }
667 }
668 }
669
670 }
671 timer()
672 { //TIMES UP!
673 llListenRemove(gIntListen_Id_Chat);
674 llListenRemove(gIntListen_Id);
675 gIntMasterRW = FALSE;
676 llRegionSayTo(gKeyToucherID, 0, "Times is up to make changes");
677 llSetTimerEvent(0); // Stop the timer from being called repeatedly
678 }
679
680 sensor(integer nr)
681 { // Here is where all people found in its vincinity are returned.
682 // first we make sure the scanner is active before we continue
683 if(gIntActive == 1)
684 {
685 integer i;
686 do{
687 integer found = FALSE;
688 if(gIntGroupSet == 1)
689 {
691 {
692 found = TRUE;
693 }
694 }
695 string vNameTest = llGetUsername(llDetectedKey(i));
696
697 // we scan through the list of names to see if this person is whitelisted
698 if(~llListFindList(gLstIgnore,[vNameTest])){
699 found = TRUE;
700 }
701 /* for (j = 0; j < llGetListLength(gLstIgnore); ++j)
702 {
703 if(llList2String(gLstIgnore, j) == vNameTest){
704 // they are in in the white list
705 found = TRUE;
706 }
707 } */
708 // verify the avi is on our parcel
709 vector pos = llDetectedPos(i);
710 string pname = parcelName(pos);
711 if(pname == gParcelName)
712 {
713 gIntVectorX = 1;
714 }
715 if(found == FALSE && gIntVectorX == 1 && llOverMyLand(llDetectedKey(i)) && (llDetectedKey(i) != llGetOwner())) // When the person has not been found we start to check if this person is on our land. And on popuar reques we will never kick the owner
716 {
717 if(~llListFindList(gLstEjectR, [vNameTest]))
718 {
719 integer index = llListFindList(gLstEjectR, [vNameTest]);
720 integer BOOT_TIME_TEST = llList2Integer(gLstEjectR, index + 1);
721 integer BOOT_TIME = llGetUnixTime();
722 integer timetest = (BOOT_TIME - BOOT_TIME_TEST);
723 if(timetest <= gIntBanTime )
724 {
725 llInstantMessage(llDetectedKey(i), "You are on private property. This is the second time you have been detected. If you are detected again you will be teleported home with no warning!"); // Let's notify this user that he has a few seconds to leave
727 {
728 llInstantMessage(llDetectedKey(i), "GOODBYE!");
729 llInstantMessage(llGetOwner(), "Ejecting from our home: "+ vNameTest);
731 gLstBan = gLstBan + [vNameTest, llGetUnixTime()];
732 gLstEjectR = llDeleteSubList(gLstEjectR,index,index + 1 );
733 }
734 }
735 if(timetest >= gIntBanTime )
736 {
737 gLstEjectR = llDeleteSubList(gLstEjectR,index,index + 1 );
738 }
739 if(llGetListLength(gLstEjectR) > gIntEject_LstLen)
740 {
741 gLstEjectR = llDeleteSubList(gLstEjectR, 0, 1 );
742 }
743 }
744 else if(~llListFindList(gLstBan, [vNameTest]))
745 {
746 integer index = llListFindList(gLstBan, [vNameTest]);
747 integer BOOT_TIME_TEST = llList2Integer(gLstBan, index + 1);
748 integer BOOT_TIME = llGetUnixTime();
749 integer timetest = (BOOT_TIME - BOOT_TIME_TEST);
750 if(timetest <= gIntBanTime )
751 {
752 llInstantMessage(llDetectedKey(i), "You have been twice ejected recently. Ejecting Home!");
754 llInstantMessage(llGetOwner(), "Ejecting from our home: "+vNameTest + ". Ejected within the last hour. No warning");
755 }
756 if(timetest >= gIntBanTime )
757 {
758 gLstBan = llDeleteSubList(gLstBan,index,index + 1 );
759 }
760 // auto purge
761 if(llGetListLength(gLstBan) > gIntEject_LstLen)
762 {
763 gLstBan = llDeleteSubList(gLstBan, 0, 1 );
764 }
765 }
766 else
767 {
768 // let's notify this user that they have a few seconds to leave
769 llInstantMessage(llDetectedKey(i), "You are on private property. You will be ejected from this parcel in " + gStrWarnTime + " seconds.");
770 // wait the time we gave them to leave
771 llSleep(gFltWarnTime);
772 if(llOverMyLand(llDetectedKey(i))) // Ok let's see if they have left.
773 { // if they are still on lets say BYE to them, and tell the owner someone is kicked off the land
774 llInstantMessage(llDetectedKey(i), "GOODBYE!");
775 llInstantMessage(llGetOwner(), "Ejecting from our home: "+vNameTest);
776 // and finaly we really kick them off
778 gLstEjectR = gLstEjectR + [vNameTest, llGetUnixTime()];
779 if(~llListFindList(gLstEjected, [vNameTest]))
780 {
781 return; // already in the ejected list so exit
782 }
783 else
784 {
785 gLstEjected = gLstEjected + vNameTest;
786 }
787 }
788 // auto purge
789 if(llGetListLength(gLstEjected) > gIntEject_LstLen)
790 {
791 gLstEjected = llDeleteSubList(gLstEjected, 0, 1 );
792 }
793 }
794 }
795 }while((++i) < nr);
796 }
797 }
798
799 on_rez (integer startup)
800 {
802 }
803 }

Mango_Wylders_Security_Orb

Usage and instructions

Category: Security
By : mangowylder
Created: 2012-09-10 Edited: 2012-09-10
Worlds: Second Life

1 Mango Wylder's Security Orb
2
3 Heavily modified version of Security Orb script found here
4 http://www.free-lsl-scripts.com/cgi/freescripts.plx?ID=1119
5
6 There is a major problem with this script.
7 It uses llSleep when an avi is detected.
8 Why is this a problem?
9 Well if you invite someone to your parcel and they are not allowed,
10 you can't do anything with the scanner once the avi is detected during the Warn Time period (sleep time)
11 i.e You can't turn it off for example.
12 The Avi will get booted then you will have to have to make changes to the Security Orb to
13 allow the visitor.
14 You might ask why not just use a timer?
15 I'm using the timer to ensure no stray listens and to prevent writing to the wrong list in the
16 event of no user input.
17 I'm working on a major rewrite but for now it is what it is :)
18
19 Dialog Menu driven
20 Input is on chat channel /7
21 Avatar names are case sensitive
22
23 Features and Functions
24 - Multi-level code checking to ensure your neighbors won't be ejected regardless of how high the scanner range is set.
25 - Allows for up to 6 Administrators
26 - Allows for up to 25 ejected avis to be logged. When this limit is reached the newest ejected avi will be logged and the first ejected avi will be deleted from the
27
28 list. This limit is imposed to keep memory usage down.
29 - Allows for up to 25 in the white list for the same reason as stated above. When this limit is reached you will be notified that if you want to add another avi you
30
31 will have to delete one from the White List first.
32 - Ability for Owner/Admins to set ban time, warning time and scanner range and scan time interval. Ban time is set in hours. Warn time is set in seconds. Scan time
33
34 interval is set in seconds - Suggested time is between 10 and 60 seconds.
35 Scanner range is set in meters up to 96 meters.
36 - Turn scanner On/Off
37 - Scanner Status reports On/Off, current scanner range, current warning time current ban time and current scanner rate.
38 - Group Mode Protection On/Off. When on, any avi with the same active group as the security console will be ignored by the scanner.
39 - Add/Del White list - Owner/Admins
40 - Add/Del Admins - Owner Only
41 - Admins are auto added to White list and are displayed with Show White.
42 - Admins can't delete other Admins or owner from either the White list or Admin list. Only the owner can do this. If they try they will get a warning.
43 - Owner is IM'd when an avi is ejected.
44 - Ejected avis are logged with a llDialog menu to report who has been ejected.
45 - Allows for Owner/Admins to add an avi that was previously ejected to the White list or Admin list, automatically removing them from ejected list and the ejected
46
47 BanTime list.
48 - SetBanTime - Set Ban Time in hours. Adds avi's name to Ejected BanTime list based upon conditions listed below.
49 - If ejected avi tries to return they within BanTime they will be ejected again with a warning if they return again they will be teleported home with no warning.
50 - Options to show the Ejected list and remove avi's from the Ejected list or purge the Ejected list completely.
51 - Ejected BanTime list is self cleaning, i.e. if the avi returns after BanTime setting they will be automatically removed from the Ejected BanTime list. They will
52
53 remain in the ejected list though.
54 - ShowBan Shows avi's that have been ejected during the BanTime setting
55 - PurgeBan - Purges all Avi's that have exceeded the Ban Time setting from the Ejected BanTime list. If Avi hasn't exceeded the BanTime setting they will remain in the
56
57 BanTime list unless they are added to the White List or Admin list in which case they will be purged from Ejected BanTime List and Ejected list.
58 - DELBan - Purges the Ban list completely
59
60 - There is a 20 second timer to make changes.
61
62 If land is group owned you will need to deed the Security Orb to the group. To deed the object to the group you will need to wearing the group tag that you want it
63
64 deeded to. Then right click on the object and select edit. Click Group Set and select the group that is the same group tag you have active. This group must be the
65
66 group that the land is deeded to. Select the group and click ok. Next click Share with Group. The Deed button should turn active blue. Click on the Deed button and
67
68 you are done.
69
70 If the land is privately owned and you want group protection, here is how you will need to activate it. Right click on the object and select edit. Click Group Set and
71
72 select the group that is the same group tag you have active. Now once you enable Group Mode protection the scanner will ignore anyone that has the same active tag that
73
74 you set the scanner to. There is no need to Deed the object to the group in this case.
75
76 --Glossary--
77 - Scan Range is the range the scanner will sweep to detect avatars from 1 meter to 96 meters.
78 - Scan Rate is the interval between sweeps. Recommend setting the scan rate between 5 and 60 seconds.
79 - Warn Time is the time in seconds that the avatar will have to leave before they get ejected after they are detected by the scanner. Recommend setting the Warn Time
80
81 is between 5 and 60 seconds.
82 - Ban Time is the time in hours that an avatar once ejected will be ejected again with no warning if they return within Ban Time. I.e. there will be no Warn Time.

Back to the Best Free Tools in Second Life and OpenSim.