TAKE CARE WITH THIS ONE. IT WILL DEDUCT L$ FROM YOUR ACCOUNT ONCE YOU GRANT PERMISSIONS.
The script will give a gift of the stated amount of L$ to whoever touches the object it is in. The money will be deducted from the object owner's account. Only one gift will be given to each agent and only if the total amount given since the last time permissions were granted has not been maxxed. Once the amount given is equal to the total stated, the script will enter a quiet state and wait to be reset.
// V2 // integer total = 100; // Total amount the script is allowed to give away. integer gift = 1; // Amount to give per gift. ///////////////////////////////////////////// key owner; // Used to store the owners UUID. integer perms; // Used to store if permissions were granted. integer given; // Used to count the total amount given. list agents = []; // Used to store the UUIDs of the agents who have had a gift. default { on_rez(integer param) { llResetScript(); // Clear all lists and reset all variables. This action will also clear the permissions. } changed(integer change) { if(change & CHANGED_OWNER) // If the script or object changes ownership the script will not be able llResetScript(); // to deduct cash from the previous owners account. } state_entry() { owner = llGetOwner(); // Store the owners key. llRequestPermissions(owner, PERMISSION_DEBIT); // !! THIS MEANS IT WILL TAKE YOUR MONEY !! } run_time_permissions(integer perm) { if(perm & PERMISSION_DEBIT) // Have we got the permissions we requested? perms = TRUE; // Store the result of success. else llRequestPermissions(owner, PERMISSION_DEBIT); // If not we ask for them again. } touch_start(integer nd) { while(nd && (given