Исправил, как вы и написали, всё равно ошибки:
Exception reported: Client 1 is not in gameL 10/17/2019 - 17:48:41: [SM] Blaming: l4d2_teamdisplay2_0-1.smxL 10/17/2019 - 17:48:41: [SM] Call stack trace:L 10/17/2019 - 17:48:41: [SM] [0] GetClientTeamL 10/17/2019 - 17:48:41: [SM] [1] Line 267, plugin.sp::TeampanelL 10/17/2019 - 17:48:41: [SM] [2] Line 597, plugin.sp::PAeL 10/17/2019 - 17:48:41: [SM] Exception reported: Client 1 is not in game
l4d2_teamdisplay2_0-1.sp
Ответ проблемы звучит в начале лога)
Exception reported: Client 1 is not in game RU: Сообщение об исключении: Клиент 1 не в игре
Меню открывается тогда когда игрока уже нету на сервере.
Добавить проверку на игрока
if (client) { остальной код }
Если что готовый кусок тут
Скрытый текст
public void Teampanel(int client) { if (client) { int surcount = 0; int infcount = 0; int sepcount = 0; int surbotcount = 0; int infbotcount = 0; char CurrentMode[16]; GetConVarString(cvar_Gamemode, CurrentMode, sizeof(CurrentMode)); Handle downtownrun = FindConVar("l4d_maxplayers"); Handle toolzrun = FindConVar("sv_maxplayers"); int maxcl; if (downtownrun == INVALID_HANDLE) { //Nothing } if (downtownrun != INVALID_HANDLE) { int downtown = GetConVarInt(FindConVar("l4d_maxplayers")); if (downtown >= 1) { maxcl = (GetConVarInt(FindConVar("l4d_maxplayers"))); } } if (toolzrun == INVALID_HANDLE) { //Nothing } if (toolzrun != INVALID_HANDLE) { int toolz = GetConVarInt(FindConVar("sv_maxplayers")); if (toolz >= 1) { maxcl = GetConVarInt(FindConVar("sv_maxplayers")); } } if (downtownrun == INVALID_HANDLE && toolzrun == INVALID_HANDLE) { maxcl = (MaxClients); } int maxplayers = GetMaxClients(); for (int i = 1; i <= maxplayers; i++) { if(!IsClientInGame(i) || !IsClientConnected(i)) continue; if(GetClientTeam(i) != 2) continue; if(!IsFakeClient(i)) continue; surbotcount++; } for (int i = 1; i <= maxplayers; i++) { if(!IsClientInGame(i) || !IsClientConnected(i)) continue; if(GetClientTeam(i) != 3) continue; if(!IsFakeClient(i)) continue; infbotcount++; } Handle TeamPanel = CreatePanel(); SetPanelTitle(TeamPanel, "Team Displayer"); DrawPanelText(TeamPanel, " \n"); if (GetClientTeam(client) == 1 && GetConVarInt(PanelDisplayCVAR) == 0 || GetClientTeam(client) == 2 && GetConVarInt(PanelDisplayCVAR) == 0 || GetClientTeam(client) == 1 && GetConVarInt(PanelDisplayCVAR) == 2 || GetClientTeam(client) == 2 && GetConVarInt(PanelDisplayCVAR) == 2 || GetClientTeam(client) == 3 && GetConVarInt(PanelDisplayCVAR) == 0 || GetClientTeam(client) == 3 && GetConVarInt(PanelDisplayCVAR) == 2 || GetClientTeam(client) == 1 && GetConVarInt(PanelDisplayCVAR) == 1 || GetClientTeam(client) == 2 && GetConVarInt(PanelDisplayCVAR) == 1) { DrawPanelText(TeamPanel, "Survivor:"); for (int i = 1; i <= GetMaxClients(); i++) { if (!IsClientConnected(i)) continue; if (!IsClientInGame(i)) continue; if (GetClientTeam(i) != 2) continue; char name[64]; GetClientName(i, name, sizeof(name)); surcount++; if (GetClientTeam(client) == 3 && GetConVarInt(PanelDisplayCVAR) == 2) { DrawPanelText(TeamPanel, name); } else { if (!IsPlayerAlive(i)) { char addoutput[256]; Format(addoutput, sizeof(addoutput), "%s (Мертв) ", name); DrawPanelText(TeamPanel, addoutput); } else if (IsPlayerAlive(i)) { int hp = GetClientHealth(i); char i1[32]; char i2[32]; char i3[32]; int i1d = GetPlayerWeaponSlot(i, 3); if (i1d == -1||i1d == 0) { Format(i1, sizeof(i1), "Empty"); } else if (!IsValidEntity(i1d)) { Format(i1, sizeof(i1), "Empty"); } else { char i1string[64]; GetEdictClassname(i1d, i1string, sizeof(i1string)); if (StrEqual(i1string, "weapon_first_aid_kit", false)) { Format(i1, sizeof(i1), "Аптека"); } else if (StrEqual(i1string, "weapon_defibrillator", false)) { Format(i1, sizeof(i1), "Утюги"); } else if (StrEqual(i1string, "weapon_upgradepack_explosive", false)) { Format(i1, sizeof(i1), "E Ammo Pack"); } else if (StrEqual(i1string, "weapon_upgradepack_incendiary", false)) { Format(i1, sizeof(i1), "I Ammo Pack"); } } int i2d = GetPlayerWeaponSlot(i, 2); if (i2d == -1||i2d == 0) { Format(i2, sizeof(i2), "Empty"); } else if (!IsValidEntity(i2d)) { Format(i2, sizeof(i2), "Empty"); } else { char i2string[64]; GetEdictClassname(i2d, i2string, sizeof(i2string)); if (StrEqual(i2string, "weapon_molotov", false)) { Format(i2, sizeof(i2), "Молотов"); } else if (StrEqual(i2string, "weapon_pipe_bomb", false)) { Format(i2, sizeof(i2), "Пайпа"); } else if (StrEqual(i2string, "weapon_vomitjar", false)) { Format(i2, sizeof(i2), "Блевота"); } } int i3d = GetPlayerWeaponSlot(i, 4); if (i3d == -1||i3d == 0) { Format(i3, sizeof(i3), "Empty"); } else if (!IsValidEntity(i3d)) { Format(i3, sizeof(i3), "Empty"); } else { char i3string[64]; GetEdictClassname(i3d, i3string, sizeof(i3string)); if (StrEqual(i3string, "weapon_adrenaline", false)) { Format(i3, sizeof(i3), "Адреналин"); } else if (StrEqual(i3string, "weapon_pain_pills", false)) { Format(i3, sizeof(i3), "Таблетки"); } } if (IsPlayerIncapped(i)) { char addoutput[256]; Format(addoutput, sizeof(addoutput), "%s (Упал) HP:%d %s %s %s", name, hp,i2,i1,i3); DrawPanelText(TeamPanel, addoutput); } else { char addoutput[256]; Format(addoutput, sizeof(addoutput), "%s HP:%d %s %s %s", name, hp,i2,i1,i3); DrawPanelText(TeamPanel, addoutput); } } } } } if (GetClientTeam(client)==1 && GetConVarInt(PanelDisplayCVAR)==0 || GetClientTeam(client)==2 && GetConVarInt(PanelDisplayCVAR)==0 || GetClientTeam(client)==1 && GetConVarInt(PanelDisplayCVAR)==2 || GetClientTeam(client)==2 && GetConVarInt(PanelDisplayCVAR)==2|| GetClientTeam(client)==3 && GetConVarInt(PanelDisplayCVAR)==0|| GetClientTeam(client)==3 && GetConVarInt(PanelDisplayCVAR)==2 || GetClientTeam(client)==1 && GetConVarInt(PanelDisplayCVAR)==1 || GetClientTeam(client)==3 && GetConVarInt(PanelDisplayCVAR)==1 ) { DrawPanelText(TeamPanel, "Infected:"); for (int i = 1; i <= GetMaxClients(); i++) { if (!IsClientConnected(i)) continue; if(!IsClientInGame(i)) continue; if(GetClientTeam(i) != 3) continue; char name[64]; GetClientName(i, name, sizeof(name)); infcount++; if (GetClientTeam(client)==2 && GetConVarInt(PanelDisplayCVAR)==2) { DrawPanelText(TeamPanel, name); } else { if (!IsPlayerAlive(i)) { char addoutput[256]; if (L4D_GetPlayerSpawnTime(i) < 0) { Format(addoutput, sizeof(addoutput), "%s (Мертв)", name); } else { Format(addoutput, sizeof(addoutput), "%s (Мертв %f)", name ,L4D_GetPlayerSpawnTime(i)); } DrawPanelText(TeamPanel, addoutput); } else { int n = GetEntProp(i, Prop_Send, "m_zombieClass"); char Class[32]; if (n == 1) { Format(Class, sizeof(Class), "Smoker"); } else if(n == 2) { Format(Class, sizeof(Class), "Boomer"); } else if(n == 3) { Format(Class, sizeof(Class), "Hunter"); } else if(n == 4) { Format(Class, sizeof(Class), "Spitter"); } else if(n == 5) { Format(Class, sizeof(Class), "Jockey"); } else if(n == 6) { Format(Class, sizeof(Class), "Charger"); } else if(n == 8) { Format(Class, sizeof(Class), "Tank"); } if (IsPlayerSpawnGhost(i)) { char addoutput[256]; Format(addoutput, sizeof(addoutput), "%s %s (Призрак)", name,Class); DrawPanelText(TeamPanel, addoutput); } else { char addoutput[256]; int hp = GetClientHealth(i); Format(addoutput, sizeof(addoutput), "%s %s HP:%d", name,Class, hp); DrawPanelText(TeamPanel, addoutput); } } } } } if (GetConVarInt(SedCVAR) == 1) { DrawPanelText(TeamPanel, " \n"); DrawPanelText(TeamPanel, "Spectator:"); for (int i = 1; i <= maxplayers; i++) { if(!IsClientConnected(i) ) continue; if (!IsClientInGame(i)) continue; if(GetClientTeam(i) != 1) continue; char name[64]; GetClientName(i, name, sizeof(name)); sepcount++; DrawPanelText(TeamPanel, name); } } char addoutput1[256]; int total = surcount + infcount + sepcount; int surreal = surcount - surbotcount; int infreal = infcount - infbotcount; int totalreal = surreal + infreal + sepcount; if (GetConVarInt(SedCVAR) == 1) { if (GetClientTeam(client)==2 && GetConVarInt(PanelDisplayCVAR)==1) { if (StrContains(CurrentMode, "versus", false) != -1 || StrContains(CurrentMode, "scavenge", false) != -1 || StrContains(CurrentMode, "mutation12", false) != -1) { Format(addoutput1, sizeof(addoutput1), "Total: %d(%d)/%d Выжившие: %d(%d)/%d Наблюдатели: %d", total, totalreal,maxcl, surcount,surreal,GetConVarInt(FindConVar("survivor_limit")), sepcount); } else { Format(addoutput1, sizeof(addoutput1), "Total: %d(%d) Выжившие: %d(%d)/%d Наблюдатели: %d", total, totalreal, surcount,surreal, maxcl, sepcount); } } else if (GetClientTeam(client)==3 && GetConVarInt(PanelDisplayCVAR)==1) { if (StrContains(CurrentMode, "versus", false) != -1 || StrContains(CurrentMode, "scavenge", false) != -1 || StrContains(CurrentMode, "mutation12", false) != -1) { Format(addoutput1, sizeof(addoutput1), "Total: %d(%d)/%d Зараженные: %d(%d)/%d Наблюдатели: %d", total, totalreal,maxcl, infcount,infreal,GetConVarInt(FindConVar("z_max_player_zombies")), sepcount); } else { Format(addoutput1, sizeof(addoutput1), "Total: %d(%d) Зараженные: %d(%d) Наблюдатели: %d", total, totalreal, infcount,infreal, sepcount); } } else { if (StrContains(CurrentMode, "versus", false) != -1 || StrContains(CurrentMode, "scavenge", false) != -1 || StrContains(CurrentMode, "mutation12", false) != -1) { Format(addoutput1, sizeof(addoutput1), "Total: %d(%d)/%d Выжившие: %d(%d)/%d Зараженные: %d(%d)/%d Наблюдатели: %d", total, totalreal,maxcl, surcount,surreal,GetConVarInt(FindConVar("survivor_limit")), infcount,infreal,GetConVarInt(FindConVar("z_max_player_zombies")), sepcount); } else { Format(addoutput1, sizeof(addoutput1), "Total: %d(%d) Выжившие: %d(%d)/%d Зараженные: %d(%d) Наблюдатели: %d", total, totalreal, surcount,surreal, maxcl, infcount,infreal, sepcount); } } } else { if (GetClientTeam(client)==2 && GetConVarInt(PanelDisplayCVAR)==1) { if (StrContains(CurrentMode, "versus", false) != -1 || StrContains(CurrentMode, "scavenge", false) != -1 || StrContains(CurrentMode, "mutation12", false) != -1) { Format(addoutput1, sizeof(addoutput1), "Total: %d(%d)/%d Выжившие: %d(%d)/%d ", total, totalreal,maxcl, surcount,surreal,GetConVarInt(FindConVar("survivor_limit"))); } else { Format(addoutput1, sizeof(addoutput1), "Total: %d(%d) Выжившие: %d(%d)/%d ", total, totalreal, surcount,surreal, maxcl); } } else if (GetClientTeam(client)==3 && GetConVarInt(PanelDisplayCVAR)==1) { if (StrContains(CurrentMode, "versus", false) != -1 || StrContains(CurrentMode, "scavenge", false) != -1 || StrContains(CurrentMode, "mutation12", false) != -1) { Format(addoutput1, sizeof(addoutput1), "Total: %d(%d)/%d Зараженные: %d(%d)/%d ", total, totalreal,maxcl, infcount,infreal,GetConVarInt(FindConVar("z_max_player_zombies"))); } else { Format(addoutput1, sizeof(addoutput1), "Total: %d(%d) Зараженные: %d(%d) ", total, totalreal,infcount,infreal); } } else { if (StrContains(CurrentMode, "versus", false) != -1 || StrContains(CurrentMode, "scavenge", false) != -1 || StrContains(CurrentMode, "mutation12", false) != -1) { Format(addoutput1, sizeof(addoutput1), "Total: %d(%d)/%d Выжившие: %d(%d)/%d Зараженные: %d(%d)/%d ", total, totalreal,maxcl, surcount,surreal,GetConVarInt(FindConVar("survivor_limit")), infcount,infreal,GetConVarInt(FindConVar("z_max_player_zombies"))); } else { Format(addoutput1, sizeof(addoutput1), "Total: %d(%d) Выжившие: %d(%d)/%d Зараженные: %d(%d) ", total, totalreal, surcount,surreal, maxcl, infcount,infreal); } } } DrawPanelText(TeamPanel, addoutput1); SendPanelToClient(TeamPanel, client, TeamPanelHandler, GetConVarInt(timeoutCVAR)); CloseHandle(TeamPanel); } }
Я уже как-то писал что у меня есть похожий плагин но немного отличается кодом и не только. Могу его дать если интересно. Правад там переделана на открытие и закрытие командой !list
Если что в ЛС могу скинуть.
Сообщение отредактировал dr_lex: 17 Октябрь 2019 - 18:59