Dispenser.HasItem
Skip to content
mnscript
bool Dispenser.HasItem(string) 

Description ​

Gets whether the dispenser contains a certain item.

Arguments ​

string - The name of the item to look for.

Returns ​

bool - True if the dispenser contains the item.

Example ​

msc
using Peripheral;
using Console;
using Application;

Dispenser dispenser = Peripheral.GetConnectedDispenser();

if(dispenser.IsValid() == false){
    // If the dispenser was not found, quit.
    Application.Exit();
}

// Searches for glocks in the dispenser.
// To find the item name of a weapon, right click copy the weapon in Q menu Weapons Tab.
bool hasGlocks = dispenser.HasItem("vguns_glockp80");

if(hasGlocks){
    Console.WriteLine("The dispenser has 1 or more glocks!");
}else{
    Console.WriteLine("The dispenser has no glocks!");
}