Advertisement
Edie_Shoreland

Tip Gift Giver

Nov 25th, 2018
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Based on Toady Nakamura's Simple Recording Tipjar
  2. //at http://wiki.secondlife.com/wiki/User:Toady_Nakamura/Simple_Recording_Tipjar
  3.  
  4. integer totaldonated;
  5.  
  6. default
  7. {
  8.     on_rez( integer sparam )
  9.     {
  10.         llResetScript();
  11.     }
  12.  
  13.     state_entry()
  14.     {
  15.         llSetText("Tips\nL$0 so far",<1.0,1.0,1.0>,0.85);
  16.     }
  17.  
  18.     money(key id, integer amount)// When someone pays the system records their key & the amount
  19.     {
  20.         totaldonated = totaldonated + amount;
  21.         integer randomIndex = llGetInventoryNumber(INVENTORY_OBJECT);
  22.         randomIndex = (integer)llFrand(randomIndex);
  23.         llSetText("Tips\n L$" + (string)totaldonated + " so far",<1.0,1.0,1.0>,0.85);
  24.         llInstantMessage(id,"Thank you for the tip!, " + llKey2Name(id));
  25.         string itemName = llGetInventoryName(INVENTORY_OBJECT, randomIndex);
  26.         llGiveInventory(id, itemName);
  27.         llInstantMessage(llGetOwner(), llKey2Name(id) + " just donated $L" + (string)amount);
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement