Donation Box

Written by: Headmaster
//Keknehv Psaltery Updated Version of DONATION BOX By jean cook, ama omega, and nada epoch Debugged by YadNi Monde (LoL) Yea, that s a Bunch O Peeps =)

//Summary: The following script will make an object accept donations on your behalf.
//Usage: stick it on any object you own(my favorite is a top hat), and it will promptly display:
//"'s donation hat.
//Donate if you are so inclined."
//at which point anyone can right click on it and give you a tip. also, the script tells the donator thanks, and then tells you who donated how much
//also shows the total amount donated



integer totaldonated;
string owner;

default
{
    on_rez( integer sparam )
    {
        llResetScript();
    }
    state_entry()
    {
        owner = llKey2Name( llGetOwner() );
        llSetText( owner + "'s Tip Jar.\nPlease tip if you are so inclined!\n$L0 Donated so far",<.25,1,.65>,1);
    }

    money(key id, integer amount)
    {
        totaldonated += amount;
        llSetText( owner + "'s Tip Jar.\nPlease tip if you are so inclined!\n$L" + (string)amount + " Was donated last!\n" + "$L" + (string)totaldonated + " Donated so far",<.25,1,.65>,1);
        llInstantMessage(id,"Thanks for the tip!  I really appreciate it.");
        llInstantMessage(llGetOwner(),(string)llKey2Name(id)+" donated $" + (string)amount);
    }
}