Raised This Month: $ Target: $400
 0% 

Is Player Controlling a Bot?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 09-23-2013 , 18:06   Re: Is Player Controlling a Bot?
Reply With Quote #4

Might still be prudent to check if the netprop exists in the first place, at the expense of using OnPluginStart too (unless you don't mind checking it's availability every use). Also handles FindSendPropInfo returning 0 too, though this code could be used for any boolean netprop, mind you.
PHP Code:
new bool:g_bIsAvailable;

public 
OnPluginStart()
{
    
g_bIsAvailable = (FindSendPropInfo("CBasePlayer""m_bIsControllingBot") > 0);
}

bool:IsPlayerControllingBot(const client
{
    return (
g_bIsAvailable && GetEntProp(clientProp_Send"m_bIsControllingBot") == 1);

__________________

Last edited by 11530; 09-23-2013 at 18:32.
11530 is offline
 



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:34.


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