AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved [METAMOD] Check if is player is bot (https://forums.alliedmods.net/showthread.php?t=308954)

^SmileY 07-08-2018 22:02

[METAMOD] Check if is player is bot
 
hi all, i am writing a metamod plugin and creating some native/raw functions that uses edict_t *pEdict.
How i can get if the player is bot??

PHP Code:

void cMisc::ClientPrintColor(edict_t *pEdict,const char *Format,...)
{
    if(
this->SayText == NULL)
    {
        
SayText GET_USER_MSG_ID(PLID,"SayText",NULL);
    }

    
char Buffer[192] = {0};

    
va_list pArgs;
    
va_start(pArgs,Format);
    
vsprintf(&Buffer[0],Format,pArgs);
    
va_end(pArgs);

    if(
pEdict == NULL)
    {
        
edict_t *pEntity NULL;

        for(
int i 1;<= gpGlobals->maxClients;i++)
        {
            
pEntity INDEXENT(i);
            
            if(
FNullEnt(pEntity) || pEntity->free)
            {
                continue;
            }

            
MESSAGE_BEGIN(MSG_ONE_UNRELIABLE,this->SayText,NULL,pEntity);
            
WRITE_BYTE(i);
            
WRITE_STRING(Buffer);
            
MESSAGE_END();
        }
    }
    else
    {
        if(
FNullEnt(pEdict) || pEdict->free)
        {
            return;
        }

        
MESSAGE_BEGIN(MSG_ONE_UNRELIABLE,this->SayText,NULL,pEdict);
        
WRITE_BYTE(ENTINDEX(pEdict));
        
WRITE_STRING(Buffer);
        
MESSAGE_END();
    }


Ps. Im not using amxx interface for plugin it is for metamod-p.

fysiks 07-09-2018 01:34

Re: [METAMOD] Check if is player is bot
 
You are currently posting in the AMX Mod X plugin Scripting Help which is extremely different than metamod plugins. While this topic isn't technically supported here, you'll probably have better luck with posting in the Modules section since that at least has the same programming language.

Ghosted 07-09-2018 02:25

Re: [METAMOD] Check if is player is bot
 
Check how AMXX is doing this.

Code:

{
        const char* auth= (*g_engfuncs.pfnGetPlayerAuthId)(pEdict);
        return ( auth && !strcmp( auth , "BOT" ) );
}


NiHiLaNTh 07-09-2018 04:17

Re: [METAMOD] Check if is player is bot
 
Bots might also have FL_FAKECLIENT flag.

^SmileY 07-09-2018 08:53

Re: [METAMOD] Check if is player is bot
 
Quote:

Originally Posted by NiHiLaNTh (Post 2602231)
Bots might also have FL_FAKECLIENT flag.

Yes i seen in other functions, thanks, i need to learn a bit more about bitsums :shock:

@Ghosted

I do not think this is a good idea with strings and calling directly g_engfuncs, since bots do not always have a "BOT" in their authid, that can return a false positive in some cases. Can work correctly for plugins

@fysiks

technically speaking modules are not same as an metamod plugin.
but i understand your point, since this is not a hard master question anyway

Ghosted 07-09-2018 09:06

Re: [METAMOD] Check if is player is bot
 
I just posted half of the code, theres also FL_FAKECLIENT code thats why i said
'Check how AMXX is doing this.'


All times are GMT -4. The time now is 18:02.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.