Advertisement
LethBaumann

llDialog unpacker with group check

May 16th, 2022
1,387
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. integer gListener;
  2. string invobj;
  3.  
  4. default
  5. {
  6.     state_entry()
  7.     {
  8.     }
  9.    
  10.     touch_start(integer total_number)
  11.     {
  12.         key id = llDetectedKey(0);
  13.         llListenRemove(gListener);
  14.         gListener = llListen(-99, "", id, "");
  15.         llDialog(id, "\nWould you like to unpack this?.", ["Yes", "No Thanks" ] , -99);
  16.         llSetTimerEvent(60.0);
  17.     }
  18.    
  19.     listen(integer chan, string name, key id, string msg)
  20.     {
  21.         integer sameGroup = llSameGroup (id);
  22.         invobj = llGetInventoryName (INVENTORY_OBJECT,0);
  23.         if (sameGroup)
  24.         {
  25.             if (msg == "Yes")
  26.             {
  27.                 llGiveInventory (id, llGetInventoryName(INVENTORY_OBJECT, 0));
  28.             }
  29.             if (msg == "No Thanks")
  30.             {
  31.                 //Do Nothing
  32.             }
  33.         }
  34.         else
  35.         {
  36.             llSay(0, "You need to be in the required group to use this.");
  37.         }
  38.  
  39.         llSetTimerEvent(0.1);        
  40.     }
  41.    
  42.     timer()
  43.     {
  44.         llListenRemove(gListener);
  45.         llSetTimerEvent(0.0);
  46.     }
  47. }
Advertisement
RAW Paste Data Copied
Advertisement