Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

One Time Freebie Vendor

Desiree Bisiani
Furniture Designer
Join date: 25 Nov 2006
Posts: 189
10-12-2008 13:14
Hello all,

I am qute new to scripting and am trying to figure out how to make a freebie vendor that will only allow a given avatar to take one freebie. This is what I have so far...I can't get the syntax quite right and it still is giving multiple items. Any assistance would be much appreciated!

CODE

list before;
default
{
touch_start(integer total_number)
{
if(llListFindList(before,[llDetectedKey(0)]) != -1)
{
llSay(0,"Youve already had your free gift!");
}
if(llListFindList(before,[llDetectedKey(0)]) == -1)
{
before += llDetectedKey(0);
llSay(0,"Here is your free gift!");
{
llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_OBJECT,0));

}

}
}
_____________________
**************************************

http://slurl.com/secondlife/Lux%20Prometheus/139/47/307/
www.ambianceinteractive.wordpress.com/
Very Keynes
LSL is a Virus
Join date: 6 May 2006
Posts: 484
10-12-2008 13:44
Try this

CODE

list before;
default
{
touch_start(integer total_number)
{
if(llListFindList(before,[llDetectedKey(0)]) == -1)
{
before += llDetectedKey(0);
llSay(0,"Here is your free gift!");
llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_OBJECT,0));
}
else llSay(0,"Youve already had your free gift!");
}
}
Desiree Bisiani
Furniture Designer
Join date: 25 Nov 2006
Posts: 189
10-12-2008 13:47
That worked like a charm! Thanks so much!
_____________________
**************************************

http://slurl.com/secondlife/Lux%20Prometheus/139/47/307/
www.ambianceinteractive.wordpress.com/