Skip to content

Commit

Permalink
Replace IsClientConnected with IsClientInGame
Browse files Browse the repository at this point in the history
With this i had more success as IsClientConnected, with IsClientConnected i had some errors with client isn't ingame.
  • Loading branch information
Bara committed Oct 30, 2018
1 parent 2a4331e commit f5da352
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 15 deletions.
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/ghostdm.sp
Expand Up @@ -732,7 +732,7 @@ bool IsClientValid(int client, bool nobots = false)
{
if (client > 0 && client <= MaxClients)
{
if (!IsClientConnected(client) || IsClientSourceTV(client) || !IsClientInGame(client))
if (IsClientSourceTV(client) || !IsClientInGame(client))
{
return false;
}
Expand Down
6 changes: 3 additions & 3 deletions addons/sourcemod/scripting/include/multicolors/colors.inc
Expand Up @@ -630,7 +630,7 @@ stock int C_ShowActivity(int client, const char[] format, any ...)
bool display_in_chat = false;
if (client != 0)
{
if (client < 0 || client > MaxClients || !IsClientConnected(client))
if (client < 0 || client > MaxClients || !IsClientInGame(client))
ThrowError("Client index %d is invalid", client);

GetClientName(client, name, sizeof(name));
Expand Down Expand Up @@ -744,7 +744,7 @@ stock int C_ShowActivityEx(int client, const char[] tag, const char[] format, an
bool display_in_chat = false;
if (client != 0)
{
if (client < 0 || client > MaxClients || !IsClientConnected(client))
if (client < 0 || client > MaxClients || !IsClientInGame(client))
ThrowError("Client index %d is invalid", client);

GetClientName(client, name, sizeof(name));
Expand Down Expand Up @@ -859,7 +859,7 @@ stock int C_ShowActivity2(int client, const char[] tag, const char[] format, any
char sign[MAX_NAME_LENGTH] = "ADMIN";
if (client != 0)
{
if (client < 0 || client > MaxClients || !IsClientConnected(client))
if (client < 0 || client > MaxClients || !IsClientInGame(client))
ThrowError("Client index %d is invalid", client);

GetClientName(client, name, sizeof(name));
Expand Down
6 changes: 3 additions & 3 deletions addons/sourcemod/scripting/include/multicolors/morecolors.inc
Expand Up @@ -422,7 +422,7 @@ stock int MC_ShowActivity(int client, const char[] format, any ...)
bool display_in_chat = false;
if (client != 0)
{
if (client < 0 || client > MaxClients || !IsClientConnected(client))
if (client < 0 || client > MaxClients || !IsClientInGame(client))
ThrowError("Client index %d is invalid", client);

GetClientName(client, name, sizeof(name));
Expand Down Expand Up @@ -535,7 +535,7 @@ stock int MC_ShowActivityEx(int client, const char[] tag, const char[] format, a
bool display_in_chat = false;
if (client != 0)
{
if (client < 0 || client > MaxClients || !IsClientConnected(client))
if (client < 0 || client > MaxClients || !IsClientInGame(client))
ThrowError("Client index %d is invalid", client);

GetClientName(client, name, sizeof(name));
Expand Down Expand Up @@ -649,7 +649,7 @@ stock int MC_ShowActivity2(int client, const char[] tag, const char[] format, an
char sign[MAX_NAME_LENGTH] = "ADMIN";
if (client != 0)
{
if (client < 0 || client > MaxClients || !IsClientConnected(client))
if (client < 0 || client > MaxClients || !IsClientInGame(client))
ThrowError("Client index %d is invalid", client);

GetClientName(client, name, sizeof(name));
Expand Down
9 changes: 2 additions & 7 deletions addons/sourcemod/scripting/include/ttt.inc
Expand Up @@ -629,17 +629,12 @@ stock bool TTT_IsClientValid(int client)
{
if (client > 0 && client <= MaxClients)
{
if (!IsClientConnected(client))
{
return false;
}

if (IsClientSourceTV(client))
if (!IsClientInGame(client))
{
return false;
}

if (!IsClientInGame(client))
if (IsClientSourceTV(client))
{
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/tests/commands.sp
Expand Up @@ -24,7 +24,7 @@ public Action Command_CheckGOTV(int client, int args)
{
for (int i = 1; i <= MaxClients; i++)
{
ReplyToCommand(client, "i: %d, Name: %N, IsFakeClient: %d, IsClientSourceTV: %d, IsClientConnected: %d, IsClientInGame: %d, IsPlayerAlive: %d", i, i, IsFakeClient(i), IsClientSourceTV(i), IsClientConnected(i), IsClientInGame(i), IsPlayerAlive(i));
ReplyToCommand(client, "i: %d, Name: %N, IsFakeClient: %d, IsClientSourceTV: %d, IsClientInGame: %d, IsPlayerAlive: %d", i, i, IsFakeClient(i), IsClientSourceTV(i), IsClientInGame(i), IsPlayerAlive(i));
}
}

Expand Down

0 comments on commit f5da352

Please sign in to comment.