This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Solved [REQ] Weapons menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Visan15
Junior Member
Join Date: Apr 2012
Old 05-15-2024 , 15:54   [REQ] Weapons menu
Reply With Quote #1

Hello , i found this plugin made by OciXCrom and i want to do few settings if somebody can help.

P.S original had AWP as well but i deleted.

Code:
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <hamsandwich>

new g_iMenu

public plugin_init()
{
	register_plugin("Weapons Menu", "1.0", "OciXCrom")
	RegisterHam(Ham_Spawn, "player", "OnPlayerSpawn", 1)
	CreateMenu()
}

CreateMenu()
{
	g_iMenu = menu_create("Select your \rweapons\y!", "Menu_Handler")
	menu_additem(g_iMenu, "\wAK47 \y+ \wDeagle")
	menu_additem(g_iMenu, "\wM4A1 \y+ \wDeagle")
	
}

public OnPlayerSpawn(id)
{
	if(!is_user_alive(id))
		return

	menu_display(id, g_iMenu)
}

public Menu_Handler(id, iMenu, iItem)
{
	switch(iItem)
	{
		case MENU_EXIT: return
		case 0:
		{
			give_item(id, "weapon_ak47")
			cs_set_user_bpammo(id, CSW_AK47, 90)
		}
		case 1:
		{
			give_item(id, "weapon_m4a1")
			cs_set_user_bpammo(id, CSW_M4A1, 90)
		}
		
	}

	give_item(id, "weapon_deagle")
	cs_set_user_bpammo(id, CSW_DEAGLE, 35)

	

	if(cs_get_user_team(id) == CS_TEAM_CT)
		give_item(id, "item_thighpack")
}

1. Menu weapons last for 10s
2. You can't carry more then 1 primary and 1 secondary wep. (now you can have 2-3 primary).

Or if exist a similar plugin , can somebody link me ? already had a lot of search on google.

Thank you .

Last edited by Visan15; Today at 18:33.
Visan15 is offline
v120kaaimcfg
Member
Join Date: Apr 2024
Old 05-15-2024 , 17:16   Re: [REQ] Weapons menu
Reply With Quote #2

Quote:
Originally Posted by Visan15 View Post
Hello , i found this plugin made by OciXCrom and i want to do few settings if somebody can help.

P.S original had AWP as well but i deleted.

1. Menu weapons last for 10s
2. You can't carry more then 1 primary and 1 secondary wep. (now you can have 2-3 primary).

Or if exist a similar plugin , can somebody link me ? already had a lot of search on google.

Thank you .
Here:
Code:
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <hamsandwich>

new g_iMenu

public plugin_init()
{
	register_plugin("Weapons Menu", "1.0", "OciXCrom")
	RegisterHam(Ham_Spawn, "player", "OnPlayerSpawn", 1)
	CreateMenu()
}

CreateMenu()
{
	g_iMenu = menu_create("Select your \rweapons\y!", "Menu_Handler")
	menu_additem(g_iMenu, "\wAK47 \y+ \wDeagle")
	menu_additem(g_iMenu, "\wM4A1 \y+ \wDeagle")
}

public OnPlayerSpawn(id)
{
	if(!is_user_alive(id))
	{
		return
	}

	menu_display(id, g_iMenu, 0, 10)
}

public Menu_Handler(id, iMenu, iItem)
{
	if(iItem == MENU_TIMEOUT || iItem == MENU_EXIT)
	{
		return
	}

	strip_user_weapons(id)
	set_pdata_cbase(id, 116, 0)

	switch(iItem)
	{
		case 0:
		{
			give_item(id, "weapon_ak47")
			cs_set_user_bpammo(id, CSW_AK47, 90)
		}
		case 1:
		{
			give_item(id, "weapon_m4a1")
			cs_set_user_bpammo(id, CSW_M4A1, 90)
		}
	}

	give_item(id, "weapon_knife")
	give_item(id, "weapon_deagle")
	cs_set_user_bpammo(id, CSW_DEAGLE, 35)

	if(cs_get_user_team(id) == CS_TEAM_CT)
	{
		give_item(id, "item_thighpack")
	}
}

Last edited by v120kaaimcfg; 05-15-2024 at 17:16.
v120kaaimcfg is offline
Visan15
Junior Member
Join Date: Apr 2012
Old Yesterday , 18:23   Re: [REQ] Weapons menu
Reply With Quote #3

Thank you but i got some errors.


//// weapons_menu_free.sma
amxmodx\scripting\weapons_menu_free.sma(29) : error 088: number of arguments does not match definition
amxmodx\scripting\weapons_menu_free.sma(34) : error 017: undefined symbol "MENU_TIMEOUT"
//
// 2 Errors.
// Could not locate output file amxmodx\scripting\compiled\weapons_menu_free. amx (compile failed).
//
// Compilation Time: 0.06 sec
// ----------------------------------------
Visan15 is offline
v120kaaimcfg
Member
Join Date: Apr 2024
Old Yesterday , 19:27   Re: [REQ] Weapons menu
Reply With Quote #4

Quote:
Originally Posted by Visan15 View Post
Thank you but i got some errors.


//// weapons_menu_free.sma
amxmodx\scripting\weapons_menu_free.sma(29) : error 088: number of arguments does not match definition
amxmodx\scripting\weapons_menu_free.sma(34) : error 017: undefined symbol "MENU_TIMEOUT"
//
// 2 Errors.
// Could not locate output file amxmodx\scripting\compiled\weapons_menu_free. amx (compile failed).
//
// Compilation Time: 0.06 sec
// ----------------------------------------
The errors will be fixed if you update your AMXX to 1.8.3 or newer:
https://www.amxmodx.org/downloads-new.php
https://www.amxmodx.org/downloads-new.php?branch=master

But if you decide not to update I guess this will do the job:
Code:
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <hamsandwich>

new g_iMenu

public plugin_init()
{
	register_plugin("Weapons Menu", "1.0", "OciXCrom")
	RegisterHam(Ham_Spawn, "player", "OnPlayerSpawn", 1)
	CreateMenu()
}

CreateMenu()
{
	g_iMenu = menu_create("Select your \rweapons\y!", "Menu_Handler")
	menu_additem(g_iMenu, "\wAK47 \y+ \wDeagle")
	menu_additem(g_iMenu, "\wM4A1 \y+ \wDeagle")
}

public OnPlayerSpawn(id)
{
	if(!is_user_alive(id))
	{
		return
	}

	menu_display(id, g_iMenu)

	remove_task(id+123456)
	set_task(10.0, "cancel_menu", id+123456)
}

public Menu_Handler(id, iMenu, iItem)
{
	if(iItem == MENU_EXIT)
	{
		return
	}

	remove_task(id+123456)

	strip_user_weapons(id)
	set_pdata_cbase(id, 116, 0)

	switch(iItem)
	{
		case 0:
		{
			give_item(id, "weapon_ak47")
			cs_set_user_bpammo(id, CSW_AK47, 90)
		}
		case 1:
		{
			give_item(id, "weapon_m4a1")
			cs_set_user_bpammo(id, CSW_M4A1, 90)
		}
	}

	give_item(id, "weapon_knife")
	give_item(id, "weapon_deagle")
	cs_set_user_bpammo(id, CSW_DEAGLE, 35)

	if(cs_get_user_team(id) == CS_TEAM_CT)
	{
		give_item(id, "item_thighpack")
	}
}

public cancel_menu(id)
{
	if(is_user_connected(id-123456))
	{
		menu_cancel(id-123456)
	}
}
v120kaaimcfg is offline
Visan15
Junior Member
Join Date: Apr 2012
Old Yesterday , 19:38   Re: [REQ] Weapons menu
Reply With Quote #5

For some reason , i got old version of amxmodx. Thanks


Only problem left , menu still permanent. Can you make it to have only in the first 10s of the round ?

Thank you.
Visan15 is offline
v120kaaimcfg
Member
Join Date: Apr 2024
Old Yesterday , 19:55   Re: [REQ] Weapons menu
Reply With Quote #6

Quote:
Originally Posted by Visan15 View Post
For some reason , i got old version of amxmodx. Thanks


Only problem left , menu still permanent. Can you make it to have only in the first 10s of the round ?

Thank you.
Menu is canceled after 10 seconds. That means that if a player tries to chose 1 or 2 after 10 seconds have passed, nothing will happen because the menu is canceled. To remove the visuals of the menu you would have to send a cmd to the player which again does not guarantee that the menu will close. You can try that by changing:
Code:
public cancel_menu(id)
{
	if(is_user_connected(id-123456))
	{
		menu_cancel(id-123456)
	}
}
to:
Code:
public cancel_menu(id)
{
	if(is_user_connected(id-123456))
	{
		menu_cancel(id-123456)
		client_cmd(id-123456, "slot10")
	}
}

Last edited by v120kaaimcfg; Yesterday at 19:55.
v120kaaimcfg is offline
Visan15
Junior Member
Join Date: Apr 2012
Old Today , 13:37   Re: [REQ] Weapons menu
Reply With Quote #7

Quote:
Originally Posted by v120kaaimcfg View Post
Here:
Code:
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <hamsandwich>

new g_iMenu

public plugin_init()
{
	register_plugin("Weapons Menu", "1.0", "OciXCrom")
	RegisterHam(Ham_Spawn, "player", "OnPlayerSpawn", 1)
	CreateMenu()
}

CreateMenu()
{
	g_iMenu = menu_create("Select your \rweapons\y!", "Menu_Handler")
	menu_additem(g_iMenu, "\wAK47 \y+ \wDeagle")
	menu_additem(g_iMenu, "\wM4A1 \y+ \wDeagle")
}

public OnPlayerSpawn(id)
{
	if(!is_user_alive(id))
	{
		return
	}

	menu_display(id, g_iMenu, 0, 10)
}

public Menu_Handler(id, iMenu, iItem)
{
	if(iItem == MENU_TIMEOUT || iItem == MENU_EXIT)
	{
		return
	}

	strip_user_weapons(id)
	set_pdata_cbase(id, 116, 0)

	switch(iItem)
	{
		case 0:
		{
			give_item(id, "weapon_ak47")
			cs_set_user_bpammo(id, CSW_AK47, 90)
		}
		case 1:
		{
			give_item(id, "weapon_m4a1")
			cs_set_user_bpammo(id, CSW_M4A1, 90)
		}
	}

	give_item(id, "weapon_knife")
	give_item(id, "weapon_deagle")
	cs_set_user_bpammo(id, CSW_DEAGLE, 35)

	if(cs_get_user_team(id) == CS_TEAM_CT)
	{
		give_item(id, "item_thighpack")
	}
}
You are right , nothing happen after 10s. Can you add that cmd for this code ?

Thank you !
Visan15 is offline
v120kaaimcfg
Member
Join Date: Apr 2024
Old Today , 13:41   Re: [REQ] Weapons menu
Reply With Quote #8

Quote:
Originally Posted by Visan15 View Post
You are right , nothing happen after 10s. Can you add that cmd for this code ?

Thank you !
If you took just 10 seconds of your time to look at my reply you would have noticed I've already added it.

Quote:
Originally Posted by v120kaaimcfg View Post
Code:
public cancel_menu(id)
{
	if(is_user_connected(id-123456))
	{
		menu_cancel(id-123456)
		client_cmd(id-123456, "slot10")
	}
}

Last edited by v120kaaimcfg; Today at 13:43.
v120kaaimcfg is offline
Visan15
Junior Member
Join Date: Apr 2012
Old Today , 18:32   Re: [REQ] Weapons menu
Reply With Quote #9

Thank you very much for help !

If i can do something for you let me know.
Visan15 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 23:34.


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