RustTip

CanPickupAllFromRack

CarbonGlobal

Called to check whether the player can take all weapons from a weapon rack.

Return true to allow the action and false to block it.

void CanPickupAllFromRack(WeaponRack rack, BasePlayer player, int mountSlotIndex)
Works — the game method in this build is the one the hook was written for.

Parameters

rack
WeaponRack
player
BasePlayer
mountSlotIndex
int

Return value

voidBehaviour is not described.

Example

private void CanPickupAllFromRack(WeaponRack rack, BasePlayer player, int mountSlotIndex)
{
    Puts("CanPickupAllFromRack");
}

Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.

Injection point

Carbon
void WeaponRack.GivePlayerAllWeapons(BasePlayer player, int mountSlotIndex)
WorksAssembly-CSharp

Where it is called (this branch's game code)

private void GivePlayerAllWeapons(BasePlayer player, int mountSlotIndex)
{
	Interface.CallHook("CanPickupAllFromRack", this, player, mountSlotIndex);
	if (player == null)
	{
		return;
	}
	WeaponRackSlot weaponAtIndex = GetWeaponAtIndex(mountSlotIndex);
	if (weaponAtIndex != null)
	{
		GivePlayerWeapon(player, weaponAtIndex.GridSlotIndex);
// …

Sources: Rust.opj from OxideMod/Oxide.Rust (MIT) and hook metadata of the Carbon documentation (MIT). Method code is decompiled from this branch's server.