Second Life Copybot
Group Discount sale script - Printable Version

+- Second Life Copybot (https://secondlifecopybot.com)
+-- Forum: SECOND LIFE PRODUCTS (https://secondlifecopybot.com/forum-1.html)
+--- Forum: SCRIPTS (https://secondlifecopybot.com/forum-1022.html)
+---- Forum: SCRIPTS (https://secondlifecopybot.com/forum-8.html)
+----- Forum: Business Scripts (https://secondlifecopybot.com/forum-44.html)
+----- Thread: Group Discount sale script (/thread-8694.html)



Group Discount sale script - Bonfire - 11-28-2014

Fill in the price and discount percentage and put the script in the box with the product you intend to sell.
The product will sell at normal price but refund the percentage to members of the group.
Make sure the product box is set to the group you want to get discount.

[Image: Group%20discount%20sales%20script.jpg?1288341165]

Group Discount sale script:
PHP Code:
///Amon Dragonash - april 2010
///A simple as possible script to use, making your boxes give discount on the product to group members.

///Before we start, please don't put this in an otherwise empty box.
///The script doesnt check to see if there actually is something before it starts the sale!

///After editting the script, changing the price and discount percentage to whatever you want it to be..
///..drop the script in the product box of your choice.
///Then make sure the product box is set to the group you want to get discount and you are done.

///The script will present the customer with a pay menu with the normal price and check the group tag they wear to be the same as the one the product is set to before delivering. On delivery it refunds the correct amount as discount to group members. If anything doesnt add up it won't deliver and will refund the money. (It won't refund though if there was no product to deliver.)

///Now let's get started and change the price in the next line to the amount of lindens you want it to be.
integer price 60;
///Now set the number in percentage you want to give as discount.. for example 20 means they get 20% discount.
integer discount 10;

///Leave the rest of the script alone and save it, then drop it into the product box and set that to group and that's it.
 
default
{
    
state_entry()
    {
        
llSetPayPrice(PAY_HIDE, [PAY_HIDE ,PAY_HIDEPAY_HIDEPAY_HIDE]);
        
llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
    }
    
run_time_permissions(integer perm)
    {
        if(
perm PERMISSION_DEBIT)
            
state cash;
    }
}
 
 
state cash
{
    
state_entry()
    {
        
llSetPayPrice(PAY_HIDE, [price ,PAY_HIDEPAY_HIDEPAY_HIDE]);
    }
    
money(key idinteger amount)
    {
        if(
amount != price)
        {
            
///Wrong amount paid. Refund and tell the person in chat.
            
llGiveMoney(idamount);
            
llSay(0"You paid "+(string)amount+", which is the wrong price. Your money has been refunded. The correct price for this item is: "+(string)price);
        }
        
        else if (
llSameGroup(id) == TRUE)
        {
            
///Everything is okay, continue delivering product(s) and calculate the group discount.
            
list lGive = [];
        
string sName llGetScriptName();
        
integer iInventory llGetInventoryNumber(INVENTORY_ALL);
        while(--
iInventory>=0)
        {
            
string sItem llGetInventoryName(INVENTORY_ALL,iInventory);
            if( 
sItem != sName)
                
lGive += sItem;
        }
        
llGiveInventoryListidllGetObjectName(), lGive);
        
integer returnmoney llRound(amount discount 100);
        
llGiveMoney(idreturnmoney);
        }
        
        else
        {
            
///Right price wrong group.. deliver product(s) but no discount.
            
list lGive = [];
        
string sName llGetScriptName();
        
integer iInventory llGetInventoryNumber(INVENTORY_ALL);
        while(--
iInventory>=0)
        {
            
string sItem llGetInventoryName(INVENTORY_ALL,iInventory);
            if( 
sItem != sName)
                
lGive += sItem;
        }
        
llGiveInventoryListidllGetObjectName(), lGive);
        }
    }


hope you like and Enjoy :)

hit the thank you and the rep button if you Copy or download


RE: Group Discount sale script - InigoMontoya - 11-28-2014

nice nice thanks i can use this.