Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

how do i set up vender that only sells to group

RacerX Gullwing
Magic Rabbit
Join date: 18 Jun 2004
Posts: 371
06-13-2006 07:46
how do I add a only for sale if in the same group as this is set to?
if (llSameGroup(llDetectedKey(0)))
{

CODE

integer price;

resetscript()
{
llResetScript();
}



default
{
state_entry()
{
llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
}
run_time_permissions(integer perm)
{
if(perm & PERMISSION_DEBIT)
{

state setprice;
}

}
on_rez(integer pop)
{
resetscript();
}
}

state setprice
{
state_entry()
{
llInstantMessage(llGetOwner(),"set the description of this prim to the price then touch it");
}
touch(integer pop)
{

if (llSameGroup(llDetectedKey(0)))
{
price = (integer)llGetObjectDesc();
llInstantMessage(llGetOwner(),"price set to "+(string)llGetObjectDesc());
state now_excepting_cash;
{

}}}}

state now_excepting_cash
{
state_entry()
{
llSay(0,"open");

price = (integer)llGetObjectDesc();
}

money(key id, integer amount)
{
// how do I add a only for sale if in the same group as this is set to?
// if (llSameGroup(llDetectedKey(0)))
// {
llSay(0,"same group");
price = (integer)llGetObjectDesc();
if(amount >= price)
{
if(amount - price > 0)
{
llGiveMoney(id, (amount - price));
llInstantMessage(id, "heres your change"+(string)(amount - price));
}

llGiveInventory(id,"thing thats inside it");

}
else
{
llGiveMoney(id, amount);
llInstantMessage(id, "Price is L$" + (string)price);
}
}
}

_____________________
Burke Prefect
Cafe Owner, Superhero
Join date: 29 Oct 2004
Posts: 2,785
06-13-2006 07:50
I'm not sure if Money uses DetectedKey.
Try llSameGroup(id) instead on the Money event.

http://secondlife.com/badgeo/wakka.php?wakka=money
_____________________
Sheila Plunkett
On The Prowl!
Join date: 25 Dec 2005
Posts: 67
06-13-2006 07:54
That requires the object to belong to the same group as the group from which you want people to buy:

http://secondlife.com/badgeo/wakka.php?wakka=llDetectedGroup
( http://secondlife.com/badgeo/wakka.php?wakka=llSameGroup is similar, but does need the AV to have tht group ACTIVE.)

Maybe there's another way, but that's all I can think of atm.

*mew*
Sheila.
Michael Martinez
Don't poke me!
Join date: 28 Jul 2004
Posts: 515
06-13-2006 08:53
You have the key of the payer from the Money event..

So do llSameGroup (id)...and DetectedKey(0) does not work from a money event, but you got the key passed to you anyways, so don't need it.
_____________________
There are no significant bugs in our released software that any significant number of users want fixed. (Bill Gates)