mnscript
Device_PaymentButtonPressed(PaymentButtonDevice, Player, number)
Description ​
Invoked when a connected Payment Button device is pressed
Arguments ​
PaymentButtonDevice
- The PaymentButtonDevice which was pressedPlayer
- The Player who pressed the buttonnumber
- The amount paid by the player
Example ​
msc
using Console;
using Util;
using Event;
using Player;
using Device;
function<bool> OnPaymentButtonPressed(PaymentButtonDevice device, Player player, number amount){
Console.WriteLine(player.GetName().." has paid "..Util.ToString(amount).."!");
// If we return false, the payment would be rejected and no money would be transferred.
// This is useful to abort a payment if the product cannot be delivered for some reason.
// Accept the payment by returning true.
return true;
}
Event.AddListener("Device_PaymentButtonPressed", "payment", "OnPaymentButtonPressed");