Don't click here unless you want to be banned.

LSL Wiki : llGiveMoney

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl805.us.archive.org
llGiveMoney(key destination, integer amount)

Transfers amount of Linden dollars from the script owner to destination. Requires the PERMISSION_DEBIT run-time permission.

destination can only be an avatar, not an object or a group. The recipient does not need to be in the same sim as the object. If amount is less than or equal to zero, the object will say "Invalid parameter in llGiveMoney()." This looks pretty unprofessional, so if you're writing a vendor script that gives change (for example), you'll probably want to avoid it.

Older versions of the LSL documentation stated that llGiveMoney returned an integer. If the owner has insufficient funds to cover the llGiveMoney call, an error will appear on the user's screen (There is no longer an error message, the function silently fails.), but there will be no data returned to the script itself. The return integer from llGiveMoney is always zero.

As of Tuesday, November 6th, 2007, llGiveMoney is now throttled:
Use is limited to 30 payments in a 30 second interval for each resident on a region. Sustained overage will produce a script error and halt payments while the rate remains excessive. Historically, faster payments have failed intermittently.

This example script asks for the PERMISSION_DEBIT permission on startup and then tries to give L$1 to anyone who touches it.

default
{
     state_entry()
     {
          llRequestPermissions(llGetOwner(),PERMISSION_DEBIT);
     }

     touch_start(integer num_detected)
     {
          llGiveMoney(llDetectedKey(0),1);
     }
}

For an additional example, see ExampleMoney.

Q: What happens if the owner doesn't have enough funds to satisfy the llGiveMoney request?
A: The script pops up an error dialog stating "Insufficient funds" (There is no longer an error message, the function silently fails.). Because there isn't any return value from llGiveMoney, you need to keep track of money inside your script. This can be difficult to accomplish. There's no direct way to get your script to know whether or not it's out of money, but it'll keep telling the owner that it's out.
As KellyLinden explains: "It is not possible for llGiveMoney to return a meaningful value, the data is simply not available when and where it would be needed to make that happen."

Q: Wait, it returns zero? Are you sure it doesn't actually return nothing? Maybe you're doing it wrong.
A: Nope, it definitely returns zero, and it does so every time.

When llGiveMoney fails due to "Insufficient Funds", the script is not delayed: The error appears to the owner and noone else, and the script continues to function without any delay or conflict.

To receive money, use the money event.


This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Functions | Agent/Avatar
Comments [Hide comments/form]
What happens if the Script Owner does not have enough funds to satisfy the llGiveMoney request?
-- TroyWesterburg (2004-10-21 06:27:06)
check the Q&A at the end, TroyWesterburg!
-- Flarn2006 (2006-07-12 17:15:47)
How do I have the money come from someone other than the owner? (provided that I already have PERMISSION_DEBIT from that person)
-- Flarn2006 (2006-07-12 17:17:43)
Probably for security reasons, LL disabled llGiveMoney when the object had PERMISSION_DEBIT from anyone other then the owner of the object.
-- ChristopherOmega (2006-07-23 09:58:02)
The docs state that only the owner of an object may grant it PERMISSION_DEBIT.
-- BlindWanderer (2006-07-23 11:17:41)
Attach a comment to this page: