Advertisement
Gayngel

Basic Tip Splitter Script

Nov 18th, 2017
502
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. integer total;
  2. intger perms;
  3.  
  4. list avkeys = [
  5.  
  6. "a9ba2797-81af-429d-9833-51127ad5593c","10",                    
  7. "12b085db-fe7f-4cd3-8ef1-d11bb6dbd036","40"                                                                                                
  8.                                                              
  9.  
  10. //List the keys of avatars who should get a
  11. // share of the amount paid and the
  12. // percentage they should receive.
  13. ]
  14.  
  15. default
  16. {
  17.  
  18. state_entry()
  19. {
  20.  
  21.     total = llGetListLength(avkeys);
  22.     llReqeustPermissions(llGetOwner(),PERMISSION_DEBIT);   
  23.  
  24. }
  25.  
  26.  
  27.   run_time_permissions(integer perm)
  28.     {
  29.         if (perm & PERMISSION_DEBIT)
  30.         {
  31.  
  32.     perms = TRUE;
  33.          
  34.         }
  35. }
  36.  
  37.   money(key id, integer amount)
  38.     {
  39.    
  40.     if(perms)
  41.         {
  42.        
  43.         integer x = 0;
  44.  
  45.         for( ; x < total; x = x+2)
  46.             {
  47.         key partner = (key)llList2String(avkeys,x);
  48.         integer percentage = (integer)llList2String(avkeys,x+1);
  49.         float share =  (percentage / 100.0) * (float)amount;
  50.         llTransferLindenDollars(partner,(integer)share);
  51.  
  52.             }
  53.            
  54.         }      
  55.  
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement