Raised This Month: $51 Target: $400
 12% 

GetClientTeam Check Client In-Game


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SilentJudge
Member
Join Date: Jan 2009
Old 03-03-2009 , 13:37   GetClientTeam Check Client In-Game
Reply With Quote #1

I'm getting this error
PHP Code:
L 03/02/2009 22:29:52: [SMNative "GetClientTeam" reportedClient 3 is not in game 
from this block of code:
PHP Code:
    if (!IsClientConnected(client))
        return 
Plugin_Continue;

    new 
team GetClientTeam(client); 
Should I change it to this?
PHP Code:
    if (!IsClientConnected(client) || !IsClientInGame(client))
        return 
Plugin_Continue;

    new 
team GetClientTeam(client); 
Thanks.
__________________
SilentJudge is offline
antihacker
Member
Join Date: Feb 2009
Old 03-03-2009 , 14:09   Re: GetClientTeam Check Client In-Game
Reply With Quote #2

The Error is Client 3 is not in game, so we have to test if the play is ingame with IsClientInGame.

PHP Code:
if (!IsClientInGame(client))
{
    return 
Plugin_Continue;
}

new 
team GetClientTeam(client); 
antihacker is offline
SilentJudge
Member
Join Date: Jan 2009
Old 03-03-2009 , 14:46   Re: GetClientTeam Check Client In-Game
Reply With Quote #3

Ok, so your saying the IsClientConnected is redundant and I only need IsClientInGame?
__________________
SilentJudge is offline
Lebson506th
Veteran Member
Join Date: Jul 2008
Old 03-03-2009 , 17:27   Re: GetClientTeam Check Client In-Game
Reply With Quote #4

Yes.

IsClientInGame returns true after the client is completely in game, rather than just connected to the server.
__________________
My Plugins
Spray Tracer by Nican, maintained by me
Simple TK Manager
DoD:S Admin Weapons

Links
Resistance and Liberation (A HL2 Multiplayer Modification)
Lebson506th is offline
Milo|
Member
Join Date: Jan 2009
Location: Netherlands
Old 03-06-2009 , 07:12   Re: GetClientTeam Check Client In-Game
Reply With Quote #5

Not true.

You still need IsClientConnected to see if its a valid client index. If you pass an invalid one to IsClientInGame or GetClientTeam it will result in errors.
__________________
A few small plugins i released for the general public:
Milo| is offline
Lebson506th
Veteran Member
Join Date: Jul 2008
Old 03-06-2009 , 07:24   Re: GetClientTeam Check Client In-Game
Reply With Quote #6

if(client && IsClientInGame(client)) works fine too.
__________________
My Plugins
Spray Tracer by Nican, maintained by me
Simple TK Manager
DoD:S Admin Weapons

Links
Resistance and Liberation (A HL2 Multiplayer Modification)
Lebson506th 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 11:51.


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