Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

3 way $L money split

Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
11-11-2007 06:40
i have a money split script, and i was wondering if it would be posible to do a 3 way money split on it, im sure there is a way, and im not to good with money/vendor type of scripts, anyone know a way on how to make one? if you think you can make one or edit one that i have, can someone im me in game, should be on almost all day, dont realy wont to put it on forums here
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
11-11-2007 14:06
post the script if you can
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
11-11-2007 14:51
CODE

key splitkey;
key amountkey;
key percentagekey;

integer Bsplit = FALSE;
integer Bamount = FALSE;
integer Bpercentage = FALSE;

integer amount;
integer percentage;
key secondowner;


default
{
on_rez(integer param)
{
llResetScript();
}

state_entry()
{
splitkey = llGetNotecardLine("split",0);
amountkey = llGetNotecardLine("split",1);
percentagekey = llGetNotecardLine("split",2);

}

dataserver(key queryid, string data)
{
if (queryid == splitkey)
{
secondowner = (key) data;
llOwnerSay("Secondkey: "+data+" name is: "+ llKey2Name(secondowner));
Bsplit = TRUE;
}

if (queryid == amountkey)
{
amount = (integer) data;
llOwnerSay("Amount for sale is set to: "+data);
Bamount = TRUE;
}

if (queryid == percentagekey)
{
percentage = (integer) data;
llOwnerSay("Split % is set to: "+data);
Bpercentage = TRUE;
}


if (Bamount && Bsplit && Bpercentage)
{
state rights;
}

}
}

state rights
{
state_entry()
{
llOwnerSay("Request rights state entered");
llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
}

on_rez(integer param)
{
llResetScript();
}

touch_start(integer num)
{
if (llDetectedKey(0) == llGetOwner())
{
llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
}
}

run_time_permissions(integer perms)
{
if (perms == PERMISSION_DEBIT)
{
state activated;
} else
{
llOwnerSay("Debit permission is needed for this script to work. Please touch the prim to be asked for them again");
}
}
}

state activated
{
state_entry()
{
llOwnerSay("Money split script activated");
llSetPayPrice(PAY_HIDE, [amount, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
}

money(key id, integer payed)
{
if (payed != amount)
{
llGiveMoney(id, payed);
return;
}

llGiveInventory(id,llGetInventoryName(INVENTORY_OBJECT, 0));

integer share = llRound((payed * percentage) / 100);

llInstantMessage(secondowner, llKey2Name(id)+" bought from this split vendor sending you your share");
llGiveMoney(secondowner, share);
}


}