Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Group vendor by Gayngel. Full perm and no terms or strings, edit and give away how you like.
- // This vendor script will receive money and give items to activated group members only. Non-group members will be refunded.
- // Place the products to be sold in the vendor's contents and grant debit permissions to refund non-group members.
- //N.B: You must grant debit permissions each time you change or remove the vendor's contents!
- //----------------------------------------------------------\\
- integer Price = 150; //Set price of product here.
- string Group ="secondlife:///app/group/04f595b0-cdc8-97f0-e710-9564824c03b2/about"; // Copy and paste your group url here.
- integer DebitPerms;
- list inventoryItems;
- integer index;
- default
- {
- state_entry()
- {
- llRequestPermissions(llGetOwner(), PERMISSION_DEBIT); //Gets permission to refund customers who are not in the group.
- }
- run_time_permissions (integer perm)
- {
- if (perm & PERMISSION_DEBIT)
- { DebitPerms = TRUE;
- llSetClickAction(CLICK_ACTION_PAY); // Debit permissions were granted then allow the vendor to be paid.
- llSetPayPrice(PAY_HIDE, [Price, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
- }
- }
- touch_start(integer num)
- {
- key id = llDetectedKey(0);
- if(id == llGetOwner());
- {
- llResetScript(); //In case the owner didn't allow debit permissions they can touch the script to reset.
- }
- }
- money(key id, integer amount)
- {
- integer sameGroup = llSameGroup(id);
- if(!sameGroup) // If not in the same group as the vendor's, refund the customer.
- {
- llTransferLindenDollars(id, Price);
- llInstantMessage(id, "Sorry you are not a group member. Please join and activate the " + Group + " group to purchase this item.");
- }
- else // If in the same group, accept their money and give the customer their purchase.
- {
- string thisScript = llGetScriptName();
- integer inventoryNumber = llGetInventoryNumber(INVENTORY_ALL);
- for ( ; index < inventoryNumber; ++index )
- {
- string itemName = llGetInventoryName(INVENTORY_ALL, index);
- if (itemName != thisScript)
- {
- if (llGetInventoryPermMask(itemName, MASK_OWNER) & PERM_COPY) // Checks if objects to be given are copyable. If they aren't they won't be sold.
- {
- inventoryItems += itemName;
- }
- else
- {
- llInstantMessage(llGetOwner(),"Unable to copy the item named '" + itemName + "'. Please add copyable items in this vendor.");
- }
- }
- }
- if (inventoryItems == [] )
- {
- llInstantMessage(llGetOwner(), "No copiable items found. Please add copyable items in this vendor.");
- llInstantMessage(id, "No copiable items in this vendor, sorry. Refunding you.");
- llTransferLindenDollars(id, Price);
- }
- else
- {
- llInstantMessage(id, "Thank you " + llKey2Name(id) + "!");
- llGiveInventoryList(id,"Folder Name", inventoryItems);
- // Gives all objects in prim's inventory in a folder. Replace "Folder Name" with a name of your product, keeping quotations.
- }
- }
- }
- changed(integer change)
- {
- if(change & CHANGED_INVENTORY) //If inventory is added or deleted reset the script.
- {
- llResetScript();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement