Difference between revisions of "LlSetPayPrice"

From Second Life Wiki
Jump to navigation Jump to search
(bold the warning and make the wording a little more blunt. I am seeing too many reports that llsetpayprice bypasses are a fad again.)
Line 5: Line 5:
|p1_type=integer|p1_name=price|p1_desc=PAY_* constant or positive value
|p1_type=integer|p1_name=price|p1_desc=PAY_* constant or positive value
|p2_type=list|p2_name=quick_pay_buttons|p2_desc=Four PAY_* constants and/or positive integer values
|p2_type=list|p2_name=quick_pay_buttons|p2_desc=Four PAY_* constants and/or positive integer values
|func_desc=Sets the default amount for the pay text field and pay buttons of the appearing dialog when someone chooses to pay this object.
|func_desc=Suggest default amounts for the pay text field and pay buttons of the appearing dialog when someone chooses to pay this object.
|caveats=*This function should not be trusted to limit the values of money payable to the object; ''always'' verify the amount paid is the amount expected.
|caveats=*This function should not be trusted to limit the values of money payable to the object; ''always'' verify the amount paid is the amount expected.
*This function only works when called from the root prim of an object. Its effect applies to all the prims in the object. Calling it from a child prim has no effect.
*This function only works when called from the root prim of an object. Its effect applies to all the prims in the object. Calling it from a child prim has no effect.

Revision as of 19:02, 20 July 2011

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.

Summary

Function: llSetPayPrice( integer price, list quick_pay_buttons );
0.0 Forced Delay
10.0 Energy

Suggest default amounts for the pay text field and pay buttons of the appearing dialog when someone chooses to pay this object.

• integer price PAY_* constant or positive value
• list quick_pay_buttons Four PAY_* constants and/or positive integer values

Constant Alt Description
PAY_HIDE -1
0
Hides this quick pay button.
PAY_DEFAULT -2 Use the default value for this quick pay button.
Button Order
1
2
3
4
Defaults
$1 $5
$10 $20

Caveats

  • This function should not be trusted to limit the values of money payable to the object; always verify the amount paid is the amount expected.
  • This function only works when called from the root prim of an object. Its effect applies to all the prims in the object. Calling it from a child prim has no effect.
  • Note that the pay option will only be shown in prims having a running script with a money event (or in all the prims of the object if the root has a running script with a money event).
  • The effect seems to persist even if the script is recompiled with out the llSetPayPrice function, even if the script is replaced with another one which includes a money event, but not llSetPayPrice.

Examples

This will give the user a dialog box without the price field and only one button with a value of 150. <lsl>llSetPayPrice(PAY_HIDE, [150,PAY_HIDE,PAY_HIDE,PAY_HIDE])</lsl>

<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
       {
           //insert your give code here.
           llInstantMessage(id, "You paid the right price");
       }
   }
}</lsl>

See Also

Events

•  money

Functions

•  llGiveMoney

Deep Notes

Tests

•  llSetPayPrice Test

Signature

function void llSetPayPrice( integer price, list quick_pay_buttons );