mnscript
StringResult Dispenser.DispenseItem(string, number)
Description ​
Dispenses an item.
Arguments ​
string
- The name of the item.number
- The amount to dispense.
Returns ​
StringResult
- A StringResult representing the success of the operation.
Example ​
msc
using Peripheral;
using Console;
using Application;
using Util;
using Array;
using System;
Dispenser dispenser = Peripheral.GetConnectedDispenser();
if(dispenser.IsValid() == false){
// If the dispenser was not found, quit.
Application.Exit();
}
// Attempts to dispense one glock.
// To find the item name of a weapon, right click copy the weapon in Q menu Weapons Tab.
StringResult result = dispenser.DispenseItem("vguns_glockp80", 1);
if(result.GetResult()){
Console.WriteLine("The item was dispensed!");
}else{
// If the item could not be dispensed, the result's string will contain the error reason.
Console.WriteLine("The item failed to dispense: "..result.GetString());
}