08-27-2006 09:38
Hi, Im trying to set up a voucher for the store but the script below is meant to work only when the owner of the obect clicks it.
Its currently allowing my alt to gain access to the voucher contents too.

I have a board with 2 primmed vouchers attached they ppl can buy a copy of. Its no mod/copy.
Inside then primmed voucher is a notecard and LM attached with instructions and this script.
Th problem is, anyone can click the primmed vouchers on display and they get a copy of all the contents
Im not a scripter, but could anyone tell me what I need to change to make it recognise the new owner as one person buys the voucher then gives it to their freind so THEN they friend can click it and recieve the contents?

I appreciate your help and heres the script:
*******************************************************************



integer owneronly = 0;
key owner;

default
{
state_entry()
{
owner = llGetOwner();
}

touch_start(integer total_number)
{
integer i;
for (i=0;i<total_number;i++)
{
key target = llDetectedKey(i);

if ( (target != owner) && (owneronly == 1) )
{
llInstantMessage(target,"Sorry, only the owner is allowed to get my contents.";);
return;
}
list inventory_types = [INVENTORY_BODYPART,INVENTORY_CLOTHING,INVENTORY_LANDMARK,INVENTORY_NOTECARD,INVENTORY_OBJECT,INVENTORY_SCRIPT,INVENTORY_SOUND,INVENTORY_TEXTURE];
integer inventory_count = llGetListLength(inventory_types);
integer j;
integer k;
integer type;
integer typecount;
string myname = llGetScriptName();
string objectname;

for (j=0; j<inventory_count;j++)
{
type = llList2Integer(inventory_types,j);
typecount = llGetInventoryNumber(type);
if (typecount > 0)
{
for (k=0; k<typecount;k++)
{
objectname = llGetInventoryName(type,k);
if (objectname != myname)
{
llGiveInventory(target,objectname);
}
}
}
}
}
}
}
************************************************************************
_____________________


TRU Graphic Solutions Ltd
In Association with:
3DTotal.com - SubdimensionStudios.com - AmbientLight.co.uk - Jaguarwoman.com -Texturama.com - Fifond.com - 3DRender.co.uk

Over 80 SL freelance texture artist supplying Premium seamless textures to SL Since 2004

Visit TRU Website:
http://www.texturesrus.net