07-10-2013, 03:37 PM
Self explaining i guess
Quote:/*
Rekson Profit Spliter
If you need any help with this script or are unsure about anything send me a message on Scaler Rexen and I will gladly assist you.
*/
key owner;
integer pay;
// Change only these items below
key partner="5ffbf977-2cf1-4fd1-b531-102e19147d1b"; // Put the persons key you will want to split the money with.
float split=.5; // .10 is 10% | .20 is 20% | .30 is 30% etc
integer cost=250; // How much does your item cost.
// Do not change anything else unless you know what you're doing.
default
{
on_rez(integer p)
{
if(llDetectedKey(0)!=owner)
{
llResetScript();
}
}
state_entry()
{
owner=llGetOwner();
if(partner!="")
{
float splitAmount=split*100;
if(splitAmount<=100.0)
{
pay=llRound(cost*split);
llSetPayPrice(PAY_HIDE,[cost,PAY_HIDE, PAY_HIDE, PAY_HIDE]);
llRequestPermissions(owner,PERMISSION_DEBIT);
llOwnerSay("Your vendor is all set the split amount is %"+(string)splitAmount);
}
else
{
llOwnerSay("WARNING:: Your split amount is over 100% it's currently at %"+(string)splitAmount);
}
}
else
{
llOwnerSay("You need to set your partners key in the script, once you add the key at the top of the script reset the script.");
llSetPayPrice(PAY_HIDE,[PAY_HIDE,PAY_HIDE, PAY_HIDE, PAY_HIDE]);
}
}
money(key id, integer amount)
{
if(amount < cost)
{
llRegionSayTo(id,0,"You did not pay the full amount to purchase this item it cost L$"+(string)cost);
llGiveMoney(id,amount);
}
else
{
llGiveMoney(partner,pay);
string object=llGetInventoryName(INVENTORY_OBJECT,0);
llGiveInventory(id,object);
}
}
}