I have corrected a problem a plug-in
Code:
#pragma semicolon 1
#include <sourcemod>
new Handle:Allowed = INVALID_HANDLE;
new RoundEndCounter = 0;
public OnPluginStart()
{
decl String:ModName[50];
GetGameFolderName(ModName, sizeof(ModName));
if(!StrEqual(ModName, "left4dead", false))
{
SetFailState("Use this Left 4 Dead only.");
}
HookEvent("round_end", Event_RoundEnd);
Allowed = CreateConVar("sm_l4dvs_mapchangeforce", "1", "Enables Force changelevel when mission end.");
// Execute the config file
AutoExecConfig(true, "sm_l4dvs_mapchanger");
}
public OnMapStart()
{
RoundEndCounter = 0;
}
public Action:Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
if(GetConVarInt(Allowed))
{
decl String:currentMap[64];
GetCurrentMap(currentMap, 64);
if (StrEqual(currentMap, "l4d_vs_farm05_cornfield") == true || StrEqual(currentMap, "l4d_vs_hospital05_rooftop") == true)
{
RoundEndCounter += 1;
if (RoundEndCounter == 4 && StrEqual(currentMap, "l4d_vs_farm05_cornfield") == true)
{
for (new player=1; player<=GetMaxClients(); player++)
{
if (IsClientInGame(player) && IsFakeClient(player))
{
ServerCommand("kick %s", player);
}
}
ServerCommand("changelevel %s", "l4d_vs_hospital01_apartment");
}
if (RoundEndCounter == 4 && StrEqual(currentMap, "l4d_vs_hospital05_rooftop") == true)
{
for (new player=1; player<=GetMaxClients(); player++)
{
if (IsClientInGame(player) && IsFakeClient(player))
{
ServerCommand("kick %s", player);
}
}
ServerCommand("changelevel %s", "l4d_vs_farm01_hilltop");
}
}
}
}