RustTip

OnClientProjectileEffectCreate

OxideCarbonPlayer

Called when a client projectile effect is created.

object OnClientProjectileEffectCreate(Network.Connection sourceConnection, BaseProjectile baseProjectile, string prefabName)
Works — the game method in this build is the one the hook was written for.

Parameters

sourceConnection
Network.Connection
baseProjectile
BaseProjectile
prefabName
string

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 OnClientProjectileEffectCreate(Network.Connection sourceConnection, BaseProjectile baseProjectile, string prefabName)
{
    Puts("OnClientProjectileEffectCreate");

    // 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 BaseProjectile.CreateProjectileEffectClientside(string, Vector3, Vector3, int, Network.Connection, bool, bool, List<Network.Connection>, float)

Passes: Network.Connection sourceConnection, BaseProjectile baseProjectile, string prefabName

WorksReturnBehavior: ExitWhenNonNullArgumentBehavior: UseArgumentString (a4, this, a0)Assembly-CSharp.dll

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

protected void CreateProjectileEffectClientside(string prefabName, Vector3 pos, Vector3 velocity, int seed, Connection sourceConnection, bool silenced = false, bool forceClientsideEffects = false, List<Connection> targets = null, float distanceOverride = 0f)
{
	if (Interface.CallHook("OnClientProjectileEffectCreate", sourceConnection, this, prefabName) != null)
	{
		return;
	}
	Effect effect = reusableInstance;
	effect.InitWithSourceEntity(Effect.Type.Projectile, this, pos, velocity, sourceConnection);
	effect.scale = (silenced ? 0f : 1f);
	if (forceClientsideEffects)
	{
// …

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.