OnRackedWeaponLoad
OxideCarbonItemCalled to control taking items from a weapon rack.
object OnRackedWeaponLoad(Item local4, ItemDefinition local7, BasePlayer local0, WeaponRack weaponRack)Works — the game method in this build is the one the hook was written for.
Parameters
- local4
- Item
- local7
- ItemDefinition
- local0
- BasePlayer
- weaponRack
- WeaponRack
Return value
objectReturn non-null to cancel the game action.
Example
object — you can affect the game: return a value to change or cancel the action.
private object OnRackedWeaponLoad(Item local4, ItemDefinition local7, BasePlayer local0, WeaponRack weaponRack)
{
Puts("OnRackedWeaponLoad");
// change nothing — the game continues as usual
return null;
// to affect the game:
// return false; // non-null cancels the game action
}Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.
Injection point
Rust.opj (Oxide)
void WeaponRack.LoadWeaponAmmo(BaseEntity.RPCMessage)
Passes: Item local4, ItemDefinition local7, BasePlayer local0, WeaponRack weaponRack
WorksReturnBehavior: ExitWhenValidTypeArgumentBehavior: UseArgumentString (l4, l7, l0, this)Assembly-CSharp.dll
Where it is called (this branch's game code)
// …
{
return;
}
ItemDefinition itemDefinition = ItemManager.FindItemDefinition(num);
if (itemDefinition == null)
{
return;
}
if (Interface.CallHook("OnRackedWeaponLoad", slot, itemDefinition, player, this) != null)
{
return;
}
if (itemDefinition == SnowballGun.SnowballInventoryItem)
{
itemDefinition = SnowballGun.SnowballAmmoItem;
if (!(itemDefinition != null))
{
// …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.