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 = buttons; list 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 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 = 1; integer gIntScanTime; integer gIntSwitch; integer gIntRegionAgentCount; integer menuindex = 0; float agelimit=60; string surl; string squeryBorn; list gLstConfig; list gLstPeopleHere; list gLstGridBanList; list gLstBanListIP; list gLstBanListKeys; list gLstBanListName; list gLstWhiteList; list gLstLogList; list buttons = ["On", "Off", "Reset", "Ban by", "Setup"]; list buttons2 = ["Radar", "Name", "Key", "IP Address", "Grid"]; list buttons3 = ["Max Scripts", "Min Height", "Min Age", "Max Height", "Send To", "Script Mem", "Scan Time"]; list gLstButtons; string gStrSendTo ; vector LandingPoint = <128,128,50>; vector LookAt = <0,1,0>; key gKyOid; key kDetect; key kyThisAgent; string url; list lhttp_request; string fnStringTrim(string src) { string myTrimmedText = llDumpList2String(llParseString2List(src, [" "], []), " "); return myTrimmedText; } fnExileAgent(key kyThisAgent) { llAddToLandBanList(kyThisAgent,0); llTeleportAgentHome(kyThisAgent); osTeleportAgent(kyThisAgent,gStrSendTo,LandingPoint,LookAt); llEjectFromLand(kyThisAgent); } fnWriteConfig() { integer intInvNum = llGetInventoryNumber(INVENTORY_NOTECARD); if (intInvNum != 0) { // llSay(0,llDumpList2String(gLstConfig,"")); integer intCount; for (intCount = 0; intCount < intInvNum;intCount ++) { if (llGetInventoryName(INVENTORY_NOTECARD, intCount) == "autoConfig") { llRemoveInventory("autoConfig"); } } osMakeNotecard("autoConfig", gLstConfig); } } fnWriteBanListGrid() { integer intInvNum = llGetInventoryNumber(INVENTORY_NOTECARD); if (intInvNum != 0) { integer intCount; for (intCount = 0; intCount < intInvNum;intCount ++) { if (llGetInventoryName(INVENTORY_NOTECARD, intCount) == "banlistgrid") { llRemoveInventory("banlistgrid"); } } osMakeNotecard("banlistgrid", gLstGridBanList); } } fnWriteBanListIP() { integer intInvNum = llGetInventoryNumber(INVENTORY_NOTECARD); if (intInvNum != 0) { integer intCount; for (intCount = 0; intCount < intInvNum;intCount++) { if (llGetInventoryName(INVENTORY_NOTECARD, intCount) == "banlistip") { llRemoveInventory("banlistip"); } } osMakeNotecard("banlistip", gLstBanListIP); } } fnWriteBanListName() { integer intInvNum = llGetInventoryNumber(INVENTORY_NOTECARD); if (intInvNum != 0) { integer intCount; for (intCount = 0; intCount < intInvNum;intCount++) { if (llGetInventoryName(INVENTORY_NOTECARD, intCount) == "banlistname") { llRemoveInventory("banlistname"); } } osMakeNotecard("banlistname", gLstBanListName); } } fnWriteBanListKey() { integer intInvNum = llGetInventoryNumber(INVENTORY_NOTECARD); if (intInvNum != 0) { integer intCount; for (intCount = 0; intCount < intInvNum;intCount++) { if (llGetInventoryName(INVENTORY_NOTECARD, intCount) == "banlistkey") { llRemoveInventory("banlistkey"); } } osMakeNotecard("banlistkey", gLstBanListKeys); } } fnWriteLog() { integer intInvNum = llGetInventoryNumber(INVENTORY_NOTECARD); if (intInvNum != 0) { integer intCount; for (intCount = 0; intCount < intInvNum;intCount++) { if (llGetInventoryName(INVENTORY_NOTECARD, intCount) == "log") { llRemoveInventory("log"); } } osMakeNotecard("log", gLstLogList); } } fnPopulateConfigList() { gLstConfig = []; if (llGetInventoryType("autoConfig") == -1) { gLstConfig = [4,140,180,25,"hg.osgrid.org:80:Lbsa Plaza",400000,5]; osMakeNotecard("autoConfig", gLstConfig); } integer intInvNum = llGetInventoryNumber(INVENTORY_NOTECARD); if (intInvNum != 0) { integer intCount; for (intCount = 0; intCount < intInvNum;intCount++) { if (llGetInventoryName(INVENTORY_NOTECARD, intCount) == "autoConfig") { string notecard = "autoConfig"; integer intNCLength; intNCLength=osGetNumberOfNotecardLines(notecard); integer q; for ( q=0;q (float)gIntMaxHeight) { llInstantMessage(gKyOid, strThisAgent + " was height banned too tall at: " + (string)size.z); llInstantMessage(kyThisAgent,"\n You were banned for being too tall at: " + (string)size.z); gLstLogList = gLstLogList + strThisAgent + " was height banned too tall at: " + (string)size.z; fnWriteLog(); fnExileAgent(kyThisAgent); } } } //********************************************************************** // Running too many scripts? list lstScriptData = llGetObjectDetails(kyThisAgent, [OBJECT_RUNNING_SCRIPT_COUNT, OBJECT_SCRIPT_MEMORY]); integer intNumScripts = llList2Integer(lstScriptData,0); if (0 < gIntMaxScriptNum && intNumScripts > gIntMaxScriptNum) { llInstantMessage(gKyOid, strThisAgent + " was running " + (string)intNumScripts + " scripts and was banned."); gLstLogList = 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 = llList2Integer(lstScriptData,1); if (0 < gIntMaxScriptMem && intScriptMem > gIntMaxScriptMem) { llInstantMessage(gKyOid, strThisAgent + " was using " + (string)intScriptMem + " bytes of ram and was banned."); gLstLogList = 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 = llGetAgentInfo(kyThisAgent); if ((intFlyCheck & AGENT_FLYING) && (gIntOkFly == 0)) { llInstantMessage(gKyOid, strThisAgent + " was flying and it's not allowed and was banned."); gLstLogList = 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 = llParseString2List(input, ["-"],[]); integer Y = (integer)llList2String(l,0); integer M = (integer)llList2String(l,1); integer D = (integer)llList2String(l,2); if(M==1 || M==2) { --Y; M+=12; } integer A = Y/100; integer B = A/4; integer C = 2-A-B; //(or C=0 if you're using the Julian calendar) float E = 365.25*(Y+4716); float F = 30.6001*(M+1); integer age = C+D+(integer)E+(integer)F-1524; //llOwnerSay("Julian Day = "+(string)age ); 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(); } if (CHANGED_INVENTORY & c & gIntSwitch) { llResetScript(); } } state_entry() { gKyOid = llGetOwner(); gStrSendTo = llGetObjectDesc(); fnInit(); } touch_start(integer p) { if (llDetectedKey(0) == gKyOid) { llSetTimerEvent(120); gIntListenHandle = llListen(5000, "", "", ""); DialogPlus (gKyOid, "Main Controls", buttons, 5000,0); } else { llInstantMessage(gKyOid,llKey2Name(llDetectedKey(0)) + " is messing with your security orb. "); } } dataserver(key queryid, string data) { //check to see if agent is below minimum age. // llSay(0, "You were born on: " + data); integer age = f_daysSince(data); if (age < gIntMinAge) { llInstantMessage(gKyOid, llKey2Name(kyThisAgent) + " is " + (string)age + " days old and was banned."); gLstLogList = gLstLogList + llKey2Name(kyThisAgent) + " 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"+(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=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)) { llInstantMessage(gKyOid, llKey2Name(kyThisAgent) + " is " + (string)age + " days old and was banned."); gLstLogList = gLstLogList + llKey2Name(kyThisAgent) + " is " + (string)age + " days old and was banned."; llInstantMessage(kyThisAgent,"\n You have been banned. You must be " + (string)gIntMinAge); fnWriteLog(); fnExileAgent(kyThisAgent); } } if(!llGetListLength(lhttp_request)) { llResetScript(); } } listen(integer channel, string name, key id, string message) { if (channel == 3000) { string 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"); } if (message == "On") { gIntSwitch = 1; llSetTimerEvent(gIntScanTime); llSetText("Overwatch Sentry Server ON",<1,0,0>,1.0); llSetColor (<1,0,0>,0); llOwnerSay("On"); fnInit(); llMessageLinked(LINK_SET, 0, "on", "on"); } } else if (channel == 7000) { gLstBanListName = gLstBanListName + [message]; fnWriteBanListName(); } else if (channel == 8000) { gLstBanListIP = gLstBanListIP + [message]; fnWriteBanListIP(); } else if (channel == 9000) { gLstBanListKeys = gLstBanListKeys + [message]; fnWriteBanListKey(); } else if (channel == 10000) { gLstGridBanList = 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, ""); } 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, ""); } 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, ""); } if (message == "Max Scripts") { llTextBox(gKyOid,"Please Enter Max Num of Scripts.\n Current Value: "+(string)gIntMaxScriptNum, 18000); gIntListenHandle18 = llListen( 18000, "",gKyOid, ""); } if (message == "Send To") { llTextBox(gKyOid,"Where To Send Bandits? ex: hg.osgrid.org:8002\n Current: "+gStrSendTo,19000); gIntListenHandle19 = llListen( 19000, "",gKyOid, ""); } if (message == "Script Mem") { llTextBox(gKyOid,"How Much Memory Agent Can Use? ex: 400000\n Current Value: "+gIntMaxScriptMem,20000); gIntListenHandle20 = llListen( 20000, "", gKyOid, ""); } 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); } if (gIntListenHandle2) { llListenRemove(gIntListenHandle2); } if (gIntListenHandle3) { llListenRemove(gIntListenHandle3); } if (gIntListenHandle7) { llListenRemove(gIntListenHandle7); } if (gIntListenHandle8) { llListenRemove(gIntListenHandle8); } if (gIntListenHandle9) { llListenRemove(gIntListenHandle9); } if (gIntListenHandle10) { llListenRemove(gIntListenHandle10); } if (gIntListenHandle12) { llListenRemove(gIntListenHandle12); } if (gIntListenHandle15) { llListenRemove(gIntListenHandle15); } if (gIntListenHandle16) { llListenRemove(gIntListenHandle16); } if (gIntListenHandle17) { llListenRemove(gIntListenHandle17); } if (gIntListenHandle18) { llListenRemove(gIntListenHandle18); } if (gIntListenHandle19) { llListenRemove(gIntListenHandle19); } if (gIntListenHandle20) { llListenRemove(gIntListenHandle20); } if (gIntListenHandle21) { llListenRemove(gIntListenHandle21); } } }