Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Inventory Giver Give_Item_Once__IM  

Give_Item_Once__IM

Give Item Once - IM.lsl

Category: Inventory Giver
By : Anonymous
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for Give_Item_Once__IM
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Give_Item_Once__IM_1.lsl
1
2 integer owneronly = 0;
3 key owner;
4
5 list people;
6
7 // Functions
8 integer isNameOnList( string name )
9 {
10 integer len = llGetListLength( people );
11 integer i;
12 for( i = 0; i < len; i++ )
13 {
14 if( llList2String(people, i) == name )
15 {
16 return TRUE;
17 }
18 }
19 return FALSE;
20 }
21
22
23
24 default
25 {
27 {
28 owner = llGetOwner();
29 }
30
31 touch_start(integer total_number)
32 {
33 integer i;
34 for (i=0;i<total_number;i++)
35 {
36 key target = llDetectedKey(i);
37
38 if( (target != owner) && (owneronly == 1) ) // person clicking isn't owner and owneronly is set;
39 {
40 llInstantMessage(target,"Sorry, only the owner is allowed to get my contents.");
41 return;
42 }
44 integer inventory_count = llGetListLength(inventory_types);
45 integer j;
46 integer k;
47 integer type;
48 integer typecount;
49 string myname = llGetScriptName();
50 string objectname;
51
52 string name = llKey2Name(target);
53
54 if(isNameOnList( name ))
55 {
56 llSay(0,"Sorry, only one per avatar");
57 return;
58 }
59 llInstantMessage(owner, name + " found " + llGetObjectName( ));
60 people += name;
61 for (j=0; j<inventory_count;j++)
62 {
63 type = llList2Integer(inventory_types,j); // get the next inventory type from the list
64 typecount = llGetInventoryNumber(type); // how many of that kind of inventory is in the box?
65 if(typecount > 0)
66 {
67 for (k=0; k<typecount;k++)
68 {
69 objectname = llGetInventoryName(type,k);
70 if(objectname != myname) // don't give self out so the user doesn't get fifty thousand copies.
71 {
72
73 llGiveInventory(target,objectname);
74 llRemoveInventory( objectname);
75
76 }
77 }
78 }
79 }
80 }
81 }
82 }
83 // END //

Back to the Best Free Tools in Second Life and OpenSim.