Simple paysplit vendor

Thread Started By wootwoot

2604
1
  • 57 Vote(s) - 2.96 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rate Thread
#1
Code:
// PUT HERE THE PRICE OF THE PRODUCT
integer PRICE = 10;

// PUT HERE THE PERCENTAGE TO PAY THE OTHER AVATAR ON SALE
integer RECEIVER_PERCENT = 25;

// PUT HERE THE KEY OF THE AVATAR INSIDE OF THE QUOTES
key RECEIVER = "00000000-0000-0000-0000-000000000000";

////-----------------------------------------------------------------------------------------------------------------
////-----------------------------------------------------------------------------------------------------------------
////-----------------------------------------------------------------------------------------------------------------
////---------------------------------- DO NOT CHANGE BELOW ----------------------------------------------------------
////-----------------------------------------------------------------------------------------------------------------
////-----------------------------------------------------------------------------------------------------------------
////-----------------------------------------------------------------------------------------------------------------

integer have_perms() {
    return ((llGetPermissions() & PERMISSION_DEBIT) == PERMISSION_DEBIT) && llGetPermissionsKey() == llGetOwner();
}

get_perms() {
    if(PRICE != 0) {
        if(!have_perms()) {
            llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);            
        } else {
            set_price();
        }
    }
}

set_price() {
    if(PRICE != 0) {
        llSetPayPrice(PAY_HIDE, [PRICE, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
    }
}

init() {
    llSetPayPrice(PAY_HIDE, [PAY_HIDE, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
    get_perms();
}

default {
    state_entry() {
        init();
    }

    run_time_permissions(integer perm) {
        if(perm & PERMISSION_DEBIT) {
            set_price();
        }
    }

    on_rez(integer start_param) {
        init();
    }

    changed(integer change) {
        if(change & (CHANGED_REGION_START|CHANGED_TELEPORT|CHANGED_OWNER|CHANGED_REGION)) {
            init();
        }
    }

    money(key id, integer amount) {
        if(amount == PRICE) {
            if(RECEIVER != NULL_KEY && RECEIVER_PERCENT > 0) {
                integer fee = llRound(((float)PRICE * (float)RECEIVER_PERCENT) / (float)100);
                if(have_perms()) {
                    llGiveMoney(RECEIVER, fee);
                } else {
                    llInstantMessage(llGetOwner(), "Missing payment permissions you need to pay secondlife:///app/agent/" + (string)RECEIVER  + "/about $"+ (string) fee);
                }
            }

            integer i = 0;
            integer count = llGetInventoryNumber(INVENTORY_ALL);
            list items = [];
            string self = llGetScriptName();
            for(;i < count; ++i) {
                string n = llGetInventoryName(INVENTORY_ALL, i);
                if(n != self) {
                    items += [n];
                }
            }
            if(llGetListLength(items) > 0) {
                if(llGetListLength(items) > 1) {
                    llGiveInventoryList(id, llGetObjectName(), items);
                } else {
                    llGiveInventory(id, llList2String(items, 0));
                }
            }
        }
    }
}
Reply


#2
Thanks:ThumbsUp:
Reply




Possibly Related Threads…
Thread Author Replies Views Last Post
  Paypal / Credit Card Vendor steadymobbin 17 14,463 02-14-2019, 06:48 PM
Last Post: iknowdawae
  Vendor Split Revenues With Partner YoungMoney 1 3,384 07-03-2018, 06:48 PM
Last Post: ilkermete
  SVN - Networked Vendor System + Holo steadymobbin 13 12,642 01-26-2016, 03:13 PM
Last Post: %XTREM%
  Simple Lucky Chair Script Famenig 2 4,692 09-22-2014, 07:25 AM
Last Post: InigoMontoya
  simple "set pos" steadymobbin 0 2,236 02-18-2013, 02:59 AM
Last Post: steadymobbin
  Single Item Vendor with countdown timer steadymobbin 0 2,716 02-18-2013, 02:42 AM
Last Post: steadymobbin
  mini vendor steadymobbin 0 2,652 02-18-2013, 01:57 AM
Last Post: steadymobbin

Forum Jump:

1 Guest(s)
Share this:

About Second Life Copybot

Second Life CopyBot Forum is a place where you can get items for Second Life and other vitual worlds for free. With our CopyBot viewers you can export and import any content from these virtual worlds and modify them in 3D software such as Blender, 3D studio Macx etc...