Skip to content
Sachin edited this page Sep 29, 2024 · 3 revisions

API for Fortnite Emotes & Dances

Description = Play Emote for player.

Param1 = PlayerController

Param2 = Emote name

Param3 = Ref error which will have the error if PlayEmote returns false.

Return = true if player was able to emote else false.

public bool PlayEmote(CCSPlayerController player, string name, ref string error)

Description = Play Dance for player.

Param1 = PlayerController

Param2 = Dance name

Param3 = Ref error which will have the error if PlayEmote returns false.

Return = true if player was able to dance else false.

public bool PlayDance(CCSPlayerController player, string name, ref string error)

Description = Stop emote / dance for player if he/she is emoting/dancing.

Param1 = PlayerController

Return = nothing

public void StopEmote(CCSPlayerController player)

Description = Returns emoting/dancing state of player

Param1 = PlayerController

Return = true if player is emoting/dancing else false.

public bool IsDancing(CCSPlayerController player)

Description = Returns true if player is ready for emoting/dancing.

Param1 = PlayerController

Return = true if player is ready for emoting/dancing else false.

public bool IsReadyForDancing(CCSPlayerController player)

Description = Returns list of all emotes available.

public List<Emote> GetEmoteList()

Description = Returns list of all dances available.

public List<Emote> GetDanceList()

Description = It is called when a player tries to play an emote/dance

Return = returning HookResult.Handled || HookResult.Stop will stop emote/dance from playing for the player.

public event OnPlayerEmoteFunc? OnPlayerEmotePre

eg:

private readonly PluginCapability<IFortniteEmotesAPI> g_PluginCapability = new("FortniteEmotes");

private IFortniteEmotesAPI? FortniteEmotesApi;

public override void OnAllPluginsLoaded(bool hotReload)
{
    FortniteEmotesApi = g_PluginCapability.Get();

    if (FortniteEmotesApi == null) return;

    FortniteEmotesApi.OnPlayerEmotePre += OnPlayerEmote;
}

public HookResult OnPlayerEmote(CCSPlayerController player, Emote emote)
{
    if(emote.Name == "Dance")
    {
        player.PrintToChat("Dance is not allowed");
        return HookResult.Stop;
    }
    
    return HookResult.Continue;
}