Untitled

 avatar
unknown
plain_text
2 years ago
1.6 kB
5
Indexable
list admins = ["7405e11e-67d8-4ac7-ad98-e9e90316e2e4", "559f590e-7016-4273-ba0d-6d8b6b7c0516", "ba2e1323-4dae-4076-8762-d7bc2317e2f6"]; //Paradox, Iskorka, ObiAi

integer take_counter;
unpack() 
{
        list    InventoryList;
        integer count = llGetInventoryNumber(INVENTORY_ALL);  // Count of all items in prim's contents
        string  ItemName;
        while (count--)
        {
            ItemName = llGetInventoryName(INVENTORY_ALL, count);
            if (ItemName != llGetScriptName() )  
                InventoryList += ItemName;   // add all contents except this script, to a list
        }
        // Give all the items to the toucher, in a folder named as per this prim's name
        llGiveInventoryList(llDetectedKey(0), "Objects" , InventoryList);
}

default
{
    state_entry()
    {        
        llSetTimerEvent(0.05);
        take_counter = (integer) llGetObjectDesc();
    }
    
    touch_start(integer total_number)
    {
        integer isAdmin = (llListFindList(admins, [(string) llDetectedKey(0)]) != -1);       
        if (isAdmin == FALSE && llSameGroup(llDetectedKey(0)) == TRUE)
        {
            unpack();
            take_counter += 1;
        }
        if (isAdmin == TRUE && llSameGroup(llDetectedKey(0)) == TRUE)
        {
            llSay (0, "The gift was taken " + (string) take_counter + " times.");
            
            if (llGetTime() < 1.0) //Click
            {
                unpack();  
            }
        }
    }
    
    touch_end(integer num_detected)
    {
        llResetTime();    //For click
    }

}
Editor is loading...
Leave a Comment