[CSS] Переделать плагин

Nikolay4

Участник
Сообщения
2
Реакции
0
Приветствую.
Необходимо переделать плагин Frag Battle, а именно, убрать смену карты, чтобы просто заканчивался раунд. и счет начинался по новой.

Связь - VK
 

AlmazON

Не путать с самим yand3xmail
Сообщения
5,099
Реакции
2,756
убрать смену карты, чтобы просто заканчивался раунд. и счет начинался по новой
PHP:
#include <sourcemod>
#include <sdktools>
#include <cstrike>

#pragma semicolon 1

#define DATA "1.1.2NoMapchange"

new MuertesCT;
new MuertesT;

new bool:GanadoCT;
new bool:GanadoT;

new bool:is_cstrike;

new g_iGoal;

public Plugin:myinfo =
{
	name = "SM Frag Battle",
	author = "Franc1sco Steam: franug & AlmazON",
	description = "Frag battle",
	version = DATA,
	url = "www.uea-clan.com"
};

public OnPluginStart()
{
	HookEvent("player_death", playerDeath);

	decl Handle:cvar_Goal, EngineVersion:engine;
	HookConVarChange(cvar_Goal = CreateConVar("sm_fragbattle_goal", "500", "Goal for win.", _, true, 1.0), ChangeCvar_Goal);
	g_iGoal = GetConVarInt(cvar_Goal);
	CreateConVar("sm_fragbattle_version", DATA, "Frag Battle version.", FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);

	if((engine = GetEngineVersion()) == Engine_CSS || engine == Engine_CSGO) is_cstrike = true;
}

public ChangeCvar_Goal(Handle:convar, String:oldValue[], String:newValue[]) g_iGoal = GetConVarInt(convar);

public OnConfigsExecuted()
{
	ResetAll();
	CreateTimer(1.0, Temporizador, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
}

public Action:Temporizador(Handle:timer)
{
	decl String:Mensaje[256], clients[MaxClients], Handle:hBuffer;

	if(GanadoCT) FormatEx(Mensaje, sizeof(Mensaje), "Frag Battle\nCounter-Terrorist Win!\nT          CT\n%i          %i", g_iGoal, MuertesT, MuertesCT);
	else if(GanadoT) FormatEx(Mensaje, sizeof(Mensaje), "Frag Battle\nTerrorist Win!\nT          CT\n%i          %i", g_iGoal, MuertesT, MuertesCT);
	else FormatEx(Mensaje, sizeof(Mensaje), "Frag Battle\nGoal: %i\nT          CT\n%i          %i", g_iGoal, MuertesT, MuertesCT);

	new numClients;
	for (new i = 1; i <= MaxClients; ++i)
	{
		if(IsClientInGame(i) && !IsFakeClient(i)) clients[numClients++] = i;
	}
	// Send our message
	BfWriteByte(hBuffer = StartMessage("KeyHintText", clients, numClients), 1);
	BfWriteString(hBuffer, Mensaje);
	EndMessage();
	return Plugin_Continue;
}

public playerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
	if(!GanadoCT && !GanadoT)
	{
		decl attacker;
		if((attacker = GetClientOfUserId(GetEventInt(event, "attacker"))))
		{
			decl team;
			if((team = GetClientTeam(attacker)) != GetClientTeam(GetClientOfUserId(GetEventInt(event, "userid"))))
			{
				switch (team)
				{
					case CS_TEAM_T:
					{
						if(++MuertesT >= g_iGoal) FinT();
					}
					case CS_TEAM_CT:
					{
						if(++MuertesCT >= g_iGoal) FinCT();
					}
				}
			}
		}
	}
}

FinCT()
{
	GanadoCT = true;
	PrintToChatAll("\x04[Frag Battle] \x03Counter-Terrorist win the Frag Battle!");
	if(is_cstrike) CS_TerminateRound(5.0, CSRoundEnd_CTWin);
	else
	{
		for (new client=1; client<=MaxClients; ++client)
			if (IsClientInGame(client) && IsPlayerAlive(client) && GetClientTeam(client) == CS_TEAM_T)
				ForcePlayerSuicide(client);
	}
	CreateTimer(5.0, NewGame, _, TIMER_FLAG_NO_MAPCHANGE);
}

FinT()
{
	GanadoT = true;
	PrintToChatAll("\x04[Frag Battle] \x03Terrorist win the Frag Battle!");
	if(is_cstrike) CS_TerminateRound(5.0, CSRoundEnd_TerroristWin);
	else
	{
		for (new client=1; client<=MaxClients; ++client)
			if (IsClientInGame(client) && IsPlayerAlive(client) && GetClientTeam(client) == CS_TEAM_CT)
				ForcePlayerSuicide(client);
	}
	CreateTimer(5.0, NewGame, _, TIMER_FLAG_NO_MAPCHANGE);
}

public Action:NewGame(Handle:timer)
{
	ResetAll();
	Temporizador(timer);
	return Plugin_Stop;
}

public OnClientDisconnect_Post(client)
{
	if(!GetClientCount()) ResetAll();
}

ResetAll()
{
	MuertesCT = 0;
	MuertesT = 0;
	GanadoCT = false;
	GanadoT = false;
}
 
Последнее редактирование:

Nikolay4

Участник
Сообщения
2
Реакции
0
PHP:
#include <sourcemod>
#include <sdktools>
#include <cstrike>

#pragma semicolon 1

#define DATA "1.1.2NoMapchange"

new MuertesCT;
new MuertesT;

new bool:GanadoCT;
new bool:GanadoT;

new bool:is_cstrike;

new g_iGoal;

public Plugin:myinfo =
{
    name = "SM Frag Battle",
    author = "Franc1sco Steam: franug & AlmazON",
    description = "Frag battle",
    version = DATA,
    url = "www.uea-clan.com"
};

public OnPluginStart()
{
    HookEvent("player_death", playerDeath);

    decl Handle:cvar_Goal, EngineVersion:engine;
    HookConVarChange(cvar_Goal = CreateConVar("sm_fragbattle_goal", "500", "Goal for win.", _, true, 1.0), ChangeCvar_Goal);
    g_iGoal = GetConVarInt(cvar_Goal);
    CreateConVar("sm_fragbattle_version", DATA, "Frag Battle version.", FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);

    if((engine = GetEngineVersion()) == Engine_CSS || engine == Engine_CSGO) is_cstrike = true;
}

public ChangeCvar_Goal(Handle:convar, String:oldValue[], String:newValue[]) g_iGoal = GetConVarInt(convar);

public OnConfigsExecuted()
{
    ResetAll();
    CreateTimer(1.0, Temporizador, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
}

public Action:Temporizador(Handle:timer)
{
    decl String:Mensaje[256], clients[MaxClients], Handle:hBuffer;

    if(GanadoCT) FormatEx(Mensaje, sizeof(Mensaje), "Frag Battle\nCounter-Terrorist Win!\nT          CT\n%i          %i", g_iGoal, MuertesT, MuertesCT);
    else if(GanadoT) FormatEx(Mensaje, sizeof(Mensaje), "Frag Battle\nTerrorist Win!\nT          CT\n%i          %i", g_iGoal, MuertesT, MuertesCT);
    else FormatEx(Mensaje, sizeof(Mensaje), "Frag Battle\nGoal: %i\nT          CT\n%i          %i", g_iGoal, MuertesT, MuertesCT);

    new numClients;
    for (new i = 1; i <= MaxClients; ++i)
    {
        if(IsClientInGame(i) && !IsFakeClient(i)) clients[numClients++] = i;
    }
    // Send our message
    BfWriteByte(hBuffer = StartMessage("KeyHintText", clients, numClients), 1);
    BfWriteString(hBuffer, Mensaje);
    EndMessage();
    return Plugin_Continue;
}

public playerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    if(!GanadoCT && !GanadoT)
    {
        decl attacker;
        if((attacker = GetClientOfUserId(GetEventInt(event, "attacker"))))
        {
            if(GetClientTeam(attacker) != GetClientTeam(GetClientOfUserId(GetEventInt(event, "userid"))))
            {
                switch (GetClientTeam(attacker))
                {
                    case CS_TEAM_T:
                    {
                        if(++MuertesT >= g_iGoal) FinT();
                    }
                    case CS_TEAM_CT:
                    {
                        if(++MuertesCT >= g_iGoal) FinCT();
                    }
                }
            }
        }
    }
}

FinCT()
{
    GanadoCT = true;
    PrintToChatAll("\x04[Frag Battle] \x03Counter-Terrorist win the Frag Battle!");
    if(is_cstrike) CS_TerminateRound(5.0, CSRoundEnd_CTWin);
    else
    {
        for (new client=1; client<=MaxClients; ++client)
            if (IsClientInGame(client) && IsPlayerAlive(client) && GetClientTeam(client) == CS_TEAM_T)
                ForcePlayerSuicide(client);
    }
    CreateTimer(5.0, NewGame, _, TIMER_FLAG_NO_MAPCHANGE);
}

FinT()
{
    GanadoT = true;
    PrintToChatAll("\x04[Frag Battle] \x03Terrorist win the Frag Battle!");
    if(is_cstrike) CS_TerminateRound(5.0, CSRoundEnd_TerroristWin);
    else
    {
        for (new client=1; client<=MaxClients; ++client)
            if (IsClientInGame(client) && IsPlayerAlive(client) && GetClientTeam(client) == CS_TEAM_CT)
                ForcePlayerSuicide(client);
    }
    CreateTimer(5.0, NewGame, _, TIMER_FLAG_NO_MAPCHANGE);
}

public Action:NewGame(Handle:timer)
{
    ResetAll();
    Temporizador(timer);
    return Plugin_Stop;
}

public OnClientDisconnect_Post(client)
{
    if(GetClientCount()) ResetAll();
}

ResetAll()
{
    MuertesCT = 0;
    MuertesT = 0;
    GanadoCT = false;
    GanadoT = false;
}

Спасибо огромное!!
Не подскажете еще по одному вопросу, как изменить местоположение худа со счетом?!
 

AlmazON

Не путать с самим yand3xmail
Сообщения
5,099
Реакции
2,756
как изменить местоположение худа со счетом?!
Никак, он закреплён по стандарту. Для вывода в нужном месте потребуется использовать другие методы, но едва ли туда влезет столько информации.
 
Сверху Снизу