s1lentq / reapi

AMX Mod X module, using API regamedll & rehlds
GNU General Public License v3.0
160 stars 103 forks source link

Add new native `rg_observer_find_next_player` #325

Open jonathan-up opened 1 month ago

jonathan-up commented 1 month ago

Tested✔

#include <amxmodx>
#include <reapi>

public plugin_init()
{
    register_clcmd("say .fnp", "cmd_fnp");

    RegisterHookChain(RG_CBasePlayer_Observer_FindNextPlayer, "RG_CBasePlayer_Observer_FindNextPlayer_Pre", false);
}

public RG_CBasePlayer_Observer_FindNextPlayer_Pre(const this, bool:bReverse, name[])
{
    client_print(this, print_chat, "FindNextPlayer: bReverse(%d), name(%s)", bReverse, name);
}

public cmd_fnp(const index)
{
    if (!(get_member(index, m_afPhysicsFlags) & PFLAG_OBSERVER))
    {
        client_print(index, print_chat, "YOUR ARE NOT A OBSERVER");
        return PLUGIN_HANDLED;
    }

    client_print(index, print_chat, "YOU DID");
    rg_observer_find_next_player(index, true, "");
    return PLUGIN_HANDLED;
}