Weekly Raffle
Top Free Scripts
ASD Web Tools
One Object Vendor 2.0
 
Script ID : 36
Published Date: 2010/5/12 5:10:46
Reads : 4206
Money

Put in object with product and info note & set price. Owner can check to see total earned.

Put this script along with ONE OBJECT and an optional information Notecard. If multiple items, put them into one "box" object.

Users will get a notecard on Touch and get item when correct amount is paid.

Owner will get IM for each sale with user's name and can Touch to see how much money earned at any time.

// Begin variables
integer gCorrectAmount 300//enter your price
string thanks "Thank you for your purchase. Please accept your product.";
// End variables
//--------------------------------------------

integer totalsold 0;
integer totalamount 0;

string startdate;
string ts;
list 
now;

default
{
    
on_rezinteger param )
    {
        
llResetScript();
    }
    
    
state_entry()
    {
        
llRequestPermissions(llGetOwner(),PERMISSION_DEBIT);
        
llSetPayPrice(PAY_HIDE, [gCorrectAmountPAY_HIDEPAY_HIDEPAY_HIDE]);
        
        
ts llGetDate();
        
now llParseString2Listts, ["-"], [] ) ;
        
integer nyear = (integer)llList2Stringnow) ;   
        
integer nmonth = (integer)llList2Stringnow) ;
        
integer nday = (integer)llList2Stringnow) ;
        if (
nmonth == 1)
        {
            
string smonth "January";
            
startdate smonth " " + (string)nday ", " + (string)nyear;
        }
        else if  (
nmonth == 2)
        {
            
string smonth "February";
            
startdate smonth " " + (string)nday ", " + (string)nyear;
        }
        else if  (
nmonth == 3)
        {
            
string smonth "March";
            
startdate smonth " " + (string)nday ", " + (string)nyear;
        }
        else if  (
nmonth == 4)
        {
            
string smonth "April";
            
startdate smonth " " + (string)nday ", " + (string)nyear;
        }
        else if  (
nmonth == 5)
        {
            
string smonth "May";
            
startdate smonth " " + (string)nday ", " + (string)nyear;
        }
        else if  (
nmonth == 6)
        {
            
string smonth "June";
            
startdate smonth " " + (string)nday ", " + (string)nyear;
        }
        else if  (
nmonth == 7)
        {
            
string smonth "July";
            
startdate smonth " " + (string)nday ", " + (string)nyear;
        }
        else if  (
nmonth == 8)
        {
            
string smonth "August";
            
startdate smonth " " + (string)nday ", " + (string)nyear;
        }
        else if  (
nmonth == 9)
        {
            
string smonth "September";
            
startdate smonth " " + (string)nday ", " + (string)nyear;
        }
        else if  (
nmonth == 10)
        {
            
string smonth "October";
            
startdate smonth " " + (string)nday ", " + (string)nyear;
        }
        else if  (
nmonth == 11)
        {
            
string smonth "November";
            
startdate smonth " " + (string)nday ", " + (string)nyear;
        }
        else if  (
nmonth == 12)
        {
            
string smonth "December";
            
startdate smonth " " + (string)nday ", " + (string)nyear;
        }
    }
     
    
touch_start(integer total_number)
    {
        if ( 
llDetectedKey(0) != llGetOwner() )
        {
            
llInstantMessage(llDetectedKey(0), "Pay this object L$" + (string)gCorrectAmount " to purchase.");
            if (
llGetInventoryNumber(INVENTORY_NOTECARD) > 0//notecard available
            
{
                
llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_NOTECARD0));
            }
        }
        else if ( 
llDetectedKey(0) == llGetOwner() )//object owner
        
{
            
llOwnerSay((string)totalsold +" units have been sold, L$" + (string)totalamount +" since " startdate ".");
        }
    } 
    
    
money(key idinteger amount)
    {
        if (
amount == gCorrectAmount)
        {
            
// correct amount paid
            
llInstantMessage(idthanks);
            
llGiveInventory(id,llGetInventoryName(INVENTORY_OBJECT0));
            
totalsold totalsold 1;
            
totalamount amount totalsold;
            
llInstantMessage(llGetOwner(), (string)llKey2Name(id) + " has paid " +  (string)amount " in "llGetRegionName());
        }
        
        else if (
amount gCorrectAmount)
        {
            
llSay(0,"You didn't pay enough, " llKey2Name(id) + ". Refunding your payment of L$" + (string)amount ".");
            
llGiveMoney(idamount);
        }
        
        else
        {
            
integer refund amount gCorrectAmount;
            
llSay(0,"You paid too much, " llKey2Name(id) + ". Your change is L$" + (string)refund ".");
            
llGiveMoney(idrefund);
        }
    }
}

Printer Friendly Page Send this Script to a Friend

Disclaimer: While I do not mind if these scripts are used in things you sell, I do not wish for these scripts to be sold either on their own or in script packs.
Most Popular Raffle System In Second Life
Visit ASD Studios Hollywood
Search for Help
Monthly Free Item
Tip All Tip Chest


Limit one per avatar
Teleport Now!



Sponsor

Site Info
Total Hits: