Top Free Scripts
Script ID : 35
Audience : Default
Version 1.00
Published Date: 2010/5/12 5:08:55
Reads : 3131
Money

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

Put this script along with TWO OBJECTS and an optional information Notecard.

Users will get a notecard on Touch and get item when a 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 price 100//price for single (first item)
integer copyprice 400//price for copyable (second item)
string single "Full Object Name"//must match exact item name
string copyable "Copyable Full Object Name"//must match exact item name
string thanks "Thank you for your purchase. Please accept your product.";
// End variables
//--------------------------------------------

integer totalsold 0;
integer totalsoldcopy 0;
integer totalamount 0;
integer totalamountcopy 0;

string startdate;
string ts;
list 
now;

default
{
    
on_rez(integer start_param)
    {
        
llResetScript();
    }
    
    
state_entry()
    {
        
llRequestPermissions(llGetOwner(),PERMISSION_DEBIT);
        
llSetPayPrice(PAY_HIDE, [pricecopypricePAY_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)price " for '" single "' or L$" + (string)copyprice " for '" copyable ".'");
            if (
llGetInventoryNumber(INVENTORY_NOTECARD) > 0//notecard available
            
{
                
llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_NOTECARD0));
            }
        }
        else if ( 
llDetectedKey(0) == llGetOwner() ) //object owner
        
{
            
llOwnerSay((string)totalsold +" Single units have been sold, L$" + (string)totalamount +" since " startdate ".");
            
llOwnerSay((string)totalsoldcopy +" Copyable units have been sold, L$" + (string)totalamountcopy +" since " startdate ".");
            
integer alltotal totalamount totalamountcopy;
            
llOwnerSay("L$" + (string)alltotal +" collected total so far.");
        }
    } 
    
    
money(key idinteger amount)
    {
        if (
amount == price// single amount paid
        
{
            
llInstantMessage(idthanks);
            
llGiveInventory(idsingle); //single version
            
totalsold totalsold 1;
            
totalamount amount totalsold;
            
llInstantMessage(llGetOwner(), (string)llKey2Name(id) + " has paid " +  (string)amount " in "llGetRegionName());
        }
        
        else if (
amount == copyprice// copyable amount paid
        
{
            
llInstantMessage(idthanks);
            
llGiveInventory(idcopyable); //copyable version
            
totalsoldcopy totalsoldcopy 1;
            
totalamountcopy amount totalsoldcopy;
            
llInstantMessage(llGetOwner(), (string)llKey2Name(id) + " has paid " +  (string)amount " in "llGetRegionName());
        }
        
        else 
// Not a correct amount, Refund amount
        
{
            
llInstantMessage(id"Sorry that is not the correct amount. Refunding you L$" + (string)amount ".");
            
llGiveMoney(idamount);
        }
    }
}

0
|  Links 
Printer Friendly Page Send this Script to a Friend
Search for Help
New Product
Free Item
Sponsor

Site Info
Total Hits