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

IsClientInGame" reported: Client index 0 is invalid


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ScorpFire
Member
Join Date: Sep 2011
Old 06-27-2012 , 00:01   IsClientInGame" reported: Client index 0 is invalid
Reply With Quote #1

Hello guys

I have a CSS 48 zombie server. SM and MM are up to date. The code below (line 61) is giving me the error

Quote:
[SM] Native "IsClientInGame" reported: Client index 0 is invalid
Code:
public EnDamage(Handle:event, const String:name[], bool:dontBroadcast)
{

        new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));

    if (!IsClientInGame(attacker))
        return;

    if (IsPlayerAlive(attacker))
    {
           new client = GetClientOfUserId(GetEventInt(event, "userid"));


           if(ZR_IsClientHuman(attacker) && ZR_IsClientZombie(client))
           {
             decl String:weapon[WEAPONS_MAX_LENGTH];
             GetEventString(event, "weapon", weapon, sizeof(weapon));
    
             if(StrEqual(weapon, "knife", false))
             {
                        g_ZombieExplode[client] = true;

                        PrintToChat(client, "\x04[SM_ZombieExplode3] \x05you have %f seconds to catch any human or you will die!", GetConVarFloat(tiempo),attacker);

                        CreateTimer(GetConVarFloat(tiempo), ByeZM, client);
             }
            }
            else if(ZR_IsClientHuman(client) && ZR_IsClientZombie(attacker) && g_ZombieExplode[attacker])
            {
                        g_ZombieExplode[attacker] = false;
                        PrintToChat(attacker, "\x04[SM_ZombieExplode3] \x05you have caught a human then you have saved!");
            }

        }

}
Can anyone please help? THanks in advance
ScorpFire is offline
-Absolute-
Member
Join Date: Mar 2010
Old 06-27-2012 , 00:29   Re: IsClientInGame" reported: Client index 0 is invalid
Reply With Quote #2

Check if client > 0, because the entity with the index 0 can never be a client.

This would happen if someone damages himself (by falling for example)

Last edited by -Absolute-; 06-27-2012 at 00:30.
-Absolute- is offline
ScorpFire
Member
Join Date: Sep 2011
Old 06-27-2012 , 00:30   Re: IsClientInGame" reported: Client index 0 is invalid
Reply With Quote #3

Oops, are bots index 0

Cus i was testing in on a server with bots
ScorpFire is offline
ReFlexPoison
☠☠☠
Join Date: Jul 2011
Location: ☠☠☠
Old 06-27-2012 , 02:19   Re: IsClientInGame" reported: Client index 0 is invalid
Reply With Quote #4

Quote:
Originally Posted by ScorpFire View Post
Oops, are bots index 0

Cus i was testing in on a server with bots
No, bots are recognized as regular client except for the when checking IsFakeClient(). The actual server is client 0, which is why it resulted in error.
ReFlexPoison is offline
ScorpFire
Member
Join Date: Sep 2011
Old 06-27-2012 , 02:54   Re: IsClientInGame" reported: Client index 0 is invalid
Reply With Quote #5

erm so the error is harmless?
ScorpFire is offline
Zylius
SourceMod Donor
Join Date: Nov 2009
Old 06-27-2012 , 04:11   Re: IsClientInGame" reported: Client index 0 is invalid
Reply With Quote #6

Quote:
Originally Posted by ScorpFire View Post
erm so the error is harmless?
Nope, it breaks your loop if you have one.
Zylius is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 06-27-2012 , 09:02   Re: IsClientInGame" reported: Client index 0 is invalid
Reply With Quote #7

o.O it doesn't break the loop.

it completely cancels the current runtime execution flow.
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
Zylius
SourceMod Donor
Join Date: Nov 2009
Old 06-27-2012 , 09:52   Re: IsClientInGame" reported: Client index 0 is invalid
Reply With Quote #8

Quote:
Originally Posted by berni View Post
o.O it doesn't break the loop.

it completely cancels the current runtime execution flow.
MM I know that, but I thought that was the most noticeable effect of an error like that given the situation it's in.

Last edited by Zylius; 06-27-2012 at 09:54.
Zylius is offline
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 06-27-2012 , 10:26   Re: IsClientInGame" reported: Client index 0 is invalid
Reply With Quote #9

Quote:
Originally Posted by berni View Post
o.O it doesn't break the loop.

it completely cancels the current runtime execution flow.
It goes boom.
__________________
Dr. McKay is offline
Jargon
SourceMod Donor
Join Date: Jun 2012
Location: Sydney, Australia
Old 06-28-2012 , 00:19   Re: IsClientInGame" reported: Client index 0 is invalid
Reply With Quote #10

Also getting this issue, tried asking the author with no response:
https://forums.alliedmods.net/showpo...00&postcount=5

Can anyone else possibly see the error in this code?
Jargon 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 00:26.


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