Advertisement
Jym_Nova

VisitorList&Counter

Oct 23rd, 2014
548
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Written By: Ĵyм Ѡҩℓƒ (Jym Resident)
  2. /*
  3. LICENCE:
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. any later version.
  8.  
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. GNU General Public License for more details.
  13.  
  14. You should have received a copy of the GNU General Public License
  15. along with this program.  If not, see <http://www.gnu.org/licenses/>.
  16. or you may visit - http://license.idjhost.com/
  17. */
  18. // DESCRIPTION
  19. /*
  20. Free visitor list and counter for all that need or want it
  21. Give it away free full perm and open source but don't sell it!!!
  22. */
  23.  
  24. list visitors;
  25.  
  26. integer IsInList(list data, string name)
  27. {
  28.     integer i;
  29.     for(i=0;i<llGetListLength(data);i++)
  30.     {
  31.         if(llList2String(data,i)==name)
  32.         {
  33.             return TRUE;
  34.         }
  35.     }
  36.     return FALSE;
  37. }
  38.  
  39. TypeOutList()
  40. {
  41.     llOwnerSay("There are "+(string)llGetListLength(visitors)+" names in the visitors list.\nThe names currently in the list are as follows:\n "+llList2CSV(visitors));
  42.     llOwnerSay("You have "+(string)llGetFreeMemory()+" memory free.");
  43. }
  44.  
  45. default
  46. {
  47.     state_entry()
  48.     {
  49.         llSetTimerEvent(15);
  50.     }
  51.     touch_start(integer total_number)
  52.     {
  53.         if(llDetectedKey(0) == llGetOwner())
  54.         {
  55.             TypeOutList();
  56.         }
  57.         /*else if(llDetectedKey(0) == "you can enter a managers UUID here")
  58.         {
  59.             TypeOutList();
  60.         }*/ remove these words and the comment symbols if you want a manager to be able to check the list
  61.     }
  62.     timer()
  63.     {
  64.         list avatarsInRegion = llGetAgentList(AGENT_LIST_PARCEL, []);
  65.         integer numOfAvatars = llGetListLength(avatarsInRegion);
  66.         integer detected;
  67.         integer index;
  68.         integer i;
  69.         if (!numOfAvatars)
  70.         {
  71.             llOwnerSay("No avatars found within the region!");
  72.             return;
  73.         }
  74.         while (index < numOfAvatars)
  75.         {
  76.             key id = llList2Key(avatarsInRegion, index);
  77.             string name = llKey2Name(id);
  78.             if(IsInList(visitors, llKey2Name(id)))
  79.             {
  80.                 //llOwnerSay("Everyone on parcel have already been added.");
  81.             }
  82.             else
  83.             {
  84.                 visitors += llKey2Name(id);
  85.                 llOwnerSay("Added "+(string)name);
  86.             }
  87.             ++index;
  88.         }
  89.     }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement