Bara / Multi-Colors

Multi Colors (based on Stamm-Colors) is a summary of Colors and More Colors. Depending on the game More Colors will be used as default. Should the game be CS:GO Colors will be used. The include providing a perfect base for plugins supporting multiple games.
https://forums.alliedmods.net/showthread.php?t=247770
GNU General Public License v3.0
77 stars 26 forks source link

GetClientTeam: Client index 0 is invalid #4

Closed dragokas closed 4 years ago

dragokas commented 4 years ago

Hi,

L 01/06/2020 - 23:56:07: [SM] Exception reported: Client index 0 is invalid L 01/06/2020 - 23:56:07: [SM] Blaming: simplewelcomemsg.smx L 01/06/2020 - 23:56:07: [SM] Call stack trace: L 01/06/2020 - 23:56:07: [SM] [0] GetClientTeam L 01/06/2020 - 23:56:07: [SM] [1] Line 407, d:\dev\SourceMod\addons\sourcemod\scripting\include\colors.inc::C_Format L 01/06/2020 - 23:56:07: [SM] [2] Line 82, d:\dev\SourceMod\addons\sourcemod\scripting\include\colors.inc::C_PrintToChat L 01/06/2020 - 23:56:07: [SM] [3] Line 142, H:_To_games\Left4Dead_2\My_mods\Advertisements\SimpleWelcome\simplewelcomemsg.sp::ChatMessagesDisplay L 01/06/2020 - 23:56:07: [SM] [4] Line 125, H:_To_games\Left4Dead_2\My_mods\Advertisements\SimpleWelcome\simplewelcomemsg.sp::Timer_Welcome

colors.inc - Version: 2.0.0-MC (Author: exvel, Editor: Popoklopsi, Powerlord, Bara) Game: L4d1. src:

#include <colors>
Action ChatMessagesDisplay(int client)
{
    if (client && IsClientInGame(client))
    {
        if (g_iTankCount != 0)
            return Plugin_Continue;

        int iTotalLines = g_Cvar_LastLine.IntValue;
        g_iLineIdx[client]++;
        if ( g_iLineIdx[client] <= iTotalLines ) {
            static char msg[192];
            Format(msg, sizeof(msg), "WelcomeMsg%i", g_iLineIdx[client]);
            C_PrintToChat (client, "%t", msg, client);
            CPrintToConsoleEx(client, "%t", msg, client);
            return Plugin_Continue;
        }
        else {
            g_iLineIdx[client] = 0;
            CreateTimer (g_Cvar_PluginNextCycleTimer.FloatValue, Timer_BeginCycle, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);
            return Plugin_Stop;
        }
    }
    return Plugin_Stop;
}

Perhaps, I should use #include \<multicolors> like in your example. I just noticed it. However, I'm unsure it will resolve the issue (I not checked yet). Leave decision about is it bug or no on you own. Thanks.

Bara commented 4 years ago

Looks like an outdated/modified version. On line 82 is currently (master/322a81d) Format which shouldn't produce this error.

dragokas commented 4 years ago

Strange. Looks like modified version. Sorry for disturbing.

Bara commented 4 years ago

Feel free to open up it again, if you use the latest version and the issue still happens. ;)