Sari la conținut

[CS:GO] - [Modul-VIP] "Meniu Arme"


NiGHT

Postări Recomandate

Pluginul a fost luat de aici si refacut o mare parte din el + am adaugat meniu pentru Pistoale.

#pragma newdecls required
#pragma semicolon 1

#include <sourcemod> 
#include <cstrike>
#include <vip_core>
#include <sdktools>

bool g_bHasUsedMenu[MAXPLAYERS + 1] = false,
	 g_bHasUsedPistolMenu[MAXPLAYERS + 1] = false,
	 g_bEnabled[MAXPLAYERS+1] = false,
	 g_bEnable = true;

Handle g_hTimer;

ConVar g_cvmp_buytime;
float g_fBuyTime;

static const char g_sFeature[] = "Weapons";

public Plugin myinfo =
{
	name = "[VIP] Weapons Menu",
	author = ".NiGHT",
	version = "2.1",
	description = "Weapons Menu", 
	url = "steamcommunity.com/id/NiGHT757" 
};

public void OnPluginStart()
{
	if (VIP_IsVIPLoaded())
	{
		VIP_OnVIPLoaded();
	}
	
	HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
	HookEvent("round_end", Event_RoundEnd, EventHookMode_PostNoCopy);
	
	RegConsoleCmd("sm_arme", Command_VipMenu, "Comanda pentru arme VIP"); 
	RegConsoleCmd("sm_guns", Command_VipMenu, "Command for the VIP Weapons");
	
	g_cvmp_buytime = FindConVar("mp_buytime");
	g_cvmp_buytime.AddChangeHook(OnSettingsChanged);
	g_fBuyTime = g_cvmp_buytime.FloatValue;
}
public void OnPluginEnd()
{
	VIP_UnregisterMe();
}

public void VIP_OnVIPClientLoaded(int iClient)
{
	g_bEnabled[iClient] = VIP_IsClientFeatureUse(iClient, g_sFeature);
}

public void OnSettingsChanged(ConVar convar, const char[] OldVal, const char[] NewVal)
{
	g_fBuyTime = g_cvmp_buytime.FloatValue;
}

public void VIP_OnVIPLoaded()
{
	VIP_RegisterFeature(g_sFeature, BOOL, _, OnToggleItem);
}

public Action OnToggleItem(int iClient, const char[] sFeatureName, VIP_ToggleState OldStatus, VIP_ToggleState &NewStatus)
{
	g_bEnabled[iClient] = (NewStatus == ENABLED);
	return Plugin_Continue;
}

public void OnClientDisconnect(int client)
{
	g_bHasUsedMenu[client] = false;
	g_bHasUsedPistolMenu[client] = false;
	g_bEnabled[client] = false;
}

public void Event_RoundStart(Event event, const char[] name, bool dontBroadcast)
{
	g_hTimer = CreateTimer(g_fBuyTime, Timer_DisableMenu);
	
	for (int i = 1; i <= MaxClients; i++)
	{
		g_bHasUsedMenu[i] = false;
		g_bHasUsedPistolMenu[i] = false;
	}
}

// Prevent timer trigger twice.
public void Event_RoundEnd(Event event, const char[] name, bool dontBroadcast)
{
	if(g_hTimer)
	{
		delete g_hTimer;
	}
}

public void OnMapStart()
{
	g_bEnable = true;
	char map[PLATFORM_MAX_PATH];
	GetCurrentMap(map, sizeof(map));
	if (strncmp(map, "35hp_", 5) == 0 || strncmp(map, "awp_", 4) == 0 || strncmp(map, "aim_", 4) == 0 || strncmp(map, "fy_", 3) == 0)
		g_bEnable = false;
}

public void OnMapEnd()
{
	if(g_hTimer)
	{
		delete g_hTimer;
	}
}

public Action Timer_DisableMenu(Handle timer)
{
	for (int i = 1; i <= MaxClients; i++)
	{
		g_bHasUsedMenu[i] = true;
		g_bHasUsedPistolMenu[i] = true;
	}
	g_hTimer = null;
}

public Action Command_VipMenu(int client, int args)
{
	if (!g_bEnable || !IsClientInGame(client) || !IsPlayerAlive(client) || !g_bEnabled[client])
	{
		return Plugin_Handled;
	}
	
	if(!GetEntProp(client, Prop_Send, "m_bInBuyZone"))
	{
		ReplyToCommand(client, " \x03[\x04VIP\x03] \x02ERROR: \x01Nu esti in Buy Zone");
		return Plugin_Handled;
	}

	if (g_bHasUsedMenu[client])
	{
		ReplyToCommand(client, " \x03[\x04VIP\x03] \x02ERROR: \x01Nu mai poti folosi meniul de arme in aceasta runda!");
		return Plugin_Handled;
	}
	
	int NumRound = CS_GetTeamScore(2) + CS_GetTeamScore(3);

	if(NumRound == 0 || NumRound == 1 || NumRound == 15 || NumRound == 16)
	{
		ReplyToCommand(client, " \x03[\x04VIP\x03] \x02ERROR: \x01Nu poti sa folosesti meniul de arme in primele 2 runde.");
		return Plugin_Handled;
	}

	switch(GetClientTeam(client))
	{
		case CS_TEAM_CT:
		{
			Menu menu = new Menu(MenuHandler_Guns);
			menu.SetTitle("[T] ★ Meniu Arme ★ [T]");
			menu.AddItem("1", "AK47");
			menu.AddItem("2", "SG 556");
			menu.AddItem("4", "M4A1-S");
			menu.AddItem("3", "M4A4");
			menu.ExitButton = true;
			menu.Display(client, 10);
		}
		case CS_TEAM_T:
		{
			Menu menu = new Menu(MenuHandler_Guns);
			menu.SetTitle("[CT] ★ Meniu Arme ★ [CT]");
			menu.AddItem("3", "M4A4");
			menu.AddItem("4", "M4A1-S");
			menu.AddItem("5", "AUG");
			menu.ExitButton = true;
			menu.Display(client, 10);
		}
	}
	
	return Plugin_Handled;
}

public int MenuHandler_Pistols(Menu menu, MenuAction action, int client, int param2)
{
	switch(action)
	{
		case MenuAction_Select:
		{
			if(IsPlayerAlive(client))
			{
				int weapon = GetPlayerWeaponSlot(client, CS_SLOT_SECONDARY);
				char selected[4];
				menu.GetItem(param2, selected, sizeof(selected));
				
				g_bHasUsedPistolMenu[client] = true;
				
				if (weapon != -1)
				{
					RemoveEntity(weapon);
				}
				
				switch(selected[0])
				{
					case '1':{
						GivePlayerItem(client, "weapon_glock");
						VIP_PrintToChatClient(client, " \x07Ai ales \x03GLOCK-18 \x04!");
					}
					case '2':{
						GivePlayerItem(client, "weapon_tec9");
						VIP_PrintToChatClient(client, " \x07Ai ales \x03Tec-9 \x04!");
					}
					case '3':{
						GivePlayerItem(client, "weapon_usp_silencer");
						VIP_PrintToChatClient(client, " \x07Ai ales \x03USP-S \x04!");
					}
					case '4':{
						GivePlayerItem(client, "weapon_cz75a");
						VIP_PrintToChatClient(client, " \x07Ai ales \x03CZ75-Auto \x04!");
					}
					case '5':{
						GivePlayerItem(client, "weapon_fiveseven");
						VIP_PrintToChatClient(client, " \x07Ai ales \x03Five-SeveN \x04!");
					}
					case '6':{
						GivePlayerItem(client, "weapon_deagle");
						VIP_PrintToChatClient(client, " \x07Ai ales \x03Deagle \x04!");
					}
				}
			}
		}
		case MenuAction_End:
		{
			delete menu;
		}
	}
}

public int MenuHandler_Guns(Menu menu, MenuAction action, int client, int param2)
{	
	switch(action)
	{
		case MenuAction_Select:
		{
			if(IsPlayerAlive(client))
			{	
				g_bHasUsedMenu[client] = true;
				
				int weapon = GetPlayerWeaponSlot(client, CS_SLOT_PRIMARY);
				char selected[4];
				menu.GetItem(param2, selected, sizeof(selected));
				
				if(weapon != -1)
				{
					RemoveEntity(weapon);
				}
				
				switch(selected[0])
				{
					case '1':{
						GivePlayerItem(client, "weapon_ak47");
						VIP_PrintToChatClient(client, " \x07Ai ales \x03AK47 \x04!");
					}
					case '2':{
						GivePlayerItem(client, "weapon_sg556");
						VIP_PrintToChatClient(client, " \x07Ai ales \x03SG 553 \x04!");
					}
					case '3':{
						GivePlayerItem(client, "weapon_m4a1");
						VIP_PrintToChatClient(client, " \x07Ai ales \x03M4A4 \x04!");
					}
					case '4':{
						GivePlayerItem(client, "weapon_m4a1_silencer");
						VIP_PrintToChatClient(client, " \x07Ai ales \x03M4A1-S \x04!");
					}
					case '5':{
						GivePlayerItem(client, "weapon_aug");
						VIP_PrintToChatClient(client, " \x07Ai ales \x03AUG \x04!");
					}
				}
				
				if(!g_bHasUsedPistolMenu[client])
				{
					OpenPistolMenu(client);
				}
			}
		}
		case MenuAction_End:
		{
			delete menu;
		}
	}
}

void OpenPistolMenu(int client)
{
	Menu menu = new Menu(MenuHandler_Pistols);
	switch(GetClientTeam(client))
	{
		case CS_TEAM_CT:
		{	
			menu.SetTitle("[CT] ★ Meniu Pistoale ★");
			menu.AddItem("1", "GLOCK-18");
			menu.AddItem("2", "Tec-9");
			menu.AddItem("4", "CZ75-Auto");
			menu.AddItem("5", "Five-SeveN");
			menu.AddItem("6", "Deagle");
			menu.ExitButton = true;
			menu.Display(client, 10);
		}
		case CS_TEAM_T:
		{
			menu.SetTitle("[T] ★ Meniu Pistoale ★");
			menu.AddItem("3", "USP-S");
			menu.AddItem("4", "CZ75-Auto");
			menu.AddItem("5", "Five-SeveN");
			menu.AddItem("6", "Deagle");
			
			menu.ExitButton = true;
			menu.Display(client, 10);
		}
	}
}

 

b_560_95_1.png

 

-> DISCORD <-

-> STEAM <-

-> STEAM GROUP <-

Link spre comentariu
Distribuie pe alte site-uri

Updated:

1.2

- Fixate erori

1.1

- adaugat "RemovePlayerItem(client, weapon);" cand alegi o arma, sa iti stearga arma veche ca sa nu o arunce pe jos pe asta noua.

- Nu mai poti selecta arme cand a expirat timpul de Buy.

- Poti selecta arme doar cand esti in Buy Zone.

- Adaugat setarea "Weapons" pentru a da acces la comanda !armevip. ( in groups.ini adaugam "Weapons" "1" pentru a avea acces la armevip)

1.0 

- Released.

 

  • Like 1
  • Love 1

b_560_95_1.png

 

-> DISCORD <-

-> STEAM <-

-> STEAM GROUP <-

Link spre comentariu
Distribuie pe alte site-uri

Alătură-te conversației

Poți posta acum și să te înregistrezi mai târziu. Dacă ai un cont, autentifică-te acum pentru a posta cu contul tău.
Notă: Postarea ta va necesita aprobare moderator înainte de a fi vizibilă.

Vizitator
Răspunde la acest topic...

×   Inserat ca text bogat.   Lipiți ca text simplu

  Doar 75 emoji sunt permise.

×   Linkul tău a fost încorporat automat.   Afișează ca link în schimb

×   Conținutul tău precedent a fost restaurat.   Curăță editor

×   Nu poți lipi imagini direct. Încarcă sau inserează imagini din URL.

×
×
  • Creează nouă...

Informații Importante

Am plasat cookie-uri pe dispozitivul tău pentru a îmbunătății navigarea pe acest site. Poți modifica setările cookie, altfel considerăm că ești de acord să continui. Also by continuing using this website you agree with the Terms of Use and Privacy Policy.