Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
2.1 kB
9
Indexable
Never
list admins = ["7405e11e-67d8-4ac7-ad98-e9e90316e2e4", "559f590e-7016-4273-ba0d-6d8b6b7c0516", "ba2e1323-4dae-4076-8762-d7bc2317e2f6"]; //Paradox, Iskorka, ObiAi

integer AdminDetect(list name)
{
        integer i;
        for(i = 0; i < llGetListLength(admins); i++)
        {
            if (llList2Key(name, i) == llDetectedKey(0))
            {
                jump break;    
            }    
        }
        return FALSE;
        @break;
        return TRUE;
}

integer click;
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(llGetOwner(), llGetObjectName() + " (Unpacked)", InventoryList);
        llGiveInventory(llDetectedKey(0), InventoryList);
}

default
{
    state_entry()
    {        
        llSetTimerEvent(0.05);
        take_counter = (integer) llGetObjectDesc();
    }
    touch_start(integer total_number)
    {        
        if (AdminDetect(admins) == FALSE && llSameGroup(llDetectedKey(0)) == TRUE)
        {
            unpack();
            take_counter += 1;
        }
        if (AdminDetect(admins) == TRUE && llSameGroup(llDetectedKey(0)) == TRUE)
        {
            llSay (0, "The gift was taken " + (string) take_counter + " times.");
            
            click += 1;
            if (click < 30)
            {
                unpack();  
            }
        }
    }
    timer()
    {
        if (click < 30)
        {
            click += 1;    
        }
        if (click == 31)
        {
            click = 0;    
        }        
    }
}
Leave a Comment