Function: llSetPayPrice( integer price, list quick_pay_buttons ); //这个是语法
下面是参数列表
======================
integer price = 10; //设定物品的价格
default
{
state_entry()
{
llSetPayPrice(PAY_HIDE, [PAY_HIDE ,PAY_HIDE, PAY_HIDE, PAY_HIDE]); //这个是设置pay那个对话框,PAY_HIDE是隐藏对应框.
llRequestPermissions(llGetOwner(), PERMISSION_DEBIT); //这个要求取得权限
}
run_time_permissions(integer perm)
{
if(perm & PERMISSION_DEBIT)
state cash;
}
}
state cash
{
state_entry()
{
llSetPayPrice(PAY_HIDE, [price,PAY_HIDE, PAY_HIDE, PAY_HIDE]); //只有一个不隐藏,price从第一行变量获取,如果想判断价格是否正确,可以将第一个PAY_HIDE设为price,用下面的判断是否正确
}
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");
}
}
}
注:
llSetPayPrice(price, [PAY_HIDE, PAY_HIDE, PAY_HIDE, PAY_HIDE]); 如果这样写就只显示下面的amount的价格,让用户自已输入.
llSetPayPrice(PAY_HIDE, [price, PAY_HIDE, PAY_HIDE, PAY_HIDE]); 如果这样写就只显示设置好的价格.
如果全用PAY_DEFAULT话就是那个让你选1 5 10 20那个东西.
llSetPayPrice(100, [700,200, 400, 600]);//要是这个写,就是下面这个下场了:
