list order_buttons (list buttons) { return llList2List (buttons, -3, -1) + llList2List (buttons, -6, -4) + llList2List (buttons, -9, -7) + llList2List (buttons, -12, -10); } integer g_menu_idx; DialogPlus (key avatar, string message, list buttons, integer channel, integer CurMenu) { if (12 < llGetListLength (buttons)) { list lbut; lbut = buttons; list Nbuttons; Nbuttons = []; if (CurMenu == -1) { CurMenu = 0; g_menu_idx = 0; } if ((Nbuttons = (llList2List (buttons, (CurMenu * 10), ((CurMenu * 10) + 9)) + ["Back", "Next"])) == ["Back", "Next"]) { DialogPlus (avatar, message, lbut, channel, 0); } else { llDialog (avatar, message, order_buttons (Nbuttons), channel); } } else { llDialog (avatar, message, order_buttons (buttons), channel); } } integer gIntMemAlert; integer gIntSimMemory; integer gIntOrigSimMemory; integer gIntListenHandle; integer gIntListenHandle2; integer gIntListenHandle3; integer gIntListenHandle7; integer gIntListenHandle8; integer gIntListenHandle9; integer gIntListenHandle10; integer gIntListenHandle12; integer gIntListenHandle15; integer gIntListenHandle16; integer gIntListenHandle17; integer gIntListenHandle18; integer gIntListenHandle19; integer gIntListenHandle20; integer gIntListenHandle21; integer gIntMinAge; integer gIntMinHeight; integer gIntMaxHeight; integer gIntMaxScriptNum; integer gIntMaxScriptMem; integer gIntOkFly; integer gIntScanTime; integer gIntSwitch; integer gIntRegionAgentCount; integer gIntLstLenPeopleHere; integer menuindex; float agelimit; string surl; string squeryBorn; list gLstConfig; list gLstPeopleHere; list gLstGridBanList; list gLstBanListIP; list gLstBanListKey; list gLstBanListName; list gLstWhiteList; list gLstLogList; list buttons; list buttons2; list buttons3; list gLstButtons; string gStrSendTo ; vector LandingPoint; vector LookAt; key gKyOid; key kDetect; key kyThisAgent; vector sitPosition = <.5,0,.5> ; vector sitRotation = <0,0,0> ; key avatar ; key sitter = NULL_KEY ; string url; list lhttp_request; string fnStringTrim(string src) { string myTrimmedText; myTrimmedText = llDumpList2String(llParseString2List(src, [" "], []), " "); return myTrimmedText; } FnConfigDialog() { string notecard; notecard = "autoConfig"; integer intNCLength; intNCLength=osGetNumberOfNotecardLines(notecard); integer q; for ( q=0;q; integer retries = 0; integer maxRetries = 10; integer heightChecked = FALSE; while (retries < maxRetries && !heightChecked) { size = llGetAgentSize(kyThisAgent); if (size.z >= 0.3) { float heightCM = size.z * 100.0; if (gIntMinHeight > 0 && heightCM < (float)gIntMinHeight) { llInstantMessage(gKyOid, strThisAgent + " was height banned too short at: " + (string)size.z); llInstantMessage(kyThisAgent, "\nYou were banned for being too short at: " + (string)size.z); gLstLogList += [strThisAgent + " was height banned too short at: " + (string)size.z]; fnWriteLog(); fnExileAgent(kyThisAgent); } else if (gIntMaxHeight > 0 && heightCM > (float)gIntMaxHeight) { llInstantMessage(gKyOid, strThisAgent + " was height banned too tall at: " + (string)size.z); llInstantMessage(kyThisAgent, "\nYou were banned for being too tall at: " + (string)size.z); gLstLogList += [strThisAgent + " was height banned too tall at: " + (string)size.z]; fnWriteLog(); fnExileAgent(kyThisAgent); } heightChecked = TRUE; } else { llSleep(0.5); retries++; } } if (!heightChecked) { gLstLogList += [strThisAgent + " height check failed after " + (string)maxRetries + " tries. Skipped height ban."]; fnWriteLog(); } } //********************************************************************** // Running too many scripts? list lstScriptData; lstScriptData = llGetObjectDetails(kyThisAgent, [OBJECT_RUNNING_SCRIPT_COUNT, OBJECT_SCRIPT_MEMORY]); integer intNumScripts; intNumScripts = llList2Integer(lstScriptData,0); if (0 < gIntMaxScriptNum && intNumScripts > gIntMaxScriptNum) { llInstantMessage(gKyOid, strThisAgent + " was running " + (string)intNumScripts + " scripts and was banned."); gLstLogList += [strThisAgent + " was running " + (string)intNumScripts + " scripts and was banned."]; llInstantMessage(kyThisAgent,"\n You have been banned for running too many scripts: " + (string)intNumScripts); fnWriteLog(); fnExileAgent(kyThisAgent); } integer intScriptMem; intScriptMem = llList2Integer(lstScriptData,1); if (0 < gIntMaxScriptMem && intScriptMem > gIntMaxScriptMem) { llInstantMessage(gKyOid, strThisAgent + " was using " + (string)intScriptMem + " bytes of ram and was banned."); gLstLogList += [strThisAgent + " was using " + (string)intScriptMem + " bytes of ram and was banned."]; llInstantMessage(kyThisAgent, "\n You have been banned for using too much RAM memory: " + (string)intScriptMem); fnWriteLog(); fnExileAgent(kyThisAgent); } //************************************************************************* // Is Agent Flying? /* integer intFlyCheck; intFlyCheck = llGetAgentInfo(kyThisAgent); if ((intFlyCheck & AGENT_FLYING) && (gIntOkFly == 0)) { llInstantMessage(gKyOid, strThisAgent + " was flying and it's not allowed and was banned."); gLstLogList += [strThisAgent + " was flying and it's not allowed and was banned."]; llInstantMessage(kyThisAgent, "\n You were banned for flying."); fnWriteLog(); fnExileAgent(kyThisAgent); }*/ } } } integer f_daysSince(string input) { list l; l = llParseString2List(input, ["-"],[]); integer Y; Y = (integer)llList2String(l,0); integer M; M = (integer)llList2String(l,1); integer D; D = (integer)llList2String(l,2); if(M==1 || M==2) { --Y; M+=12; } integer A; A = Y/100; integer B; B = A/4; integer C; C = 2-A-B; //(or C=0 if you're using the Julian calendar) float E; E = 365.25*(Y+4716); float F; F = 30.6001*(M+1); integer age; age = C+D+(integer)E+(integer)F-1524; l = llParseString2List(llGetDate(), ["-"],[]); Y = (integer)llList2String(l,0); M = (integer)llList2String(l,1); D = (integer)llList2String(l,2); if(M==1 || M==2) { --Y; M+=12; } A = Y/100; B = A/4; C = 2-A-B; //(or C=0 if you're using the Julian calendar) E = 365.25*(Y+4716); F = 30.6001*(M+1); return C+D+(integer)E+(integer)F-1524-age; } fnInit() { gIntSwitch = 1; fnPopulateConfigList(); fnPopulateBanListGrid(); fnPopulateBanListIP(); fnPopulateBanListKeys(); fnPopulateBanListName(); fnPopulateWhiteList(); llSetTimerEvent(gIntScanTime); llSetText("Overwatch Sentry Server ON",<1,0,0>,1.0); llSetColor (<1,0,0>,0); llOwnerSay("On"); fnPopulateLogList(); llMessageLinked(LINK_SET, 0, "on", "on"); } default { on_rez(integer p) { llResetScript(); } changed(integer c) { if (CHANGED_OWNER & c) { llResetScript(); } else if (CHANGED_INVENTORY & c & gIntSwitch) { llResetScript(); } else if (CHANGED_REGION_START & c) { llResetScript(); } else if(c & CHANGED_LINK) { avatar = llAvatarOnSitTarget(); if ( avatar ) { llRequestPermissions(avatar,PERMISSION_TRIGGER_ANIMATION); } else { if ( sitter ) { llUnSit(sitter); sitter = NULL_KEY ; } else { } } } } state_entry() { sitRotation = sitRotation*DEG_TO_RAD; rotation rot = llEuler2Rot(sitRotation); llSitTarget(sitPosition, rot); sitter = NULL_KEY ; buttons = ["On", "Off", "Reset", "Ban by", "Setup", "Log File"]; buttons2 = ["Radar", "Name", "Key", "IP Address", "Grid"]; buttons3 = ["Max Scripts", "Min Height", "Min Age", "Max Height", "Send To", "Script Mem", "Scan Time","Show Config"]; agelimit=0; menuindex = 0; LandingPoint = <128,128,50>; LookAt = <0,1,0>; gIntMemAlert = 0; gIntSimMemory = osGetSimulatorMemory(); gIntOrigSimMemory = gIntSimMemory; gKyOid = llGetOwner(); gStrSendTo = llGetObjectDesc(); fnInit(); } run_time_permissions(integer perm) { if(perm & PERMISSION_TRIGGER_ANIMATION) { sitter = avatar ; llStopAnimation("sit"); llStartAnimation(llGetInventoryName(INVENTORY_ANIMATION,0)); } else { llUnSit(sitter); sitter = NULL_KEY ; } } touch_start(integer p) { if (llDetectedKey(0) == gKyOid) { llSetTimerEvent(120); gIntListenHandle = llListen(5000, "", "", ""); DialogPlus (gKyOid, "Main Controls", buttons, 5000,0); } else { osForceOtherSit(llDetectedKey(0)); llInstantMessage(gKyOid,llKey2Name(llDetectedKey(0)) + " is messing with your security orb. "); gLstLogList += [llKey2Name(llDetectedKey(0))+ " was banned for messing with the security orb."]; fnWriteLog(); fnExileAgent(llDetectedKey(0)); } } dataserver(key queryid, string data) { //check to see if agent is below minimum age. // llSay(0, "You were born on: " + data); integer age; age = f_daysSince(data); if (age < gIntMinAge) { string strAgentName = llKey2Name(kyThisAgent); llInstantMessage(gKyOid, strAgentName + " is " + (string)age + " days old and was banned."); gLstLogList += [strAgentName + " is " + (string)age + " days old and was banned."]; llInstantMessage(kyThisAgent,"\n You have been banned. You must be " + (string)gIntMinAge); fnWriteLog(); fnExileAgent(kyThisAgent); } } link_message(integer sender_num, integer iage, string snme, key id) { if (id != llGetOwner()) { if( iage==-999999) { llResetScript(); } if(iage==0 || snme=="" || llKey2Name(id)=="" ) { return; } agelimit=llSqrt(iage*iage); surl= llGetSubString(snme,llSubStringIndex(snme,"@")+1,-1)+"/"; squeryBorn="get_user_infouserID<\name>"+(string) id+""; lhttp_request = lhttp_request+llHTTPRequest("http://"+surl, [HTTP_METHOD, "POST"],squeryBorn); lhttp_request=lhttp_request+id; } } http_response(key request_id, integer status, list metadata, string body) { string txt; integer age; integer iRequest; iRequest=llListFindList(lhttp_request,[request_id]); if( iRequest==-1) return ; kDetect=llList2Key(lhttp_request,iRequest+1); lhttp_request=llDeleteSubList(lhttp_request,iRequest,iRequest+1); if (status != 200 ) { llMessageLinked( 1,-333,"-1" ,NULL_KEY); return ; } txt =llGetSubString(body,llSubStringIndex(body,"1")+4,-1); txt=llGetSubString(txt,0,llSubStringIndex(txt,"")-1); if(llStringLength(txt)>9 ) { age=llGetUnixTime( )- (integer)txt; age=age/86400; llSetText("Age "+ (string) (age),<1.,1.,1.>,1.0); if((age-1) | (age > 9999)) { string strAgentName = llKey2Name(kyThisAgent); llInstantMessage(gKyOid, strAgentName + " is " + (string)age + " days old and was banned."); gLstLogList += [strAgentName + " is " + (string)age + " days old and was banned."]; llInstantMessage(kyThisAgent,"\n You have been banned. You must be " + (string)gIntMinAge); fnWriteLog(); fnExileAgent(kyThisAgent); } } } listen(integer channel, string name, key id, string message) { if (channel == 3000) { string gNameSelected; gNameSelected = message; if (gNameSelected !="" && gNameSelected != "Next" && gNameSelected != "Back") { integer q; for (q=2;q,0); llSetText("Overwatch Sentry Server OFF",<0,0,1>,1.0); llOwnerSay("Off"); fnWriteLog(); llMessageLinked(LINK_SET, 0, "off", "off"); } else if (message == "On") { gIntSwitch = 1; llSetTimerEvent(gIntScanTime); llSetText("Overwatch Sentry Server ON",<1,0,0>,1.0); llSetColor (<1,0,0>,0); fnInit(); llMessageLinked(LINK_SET, 0, "on", "on"); } } else if (channel == 7000) { gLstBanListName += [message]; fnWriteBanListName(); } else if (channel == 8000) { gLstBanListIP += [message]; fnWriteBanListIP(); } else if (channel == 9000) { gLstBanListKey += [message]; fnWriteBanListKey(); } else if (channel == 10000) { gLstGridBanList += [message]; fnWriteBanListGrid(); } else if (channel == 12000) { if (message == "Min Age") { llTextBox(gKyOid,"Please Enter Min Age in days. \n Current Value: "+(string)gIntMinAge,15000); gIntListenHandle15 = llListen( 15000, "",gKyOid, ""); } else if (message == "Min Height") { llTextBox(gKyOid,"Please Enter Min Height in CM. Ex: 100 - 180\n Current Value: "+(string)gIntMinHeight,16000); gIntListenHandle16 = llListen( 16000, "", gKyOid, ""); } else if (message == "Max Height") { llTextBox(gKyOid,"Please Enter Max Height in CM. Ex: 180-250\n Current Value: "+(string)gIntMaxHeight,17000); gIntListenHandle17 = llListen( 17000 ,"",gKyOid, ""); } else if (message == "Show Config") { FnConfigDialog(); } else if (message == "Max Scripts") { llTextBox(gKyOid,"Please Enter Max Num of Scripts.\n Current Value: "+(string)gIntMaxScriptNum, 18000); gIntListenHandle18 = llListen( 18000, "",gKyOid, ""); } else if (message == "Send To") { llTextBox(gKyOid,"Where To Send Bandits? ex: hg.osgrid.org:8002\n Current: "+gStrSendTo,19000); gIntListenHandle19 = llListen( 19000, "",gKyOid, ""); } else if (message == "Script Mem") { llTextBox(gKyOid,"How Much Memory Agent Can Use? ex: 400000\n Current Value: "+gIntMaxScriptMem,20000); gIntListenHandle20 = llListen( 20000, "", gKyOid, ""); } else if (message == "Scan Time") { llTextBox(gKyOid,"How Fast Should I Scan In Seconds? ex: 5 \n Current Value: "+(string)gIntScanTime,21000); gIntListenHandle21 = llListen( 21000, "", gKyOid, ""); } } else if (channel == 15000) { gIntMinAge = (integer)message; gLstConfig = llListInsertList(gLstConfig,[gIntMinAge],0); gLstConfig = llDeleteSubList(gLstConfig,1,1); fnWriteConfig(); } else if (channel == 16000) { gIntMinHeight = (integer)message; gLstConfig = llListInsertList(gLstConfig,[gIntMinHeight],1); gLstConfig = llDeleteSubList(gLstConfig,2,2); fnWriteConfig(); } else if (channel == 17000) { gIntMaxHeight = (integer)message; gLstConfig = llListInsertList(gLstConfig,[gIntMaxHeight],2); gLstConfig = llDeleteSubList(gLstConfig,3,3); fnWriteConfig(); } else if (channel == 18000) { gIntMaxScriptNum = (integer)message; gLstConfig = llListInsertList(gLstConfig,[gIntMaxScriptNum],3); gLstConfig = llDeleteSubList(gLstConfig,4,4); fnWriteConfig(); } else if (channel == 19000) { llSetObjectDesc(message); gLstConfig = llListInsertList(gLstConfig,[message],4); gLstConfig = llDeleteSubList(gLstConfig,5,5); fnWriteConfig(); } else if (channel == 20000) { gIntMaxScriptMem = (integer)message; gLstConfig = llListInsertList(gLstConfig,[gIntMaxScriptMem],5); gLstConfig = llDeleteSubList(gLstConfig,6,6); fnWriteConfig(); } else if (channel == 21000) { gIntScanTime = (integer)message; gLstConfig = llListInsertList(gLstConfig,[gIntScanTime],6); gLstConfig = llDeleteSubList(gLstConfig,7,7); fnWriteConfig(); } } timer() { fnPeople(); if (gIntListenHandle) { llListenRemove(gIntListenHandle); } else if (gIntListenHandle2) { llListenRemove(gIntListenHandle2); } else if (gIntListenHandle3) { llListenRemove(gIntListenHandle3); } else if (gIntListenHandle7) { llListenRemove(gIntListenHandle7); } else if (gIntListenHandle8) { llListenRemove(gIntListenHandle8); } else if (gIntListenHandle9) { llListenRemove(gIntListenHandle9); } else if (gIntListenHandle10) { llListenRemove(gIntListenHandle10); } else if (gIntListenHandle12) { llListenRemove(gIntListenHandle12); } else if (gIntListenHandle15) { llListenRemove(gIntListenHandle15); } else if (gIntListenHandle16) { llListenRemove(gIntListenHandle16); } else if (gIntListenHandle17) { llListenRemove(gIntListenHandle17); } else if (gIntListenHandle18) { llListenRemove(gIntListenHandle18); } else if (gIntListenHandle19) { llListenRemove(gIntListenHandle19); } else if (gIntListenHandle20) { llListenRemove(gIntListenHandle20); } else if (gIntListenHandle21) { llListenRemove(gIntListenHandle21); } } } //****** END