Simple MIX 1.0

Pluginuri pentru modul AmxModX.

Moderators: Moderatori ajutatori, Moderatori

Post Reply
User avatar
LondoN eXtream
Scripter eXtreamCS
Scripter eXtreamCS
Posts: 2908
Joined: 10 Oct 2014, 05:21
Detinator Steam: Da
SteamID: /id/london_extreamcs
Reputatie: Scripter eXtreamCS
Moderator ajutator
Membru Club eXtreamCS (6 luni)
Fond eXtream: 0
Location: Roman, Neamț
Has thanked: 2 times
Been thanked: 3 times

21 May 2019, 01:02

Descriere: Este un plugin simplu de mix. Contine: warm, restart, knife, chat, start, stop, score.

Descarcare:
| Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

new const PLUGIN[] = "MIX by LondoN";
new const VERSION[] = "1.0";
new const AUTHOR[] = "LondoN eXtream";

enum _:ScoreData
{
	TERO = 0,
	CT,
	TERO_PART_TWO,
	CT_PART_TWO
};

new g_Score[ScoreData];
new bool: g_MixStarted, bool: g_KnifeRound, bool: g_Chat, bool: g_PartTwo, g_RoundNum;

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR);

	register_clcmd("say /warm", "_func_warm", ADMIN_KICK);
	register_clcmd("say /restart", "_func_restart", ADMIN_KICK);
	register_clcmd("say /knife", "_func_knife", ADMIN_KICK);
	register_clcmd("say /chat", "_func_chat", ADMIN_KICK);
	register_clcmd("say /start", "_func_start", ADMIN_KICK);
	register_clcmd("say /stop", "_func_stop", ADMIN_KICK);
	register_clcmd("say /score", "_func_score", ADMIN_KICK);
	register_clcmd("say", "_func_say", ADMIN_KICK);

	register_event("SendAudio", "EVENT_TWIN", "a", "2&%!MRAD_terwin");
	register_event("SendAudio", "EVENT_CTWIN", "a", "2&%!MRAD_ctwin");
	register_event("CurWeapon", "EVENT_CurWeap", "be", "1=1");
	register_event("HLTV", "EVENT_NewRound", "a");

	register_logevent("LOG_RoundEnd", 2, "1=RoundEnd");
}

public _func_warm(Player)
{
	server_cmd("sv_restart 2");
	server_cmd("mp_freezetime 0");
	server_cmd("mp_startmoney 16000");

	g_MixStarted = false;
	g_KnifeRound = false;
	g_RoundNum = 0;
	g_Score[TERO] = g_Score[CT] = g_Score[TERO_PART_TWO] = g_Score[CT_PART_TWO] = 0;
}

public _func_restart(Player)
{
	server_cmd("sv_restart 1");
	
	g_MixStarted = true;
	g_RoundNum = 0;
	g_Score[TERO] = g_Score[CT] = g_Score[TERO_PART_TWO] = g_Score[CT_PART_TWO] = 0;
}

public _func_knife(Player)
{
	server_cmd("sv_restart 2");
	server_cmd("mp_freezetime 0");
	server_cmd("mp_startmoney 16000");

	g_MixStarted = false;
	g_KnifeRound = true;
	g_RoundNum = 0;
	g_Score[TERO] = g_Score[CT] = g_Score[TERO_PART_TWO] = g_Score[CT_PART_TWO] = 0;
}

public _func_chat(Player)
{
	if(g_Chat)
		g_Chat = false;
	else
		g_Chat = true;
}

public _func_start(Player)
{
	server_cmd("sv_restart 5");
	server_cmd("mp_freezetime 9");
	server_cmd("mp_startmoney 800");
	server_cmd("mp_friendlyfire 1");
	server_cmd("mp_buytime .25");

	g_MixStarted = true;
	g_Chat = true;
	g_KnifeRound = false;
	g_RoundNum = 0;
	g_Score[TERO] = g_Score[CT] = g_Score[TERO_PART_TWO] = g_Score[CT_PART_TWO];
}

public _func_stop(Player)
{
	server_cmd("sv_restart 1");
	server_cmd("mp_freezetime 0");
	server_cmd("mp_startmoney 16000");
	server_cmd("mp_friendlyfire 0");

	g_MixStarted = false;
	g_KnifeRound = false;
	g_Chat = false;
	g_RoundNum = 0;
	g_Score[TERO] = g_Score[CT] = g_Score[TERO_PART_TWO] = g_Score[CT_PART_TWO] = 0;
}

public _func_score(Player)
{
	client_print(Player, print_chat, "------ Score ------");
	client_print(Player, print_chat, "TERO: %d", g_PartTwo ? g_Score[TERO_PART_TWO] : g_Score[TERO]);
	client_print(Player, print_chat, "CT: %d", g_PartTwo ? g_Score[CT_PART_TWO] : g_Score[CT]);
	client_print(Player, print_chat, "------ Score ------");
	return;
}

public _func_say(Player)
{
	new Args[192];
	read_args(Args, charsmax(Args));
	remove_quotes(Args);

	if(g_Chat)
		return;

	new g_szPassCmd[16], g_szPass[16];
	parse(Args, g_szPassCmd, charsmax(g_szPassCmd), g_szPass, charsmax(g_szPass))

	if(equal(g_szPassCmd, "/pass") && strlen(g_szPass))
		server_cmd("sv_password ^"%s^"", g_szPass);
}

public EVENT_TWIN()
{
	switch(g_PartTwo)
	{
		case true:	g_Score[TERO_PART_TWO] += 1;
		case false:	g_Score[TERO] += 1;
	}
}

public EVENT_CTWIN()
{
	switch(g_PartTwo)
	{
		case true:	g_Score[CT_PART_TWO] += 1;
		case false:	g_Score[CT] += 1;
	}
}

public EVENT_CurWeap(Player)
{
	if(g_KnifeRound)
		engclient_cmd(Player, "weapon_knife");
}

public EVENT_NewRound()
{
	if(g_MixStarted)
	{
		switch(g_PartTwo)
		{
			case false:
			{
				if(g_Score[TERO] > g_Score[CT])
					client_print(0, print_chat, "Scorul este %d - %d pentru TERO", g_Score[TERO], g_Score[CT]);
				if(g_Score[CT] > g_Score[TERO])
					client_print(0, print_chat, "Scorul este %d - %d pentru CT", g_Score[CT], g_Score[TERO]);
				if(g_Score[TERO] == g_Score[CT])
					client_print(0, print_chat, "Scorul este %d - %d (egalitate)", g_Score[TERO], g_Score[CT]);
				
			}

			case true:
			{
				new T = g_Score[TERO] + g_Score[TERO_PART_TWO];
				new CTS = g_Score[CT] + g_Score[CT_PART_TWO];

				if(T == 16 || CTS == 16)
				{
					if(T > CTS)
					{
						client_print(0, print_chat, "Meciul a fost castigat de TERO");
						client_print(0, print_chat, "SCOR: %d - %d", T, CTS);

						CMD_Settings();
					}

					if(CTS > T)
					{
						client_print(0, print_chat, "Meciul a fost castigat de CT");
						client_print(0, print_chat, "SCOR: %d - %d", CTS, T);

						CMD_Settings();
					}
				}
				else
				{
					if(T > CTS)
						client_print(0, print_chat, "Scorul este %d - %d pentru TERO", T, CTS);
					if(CTS > T)
						client_print(0, print_chat, "Scorul este %d - %d pentru CT", CTS, T);
					if(T == CTS)
						client_print(0, print_chat, "Scorul este %d - %d (egalitate)", T, CTS);
				}
			}
		}
	}
}

public CMD_Settings()
{
	g_MixStarted = false;
	g_PartTwo = false;
	g_Score[CT] = g_Score[TERO] = g_Score[CT_PART_TWO] = g_Score[TERO_PART_TWO] = 0;
		
	server_cmd("sv_restart 1");
	server_cmd("mp_freezetime 0");
	server_cmd("mp_startmoney 16000");
	server_cmd("mp_friendlyfire 0");
}

public LOG_RoundEnd()
{
	g_RoundNum++;

	if(g_PartTwo && g_RoundNum == 31)
	{
		client_print(0, print_chat, "MIX-ul s-a terminat la egalitate");

		CMD_Settings();
	}
	else if(g_RoundNum >= 15)
	{
		new Players[32], iNum;
		get_players(Players, iNum);
		
		for(new i; i < iNum; i++)
			_func_delay(Players);
	}
}

public _func_delay(Player)
{
	switch(Player)
	{
		case 1..7:	set_task(0.1, "_func_swap", Player);
		case 8..15:	set_task(0.2, "_func_swap", Player);
		case 16..23:	set_task(0.3, "_func_swap", Player);
		case 24..32:	set_task(0.4, "_func_swap", Player);
	}
}

public _func_swap(Player)
{
	switch(cs_get_user_team(Player))
	{
		case CS_TEAM_CT:	cs_set_user_team(Player, CS_TEAM_T);
		case CS_TEAM_T:		cs_set_user_team(Player, CS_TEAM_CT);
	}

	g_RoundNum = 0;
	g_PartTwo = true;

	server_cmd("sv_restart 1");
}

Nume: Simple Mix
Versiune: 1.0

Instalare:
1. Fisierul nume_plugin.sma il puneti in addons/amxmodx/scripting
2. Fisierul nume_plugin.amxx il puneti in addons/amxmodx/plugins
3. Intrati in fisierul addons/amxmodx/configs/plugins.ini si adaugati la urma:

Code: Select all

nume_plugin.amxx
Post Reply

Return to “AmxModX”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 12 guests