Difference between revisions of "Money"

From Second Life Wiki
Jump to navigation Jump to search
Line 6: Line 6:
|p2_type=integer|p2_name=amount|p2_desc=the amount paid
|p2_type=integer|p2_name=amount|p2_desc=the amount paid
|event_desc=Triggered when money is paid to the prim/object in the '''amount''' by '''id'''.
|event_desc=Triggered when money is paid to the prim/object in the '''amount''' by '''id'''.
|event_footnote=When money is paid to the object, the money is given to the objects owner.<br/>If the object is owned by a group it is divvied up amongst the group members.
|event_footnote=When money is paid to the object, the money is given to the objects owner.<br/>If the object is owned by a group it is divvied up amongst the group members.<br/>Don't forget to turn on the pay-behavior of the prims/objects involved.
|constants
|constants
|spec=
|spec=

Revision as of 22:57, 2 August 2007

Emblem-important-red.png Security Warning!

Always (ALWAYS!) check the amount paid.

Description

Event: money( key id, integer amount ){ ; }

Triggered when money is paid to the prim/object in the amount by id.

• key id who paid
• integer amount the amount paid

When money is paid to the object, the money is given to the objects owner.
If the object is owned by a group it is divvied up amongst the group members.
Don't forget to turn on the pay-behavior of the prims/objects involved.

Caveats


Examples

integer price = 10;

default
{
    state_entry()
    {
        llSetPayPrice(PAY_HIDE, [PAY_HIDE ,PAY_HIDE, PAY_HIDE, PAY_HIDE]);
        llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
    }
    run_time_permissions(integer perm)
    {
        if(perm & PERMISSION_DEBIT)
            state cash;
    }
}

state cash
{
    state_entry()
    {
        llSetPayPrice(price, [price ,PAY_HIDE, PAY_HIDE, PAY_HIDE]);
    }
    money(key id, integer amount)
    {
        if(amount != price)
        {
            llGiveMoney(id, amount);
            llInstantMessage(id, "You paid "+(string)amount+", which is the wrong price, the price is: "+(string)price);
        }
        else
        {
            llInstantMessage(id, "You paid the right price");
        }
    }
}

See Also

Functions

•  llGiveMoney
•  llSetPayPrice

Deep Notes

Signature

event void money( key id, integer amount );