Raised This Month: $32 Target: $400
 8% 

Solved [METAMOD] Check if is player is bot


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 07-08-2018 , 22:02   [METAMOD] Check if is player is bot
Reply With Quote #1

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.
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 

Last edited by ^SmileY; 07-09-2018 at 08:54.
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-09-2018 , 01:34   Re: [METAMOD] Check if is player is bot
Reply With Quote #2

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.
__________________
fysiks is offline
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 07-09-2018 , 02:25   Re: [METAMOD] Check if is player is bot
Reply With Quote #3

Check how AMXX is doing this.

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

[MOD] CS Weapon Mod V1.7.1
[MM] MetaMod-C V1.0
[MOD] CS NPC Mod (5%)


Probably Left AM
Ghosted is offline
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 07-09-2018 , 04:17   Re: [METAMOD] Check if is player is bot
Reply With Quote #4

Bots might also have FL_FAKECLIENT flag.
__________________

NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 07-09-2018 , 08:53   Re: [METAMOD] Check if is player is bot
Reply With Quote #5

Quote:
Originally Posted by NiHiLaNTh View Post
Bots might also have FL_FAKECLIENT flag.
Yes i seen in other functions, thanks, i need to learn a bit more about bitsums

@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
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 07-09-2018 , 09:06   Re: [METAMOD] Check if is player is bot
Reply With Quote #6

I just posted half of the code, theres also FL_FAKECLIENT code thats why i said
'Check how AMXX is doing this.'
__________________

[MOD] CS Weapon Mod V1.7.1
[MM] MetaMod-C V1.0
[MOD] CS NPC Mod (5%)


Probably Left AM
Ghosted is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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