add command when starting round

В този раздел можете да подавате всякакви заявки за намиране, изработка или преработка на плъгини/модове.
Аватар
cnboneco
Извън линия
Foreigner
Foreigner
Мнения: 18
Регистриран на: 12 Дек 2018, 13:33
Местоположение: São Paulo Brasil
Се отблагодари: 19 пъти
Получена благодарност: 4 пъти

add command when starting round

Мнение от cnboneco » 12 Дек 2018, 16:20

I know it's very bold of me to ask for this so soon, but I just wanted to add a command to the plugin, which every round to start open the menu atomatically for the player to choose the weapons without cost of money. If you can not thank me and I'll wait.


Код за потвърждение: Избери целия код

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Menu Armas"
#define VERSION "1.3"
#define AUTHOR "Editado: by Henrique"

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

        register_clcmd("say /menu_armas", "armas_menu")

}

public armas_menu(id)
{
        new menu = menu_create("\r[\dCNIGHT INFERNO ONLINE\r] \wMenu de Armas","menu_armas")
	
        menu_additem(menu, "\wM4A1 + Deagle + Granadas + Colete + Defuse Kit", "1", 0)
        menu_additem(menu, "\wM4A1 + Usp + Granadas + Colete + Defuse Kit", "2", 0)
        menu_additem(menu, "\wAK47 + Deagle + Granadas + Colete", "3", 0)
        menu_additem(menu, "\wAK47 + Usp + Granadas + Colete", "4", 0)
        menu_additem(menu, "\wAWP + Deagle + Granadas + Colete", "5", 0)
        menu_additem(menu, "\wFamas + Deagle + Granadas + Colete + Defuse Kit^n", "6")
        menu_additem(menu, "\wGalil + Deagle + Granadas + Colete^n", "7")
	
        menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
        menu_display(id, menu, 0)
}

public menu_armas(id, menu, item)
{
	
if (item == MENU_EXIT)
{
	
        menu_destroy(menu); return PLUGIN_HANDLED
}

new data[6], iName[64]
new acces, callback

menu_item_getinfo(menu, item, acces, data,5, iName, 63, callback)
new key = str_to_num(data)

switch(key)
{
       case 1 : client_cmd(id,"defuser;vesthelm;m4a1;deagle;secammo;primammo;hegren;flash;flash")
       case 2 : client_cmd(id,"defuser;vesthelm;m4a1;usp;secammo;primammo;hegren;flash;flash")
       case 3 : client_cmd(id,"vesthelm;ak47;deagle;secammo;primammo;hegren;flash;flash")
       case 4 : client_cmd(id,"vesthelm;ak47;usp;secammo;primammo;hegren;flash;flash")
       case 5 : client_cmd(id,"defuser;vesthelm;awp;deagle;secammo;primammo;hegren;flash;flash")
       case 6 : client_cmd(id,"defuser;vesthelm;famas;deagle;secammo;primammo;hegren;flash;flash")
       case 7 : client_cmd(id,"esthelm;galil;deagle;secammo;primammo;hegren;flash;flash")
}

menu_destroy(menu); return PLUGIN_HANDLED
}

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

add command when starting round

Мнение от OciXCrom » 12 Дек 2018, 16:28

In the future, please put codes in a [cоde] tag.

Your code contained slowhacking which is forbidden. There's no reason to force the player to have this command on his v button everywhere he goes, nor it will work for everyone. That piece of the code has been removed.

Код за потвърждение: Избери целия код

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

enum _:Items
{
	Name[64],
	CsTeams:Team
}

new g_iCallback

new const g_szMenuItems[][Items] =
{
    { "M4A1 + Deagle + Granadas + Colete + Defuse Kit", CS_TEAM_CT },
    { "M4A1 + Usp + Granadas + Colete + Defuse Kit", CS_TEAM_CT },
    { "AK47 + Deagle + Granadas + Colete", CS_TEAM_T },
    { "AK47 + Usp + Granadas + Colete", CS_TEAM_T },
    { "AWP + Deagle + Granadas + Colete", CS_TEAM_UNASSIGNED },
    { "Famas + Deagle + Granadas + Colete + Defuse Kit", CS_TEAM_CT },
    { "Galil + Deagle + Granadas + Colete", CS_TEAM_T }
}

public plugin_init()
{
	register_plugin("Armas Menu", "1.0", "OciXCrom")
	RegisterHam(Ham_Spawn, "player", "OnPlayerSpawn", 1)
	g_iCallback = menu_makecallback("armas_callback")
}

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

	new iMenu = menu_create("\r[\dCNIGHT INFERNO ONLINE\r] \wMenu de Armas", "armas_handler")

	for(new i; i < sizeof(g_szMenuItems); i++)
		menu_additem(iMenu, g_szMenuItems[i][Name], .callback = g_iCallback)

	menu_display(id, iMenu)
}

public armas_callback(id, iMenu, iItem)
	return (g_szMenuItems[iItem][Team] == CS_TEAM_UNASSIGNED || g_szMenuItems[iItem][Team] == cs_get_user_team(id)) ? ITEM_ENABLED : ITEM_DISABLED

public armas_handler(id, iMenu, iItem)
{
	switch(iItem)
	{
		case 0:
		{
			give_weapon(id, "weapon_m4a1", CSW_M4A1, 90)
			give_weapon(id, "weapon_deagle", CSW_DEAGLE, 35)
		}
		case 1:
		{
			give_weapon(id, "weapon_m4a1", CSW_M4A1, 90)
			give_weapon(id, "weapon_usp", CSW_USP, 120)
		}
		case 2:
		{
			give_weapon(id, "weapon_ak47", CSW_AK47, 90)
			give_weapon(id, "weapon_deagle", CSW_DEAGLE, 35)
		}
		case 3:
		{
			give_weapon(id, "weapon_ak47", CSW_AK47, 90)
			give_weapon(id, "weapon_usp", CSW_USP, 120)
		}
		case 4:
		{
			give_weapon(id, "weapon_awp", CSW_AWP, 30)
			give_weapon(id, "weapon_deagle", CSW_DEAGLE, 35)
		}
		case 5:
		{
			give_weapon(id, "weapon_famas", CSW_FAMAS, 90)
			give_weapon(id, "weapon_deagle", CSW_DEAGLE, 35)
		}
		case 6:
		{
			give_weapon(id, "weapon_galil", CSW_GALIL, 90)
			give_weapon(id, "weapon_deagle", CSW_DEAGLE, 35)
		}
		default: return
	}

	give_grenades(id)
	give_item(id, "item_westhelm")

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

give_weapon(id, szWeapon[], iCSW = 0, iAmmo = 0)
{
	give_item(id, szWeapon)

	if(iAmmo)
		cs_set_user_bpammo(id, iCSW, iAmmo)
}

give_grenades(id)
{
	give_item(id, "weapon_hegrenade")
	give_item(id, "weapon_flashbang")
	give_item(id, "weapon_flashbang")
}

Аватар
cnboneco
Извън линия
Foreigner
Foreigner
Мнения: 18
Регистриран на: 12 Дек 2018, 13:33
Местоположение: São Paulo Brasil
Се отблагодари: 19 пъти
Получена благодарност: 4 пъти

add command when starting round

Мнение от cnboneco » 13 Дек 2018, 08:26

there is only one problem with the plugin, in case if I am from ct I am getting to buy ak47 or if I am from tr buy the colt, and also is not buying the vest in the kits

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

add command when starting round

Мнение от OciXCrom » 14 Дек 2018, 14:14

You didn't mention anything about team restrictions in the first post. I updated the code.

Аватар
cnboneco
Извън линия
Foreigner
Foreigner
Мнения: 18
Регистриран на: 12 Дек 2018, 13:33
Местоположение: São Paulo Brasil
Се отблагодари: 19 пъти
Получена благодарност: 4 пъти

add command when starting round

Мнение от cnboneco » 14 Дек 2018, 20:56

unfortunately the menu is opening when you start the round, sorry to bother you.

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

add command when starting round

Мнение от OciXCrom » 15 Дек 2018, 15:29

???

That's exactly what you said you want in the first post.
which every round to start open the menu atomatically for the player
Now you say you don't want it?!

Аватар
cnboneco
Извън линия
Foreigner
Foreigner
Мнения: 18
Регистриран на: 12 Дек 2018, 13:33
Местоположение: São Paulo Brasil
Се отблагодари: 19 пъти
Получена благодарност: 4 пъти

add command when starting round

Мнение от cnboneco » 16 Дек 2018, 23:05

sorry I ended up typing wrong, I meant that the menu is not opening when starting the round

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

add command when starting round

Мнение от OciXCrom » 17 Дек 2018, 20:47

I forgot one line. Try now.

Аватар
cnboneco
Извън линия
Foreigner
Foreigner
Мнения: 18
Регистриран на: 12 Дек 2018, 13:33
Местоположение: São Paulo Brasil
Се отблагодари: 19 пъти
Получена благодарност: 4 пъти

add command when starting round

Мнение от cnboneco » 20 Дек 2018, 21:07

excellent is getting yes thank you, you can close the post

Заключено
  • Подобни теми
    Отговори
    Преглеждания
     Последно мнение

Обратно към “Заявки за плъгини”

Кой е на линия

Потребители разглеждащи този форум: Bing [Bot] и 11 госта