Difference between revisions of "Money"

From Second Life Wiki
Jump to navigation Jump to search
m
Line 1: Line 1:
{{LSL_Function/warning|Security|'''Always (''ALWAYS!'') check the amount paid in your money() event. Preconfigured payment amounts from [[llSetPayPrice]]() are only a suggestion to the client. The client can still send L$0 or any positive integer. ''Never'' trust the client software to be secure.'''}}{{LSL_Event
{{LSL_Event
|inject-1={{LSL_Function/warning|Security|'''Always (''ALWAYS!'') check the amount paid in your money() event. Preconfigured payment amounts from [[llSetPayPrice]]() are only a suggestion to the client. The client can still send L$0 or any positive integer. ''Never'' trust the client software to be secure.'''}}
|event_id=20
|event_id=20
|event_delay
|event_delay
Line 5: Line 6:
|p1_type=key|p1_name=id|p1_desc=who paid
|p1_type=key|p1_name=id|p1_desc=who paid
|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 in the '''amount''' by '''id'''.
|event_desc=Triggered when money is paid to the prim in the {{LSLP|amount}} by {{LSLP|id}}.
|event_footnote
|event_footnote
|constants
|constants

Revision as of 21:03, 10 June 2012

Emblem-important-red.png Security Warning!

Always (ALWAYS!) check the amount paid in your money() event. Preconfigured payment amounts from llSetPayPrice() are only a suggestion to the client. The client can still send L$0 or any positive integer. Never trust the client software to be secure.

Description

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

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

• key id who paid
• integer amount the amount paid

Specification

When money is paid to the prim, the money is given to the object's owner.
If the object is owned by or deeded to a group it is divvied up amongst the group members immediately (which is why groups can't grant PERMISSION_DEBIT). Only members of a role that has the "Accounting/Pay group liabilities and receive group dividends" attribute will receive money.
Don't forget to turn on the pay-behavior of the prims/objects involved.
The pay buttons should be configured in most applications where money is being transfered (llSetPayPrice), it makes paying money to the object easier.

Caveats

  • This event cannot be triggered by a call to llGiveMoney because llGiveMoney cannot be used by one object to pay another object.
  • Money cannot be paid to an attachment.


Examples

<lsl>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");
       }
   }

}</lsl>

See Also

Functions

•  llGiveMoney Give money to another avatar
•  llSetPayPrice Configure the pay buttons

Deep Notes

Signature

event void money( key id, integer amount );