View Single Post
LinLinLin
Senior Member
Join Date: Sep 2021
Old 12-20-2022 , 01:50   Re: Is IsClientInGame() really includes IsClientConnected check?
Reply With Quote #2

i don't know this but this is the info i can found
PHP Code:
static cell_t sm_IsClientConnected(IPluginContext *pCtx, const cell_t *params)
{
    
int index params[1];
    if ((
index 1) || (index playerhelpers->GetMaxClients()))
    {
        return 
pCtx->ThrowNativeError("Client index %d is invalid"index);
    }

    return (
playerhelpers->GetGamePlayer(index)->IsConnected()) ? 0;
}

static 
cell_t sm_IsClientInGame(IPluginContext *pCtx, const cell_t *params)
{
    
int index params[1];
    if ((
index 1) || (index playerhelpers->GetMaxClients()))
    {
        return 
pCtx->ThrowNativeError("Client index %d is invalid"index);
    }

    return (
playerhelpers->GetGamePlayer(index)->IsInGame()) ? 0;

PHP Code:
namespace SourceMod
{
    
/**
     * @brief Abstracts some Half-Life 2 and SourceMod properties about clients.
     */
    
class IGamePlayer
    
{
    public:
        
/**
         * @brief Returns whether the player is in game (putinserver).
         *
         * @return        True if in game, false otherwise.
         */
        
virtual bool IsInGame() =0;

        
/**
         * @brief Returns whether the player is connected.
         *
         * Note: If this returns true, all above functions except for
         * GetAuthString() should return non-NULL results.
         *
         * @return        True if connected, false otherwise.
         */
        
virtual bool IsConnected() =0
LinLinLin is offline