Raised This Month: $32 Target: $400
 8% 

[CS:GO] Gun Menu (Retake, DM...)


Post New Thread Reply   
 
Thread Tools Display Modes
paulo_crash
AlliedModders Donor
Join Date: May 2016
Location: Brazil
Old 07-03-2019 , 00:00   Re: [CS:GO] Gun Menu (Retake, DM...)
Reply With Quote #21

Quote:
Originally Posted by Grey83 View Post
Fixed
Work checked on the CSS server
It could upgrade to include the MP5-SD, it does not have it in the plugin.
paulo_crash is offline
Koga73
Senior Member
Join Date: Mar 2011
Location: 🍩
Old 04-26-2020 , 14:05   Re: [CS:GO] Gun Menu (Retake, DM...)
Reply With Quote #22

Would be nice if it could save clients choice.

Quote:
Originally Posted by paulo_crash View Post
It could upgrade to include the MP5-SD, it does not have it in the plugin.
You might not need it anymore, but for anyone else, just add:

{"weapon_mp5sd", "MP5-SD"},
__________________
Koga73 is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 10-17-2020 , 12:49   Re: [CS:GO] Gun Menu (Retake, DM...)
Reply With Quote #23

Is this the best plugin for GUNS?
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
paulo_crash
AlliedModders Donor
Join Date: May 2016
Location: Brazil
Old 02-18-2021 , 07:47   Re: [CS:GO] Gun Menu (Retake, DM...)
Reply With Quote #24

Quote:
Originally Posted by Grey83 View Post
Fixed
Work checked on the CSS server
I'm using this version, some way to add the molotov grenades as an option to come to the players, like the ones you already have?

Version I use:
Code:
#pragma semicolon 1
#pragma newdecls required

#include <sdkhooks>
#include <sdktools_functions>
#include <sdktools_entinput>

enum
{
	Slot_Primary = 0,
	Slot_Secondary,
	Slot_Knife,
	Slot_Grenade,
	Slot_C4,
	Slot_None
};

enum
{
	Team_None = 0,
	Team_Spec,
	Team_T,
	Team_CT
};

bool bAllowAWP[] = {true, true};
int iWpnChoice[2][MAXPLAYERS+1],
	iMenuSize[2];
Menu hPrimaryMenu,
	hSecondaryMenu;

static const char	sPrimaryWeapons[][][] = {
		{"",					"Random"},
		{"weapon_awp",			"AWP"},
		{"weapon_ssg08",		"SSG 08"},
		{"weapon_ak47",			"AK-47"},
		{"weapon_m4a1",			"M4A4"},
		{"weapon_m4a1_silencer","M4A1-S"},
		{"weapon_sg556",		"SG 553"},
		{"weapon_aug",			"AUG"},
		{"weapon_galilar",		"Galil AR"},
		{"weapon_famas",		"FAMAS"},
		{"weapon_mac10",		"MAC-10"},
		{"weapon_mp9",			"MP9"},
		{"weapon_mp7",			"MP7"},
		{"weapon_ump45",		"UMP-45"},
		{"weapon_mp5sd",		"MP5-SD"},
		{"weapon_bizon",		"PP-Bizon"},
		{"weapon_p90",			"P90"}},
		
					sSecondaryWeapons[][][] = {
		{"",					"Random"},
		{"weapon_glock",		"Glock-18"},
		{"weapon_usp_silencer",	"USP-S"},
		{"weapon_hkp2000",		"P2000"},
		{"weapon_p250",			"P250"},
		{"weapon_deagle",		"Desert Eagle"},
		{"weapon_fiveseven",	"Five-SeveN"},
		{"weapon_elite",		"Dual Berettas"},
		{"weapon_tec9",			"Tec-9"},
		{"weapon_cz75a",		"CZ75-Auto"},
		{"weapon_revolver",		"R8 Revolver"}};

public Plugin myinfo =
{
	name		= "[CS:GO] Gun Menu",
	author		= "Potatoz, Grey83",
	description	= "Gun Menu for gamemodes such as Retake, DeathMatch etc",
	version		= "1.0.4",
	url			= ""
};

public void OnPluginStart()
{
	iMenuSize[0]	= sizeof(sPrimaryWeapons) - 1;
	PrintToServer("\nPrimary weapons num: %i", iMenuSize[0]);
	iMenuSize[1]	= sizeof(sSecondaryWeapons) - 1;
	PrintToServer("Secondary weapons num: %i\n", iMenuSize[1]);

	hPrimaryMenu = new Menu(Handler_PrimaryMenu);
	hPrimaryMenu.SetTitle("Choose Primary weapon:");
	for(int i; i <= iMenuSize[0]; i++)	hPrimaryMenu.AddItem(sPrimaryWeapons[i][0], sPrimaryWeapons[i][1]);

	hSecondaryMenu = new Menu(Handler_SecondaryMenu);
	hSecondaryMenu.SetTitle("Choose Secondary weapon:");
	for(int i; i <= iMenuSize[1]; i++)	hSecondaryMenu.AddItem(sSecondaryWeapons[i][0], sSecondaryWeapons[i][1]);

	RegConsoleCmd("sm_guns", Menu_PrimaryWeapon);

	HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
	HookEvent("player_spawn",Event_Spawn);

	ToggleBuyZones();
}

public void OnPluginEnd()
{
	ToggleBuyZones(true);
}

public Action Menu_PrimaryWeapon(int client, int args)
{
	if(client) hPrimaryMenu.Display(client, MENU_TIME_FOREVER);
	return Plugin_Handled;
}

public int Handler_PrimaryMenu(Menu menu, MenuAction action, int client, int param)
{
	if(action == MenuAction_Select)
	{
		iWpnChoice[0][client] = param;
		hSecondaryMenu.Display(client, MENU_TIME_FOREVER);
	}
	return 0;
}

public int Handler_SecondaryMenu(Menu menu, MenuAction action, int client, int param)
{
	if(action == MenuAction_Select) iWpnChoice[1][client] = param;
	return 0;
}

public void OnClientPutInServer(int client)
{
	iWpnChoice[0][client] = iWpnChoice[1][client] = 0;
}

public void Event_RoundStart(Event event, const char[] name, bool dontBroadcast)
{
	bAllowAWP[0] = bAllowAWP[1] = true;
}

public void Event_Spawn(Event event, const char[] name, bool dontBroadcast)
{
	RequestFrame(RequestFrame_Callback, event.GetInt("userid"));
}

public void RequestFrame_Callback(int client)
{
	if(!(client = GetClientOfUserId(client))) return;

	StripWeapons(client);

	GivePlayerItem(client, "weapon_knife");
	GivePlayerItem(client, "item_assaultsuit");

	static int wpn;
	if(!(wpn = iWpnChoice[0][client])) wpn = GetRandomInt(1, iMenuSize[0]);
	if(wpn == 1)
	{
		switch(GetClientTeam(client))
		{
			case Team_T:
			{
				if(bAllowAWP[0])
				{
					bAllowAWP[0] = false;
					GivePlayerItem(client, "weapon_awp");
				}
				else
				{
					GivePlayerItem(client, "weapon_ak47");
					PrintToChat(client, "AWP é limitada a 1 player em cada time por round.");
				}
			}
			case Team_CT:
			{
				if(bAllowAWP[1])
				{
					bAllowAWP[1] = false;
					GivePlayerItem(client, "weapon_awp");
				}
				else
				{
					GivePlayerItem(client, "weapon_m4a1");
					PrintToChat(client, "AWP é limitada a 1 player em cada time por round.");
				}
			}
		}
	}
	else GivePlayerItem(client, sPrimaryWeapons[wpn][0]);

	wpn = iWpnChoice[1][client];
	if(!wpn) wpn = GetRandomInt(1, iMenuSize[1]);
	GivePlayerItem(client, sSecondaryWeapons[wpn][0]);

	switch(GetRandomInt(0, 20))
	{
		case 1:		GivePlayerItem(client, "weapon_flashbang");
		case 2:		GivePlayerItem(client, "weapon_hegrenade");
		case 18:	GivePlayerItem(client, "weapon_smokegrenade");
	}
}

stock void StripWeapons(int client)
{
	RemoveWeaponBySlot(client, Slot_Primary);
	RemoveWeaponBySlot(client, Slot_Secondary);
	RemoveWeaponBySlot(client, Slot_Knife);
	while(RemoveWeaponBySlot(client)) {}
}

stock bool RemoveWeaponBySlot(int client, int slot = Slot_Grenade)
{
	int ent = GetPlayerWeaponSlot(client, slot);
	return ent > MaxClients && RemovePlayerItem(client, ent) && AcceptEntityInput(ent, "Kill");
}

stock void ToggleBuyZones(bool enable = false)
{
	int entity = -1;
	while((entity = FindEntityByClassname(entity, "func_buyzone")) != -1)
		AcceptEntityInput(entity, enable ? "Enable" : "Disable");
}
You would have to edit here:
Code:
switch(GetRandomInt(0, 30))
	{
		case 1:		GivePlayerItem(client, "weapon_flashbang");
		case 2:		GivePlayerItem(client, "weapon_hegrenade");
		case 18:	GivePlayerItem(client, "weapon_smokegrenade");
		case 23:	GivePlayerItem(client, "weapon_molotov");
		case 28:	GivePlayerItem(client, "weapon_incgrenade");
	}

Last edited by paulo_crash; 11-07-2021 at 11:10.
paulo_crash is offline
paulo_crash
AlliedModders Donor
Join Date: May 2016
Location: Brazil
Old 02-20-2021 , 13:23   Re: [CS:GO] Gun Menu (Retake, DM...)
Reply With Quote #25

Quote:
Originally Posted by paulo_crash View Post
I'm using this version, some way to add the molotov grenades as an option to come to the players, like the ones you already have?

Version I use:
Code:
#pragma semicolon 1
#pragma newdecls required

#include <sdkhooks>
#include <sdktools_functions>
#include <sdktools_entinput>

enum
{
	Slot_Primary = 0,
	Slot_Secondary,
	Slot_Knife,
	Slot_Grenade,
	Slot_C4,
	Slot_None
};

enum
{
	Team_None = 0,
	Team_Spec,
	Team_T,
	Team_CT
};

bool bAllowAWP[] = {true, true};
int iWpnChoice[2][MAXPLAYERS+1],
	iMenuSize[2];
Menu hPrimaryMenu,
	hSecondaryMenu;

static const char	sPrimaryWeapons[][][] = {
		{"",					"Random"},
		{"weapon_awp",			"AWP"},
		{"weapon_ssg08",		"SSG 08"},
		{"weapon_ak47",			"AK-47"},
		{"weapon_m4a1",			"M4A4"},
		{"weapon_m4a1_silencer","M4A1-S"},
		{"weapon_sg556",		"SG 553"},
		{"weapon_aug",			"AUG"},
		{"weapon_galilar",		"Galil AR"},
		{"weapon_famas",		"FAMAS"},
		{"weapon_mac10",		"MAC-10"},
		{"weapon_mp9",			"MP9"},
		{"weapon_mp7",			"MP7"},
		{"weapon_ump45",		"UMP-45"},
		{"weapon_mp5sd",		"MP5-SD"},
		{"weapon_bizon",		"PP-Bizon"},
		{"weapon_p90",			"P90"}},
		
					sSecondaryWeapons[][][] = {
		{"",					"Random"},
		{"weapon_glock",		"Glock-18"},
		{"weapon_usp_silencer",	"USP-S"},
		{"weapon_hkp2000",		"P2000"},
		{"weapon_p250",			"P250"},
		{"weapon_deagle",		"Desert Eagle"},
		{"weapon_fiveseven",	"Five-SeveN"},
		{"weapon_elite",		"Dual Berettas"},
		{"weapon_tec9",			"Tec-9"},
		{"weapon_cz75a",		"CZ75-Auto"},
		{"weapon_revolver",		"R8 Revolver"}};

public Plugin myinfo =
{
	name		= "[CS:GO] Gun Menu",
	author		= "Potatoz, Grey83",
	description	= "Gun Menu for gamemodes such as Retake, DeathMatch etc",
	version		= "1.0.4",
	url			= "https://github.com/ZK-Servidores/Plugins-SourceMod"
};

public void OnPluginStart()
{
	iMenuSize[0]	= sizeof(sPrimaryWeapons) - 1;
	PrintToServer("\nPrimary weapons num: %i", iMenuSize[0]);
	iMenuSize[1]	= sizeof(sSecondaryWeapons) - 1;
	PrintToServer("Secondary weapons num: %i\n", iMenuSize[1]);

	hPrimaryMenu = new Menu(Handler_PrimaryMenu);
	hPrimaryMenu.SetTitle("Choose Primary weapon:");
	for(int i; i <= iMenuSize[0]; i++)	hPrimaryMenu.AddItem(sPrimaryWeapons[i][0], sPrimaryWeapons[i][1]);

	hSecondaryMenu = new Menu(Handler_SecondaryMenu);
	hSecondaryMenu.SetTitle("Choose Secondary weapon:");
	for(int i; i <= iMenuSize[1]; i++)	hSecondaryMenu.AddItem(sSecondaryWeapons[i][0], sSecondaryWeapons[i][1]);

	RegConsoleCmd("sm_guns", Menu_PrimaryWeapon);

	HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
	HookEvent("player_spawn",Event_Spawn);

	ToggleBuyZones();
}

public void OnPluginEnd()
{
	ToggleBuyZones(true);
}

public Action Menu_PrimaryWeapon(int client, int args)
{
	if(client) hPrimaryMenu.Display(client, MENU_TIME_FOREVER);
	return Plugin_Handled;
}

public int Handler_PrimaryMenu(Menu menu, MenuAction action, int client, int param)
{
	if(action == MenuAction_Select)
	{
		iWpnChoice[0][client] = param;
		hSecondaryMenu.Display(client, MENU_TIME_FOREVER);
	}
	return 0;
}

public int Handler_SecondaryMenu(Menu menu, MenuAction action, int client, int param)
{
	if(action == MenuAction_Select) iWpnChoice[1][client] = param;
	return 0;
}

public void OnClientPutInServer(int client)
{
	iWpnChoice[0][client] = iWpnChoice[1][client] = 0;
}

public void Event_RoundStart(Event event, const char[] name, bool dontBroadcast)
{
	bAllowAWP[0] = bAllowAWP[1] = true;
}

public void Event_Spawn(Event event, const char[] name, bool dontBroadcast)
{
	RequestFrame(RequestFrame_Callback, event.GetInt("userid"));
}

public void RequestFrame_Callback(int client)
{
	if(!(client = GetClientOfUserId(client))) return;

	StripWeapons(client);

	GivePlayerItem(client, "weapon_knife");
	GivePlayerItem(client, "item_assaultsuit");

	static int wpn;
	if(!(wpn = iWpnChoice[0][client])) wpn = GetRandomInt(1, iMenuSize[0]);
	if(wpn == 1)
	{
		switch(GetClientTeam(client))
		{
			case Team_T:
			{
				if(bAllowAWP[0])
				{
					bAllowAWP[0] = false;
					GivePlayerItem(client, "weapon_awp");
				}
				else
				{
					GivePlayerItem(client, "weapon_ak47");
					PrintToChat(client, "AWP é limitada a 1 player em cada time por round.");
				}
			}
			case Team_CT:
			{
				if(bAllowAWP[1])
				{
					bAllowAWP[1] = false;
					GivePlayerItem(client, "weapon_awp");
				}
				else
				{
					GivePlayerItem(client, "weapon_m4a1");
					PrintToChat(client, "AWP é limitada a 1 player em cada time por round.");
				}
			}
		}
	}
	else GivePlayerItem(client, sPrimaryWeapons[wpn][0]);

	wpn = iWpnChoice[1][client];
	if(!wpn) wpn = GetRandomInt(1, iMenuSize[1]);
	GivePlayerItem(client, sSecondaryWeapons[wpn][0]);

	switch(GetRandomInt(0, 20))
	{
		case 1:		GivePlayerItem(client, "weapon_flashbang");
		case 2:		GivePlayerItem(client, "weapon_hegrenade");
		case 18:	GivePlayerItem(client, "weapon_smokegrenade");
	}
}

stock void StripWeapons(int client)
{
	RemoveWeaponBySlot(client, Slot_Primary);
	RemoveWeaponBySlot(client, Slot_Secondary);
	RemoveWeaponBySlot(client, Slot_Knife);
	while(RemoveWeaponBySlot(client)) {}
}

stock bool RemoveWeaponBySlot(int client, int slot = Slot_Grenade)
{
	int ent = GetPlayerWeaponSlot(client, slot);
	return ent > MaxClients && RemovePlayerItem(client, ent) && AcceptEntityInput(ent, "Kill");
}

stock void ToggleBuyZones(bool enable = false)
{
	int entity = -1;
	while((entity = FindEntityByClassname(entity, "func_buyzone")) != -1)
		AcceptEntityInput(entity, enable ? "Enable" : "Disable");
}
You would have to edit here:
Code:
switch(GetRandomInt(0, 30))
	{
		case 1:		GivePlayerItem(client, "weapon_flashbang");
		case 2:		GivePlayerItem(client, "weapon_hegrenade");
		case 18:	GivePlayerItem(client, "weapon_smokegrenade");
		case 23:	GivePlayerItem(client, "weapon_molotov");
		case 28:	GivePlayerItem(client, "weapon_incgrenade");
	}
I need someone with programming knowledge to make some changes for me in this plugin.

Something like the option of giving AWP to players to have a greater chance of giving to players with privileges and even increasing how many AWP will give to each team and a few more things.

Anyone interested just send me a DM with the amount they charge to do the service, if you want more information just ask too.
paulo_crash is offline
scubaguy
Junior Member
Join Date: Sep 2022
Location: Sweden
Old 09-27-2022 , 01:49   Re: [CS:GO] Gun Menu (Retake, DM...)
Reply With Quote #26

Quote:
Originally Posted by Grey83 View Post
Fixed
Work checked on the CSS server
I have been using this version of the plugin and it works great.

Could anyone give me a pointer on how i could restrict one team from receiving a specific grenade?
scubaguy is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 09-27-2022 , 04:35   Re: [CS:GO] Gun Menu (Retake, DM...)
Reply With Quote #27

scubaguy, use GetClientTeam(client) check before giving nade.
__________________
Grey83 is offline
paulo_crash
AlliedModders Donor
Join Date: May 2016
Location: Brazil
Old 03-17-2023 , 12:41   Re: [CS:GO] Gun Menu (Retake, DM...)
Reply With Quote #28

@Grey83 I'm using the following version: gunmenu 1.0.4

Would it be possible to make some changes? I would like to:

- Every round give a HE Grenade, Smoke, Flashbang and Incendiary Grenade/Molotov to the players of each team;

It will be a utility for each player, let's say, one can win the HE, another Flashbang and so on.

- Menu asking if he wants to receive the AWP;

If he answers yes, it will only be one AWP per team. If he does not receive the AWP, he receives the default kit he chose in the primary weapon menu.

- Save choice of weapons, even when changing maps;
paulo_crash is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:09.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode