Only 1 HE Bomb per Round

В този раздел можете да подавате всякакви заявки за намиране, изработка или преработка на плъгини/модове.
Аватар
Infamous2018
Извън линия
Foreigner
Foreigner
Мнения: 522
Регистриран на: 08 Апр 2018, 16:56
Се отблагодари: 14 пъти
Получена благодарност: 21 пъти

Only 1 HE Bomb per Round

Мнение от Infamous2018 » 17 Май 2019, 22:08

Hello, can anyone create an Plugin that an Player is allowed only to use ONE HE Bomb per Round? need it for my Poolday Server. It would be great. THX

Maybe that they get an message like: "You are allowed to use only 1 Bomb per Round"

Аватар
blazz3rzbg
Извън линия
AMXX Скриптър
AMXX Скриптър
Мнения: 50
Регистриран на: 22 Фев 2019, 14:38
Местоположение: Стара Загора
Се отблагодари: 12 пъти
Получена благодарност: 16 пъти

Only 1 HE Bomb per Round

Мнение от blazz3rzbg » 18 Май 2019, 05:51

Have you searched ? :P You can simply try this https://forums.alliedmods.net/showthread.php?t=179443

Аватар
Infamous2018
Извън линия
Foreigner
Foreigner
Мнения: 522
Регистриран на: 08 Апр 2018, 16:56
Се отблагодари: 14 пъти
Получена благодарност: 21 пъти

Only 1 HE Bomb per Round

Мнение от Infamous2018 » 18 Май 2019, 12:12

This Link blocks only the Buying Bombs. But poolday have in Pool multiple Bombs. Thats the reason why i am searching an Plugin who allow only one bomb per round.

Добавено преди 46 минути 52 секунди:
i tested ur link and it dont work.

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

Only 1 HE Bomb per Round

Мнение от OciXCrom » 20 Май 2019, 02:12

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

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define m_pPlayer 41
#define m_flNextPrimaryAttack 46
#define XO_WEAPON 4

new const GRENADE_LIMIT = 1
new g_iThrownGrenades[33]

public plugin_init()
{
	register_plugin("HE Grenade Limit", "1.0", "OciXCrom")
	RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_hegrenade", "PreThrowHe", 0)
	register_logevent("OnRoundStart", 2, "0=World triggered", "1=Round_Start")
}

public client_putinserver(id)
	reset_limit(id)

public OnRoundStart()
{
    arrayset(g_iThrownGrenades, 0, sizeof(g_iThrownGrenades))
}

public PreThrowHe(iWeapon)
{
	new id = get_pdata_cbase(iWeapon, m_pPlayer, XO_WEAPON)

	if(g_iThrownGrenades[id]++ >= GRENADE_LIMIT)
	{
		client_print(id, print_center, "You can throw only %i HE grenade per spawn", GRENADE_LIMIT)
		set_pdata_float(iWeapon, m_flNextPrimaryAttack, 1.0, XO_WEAPON)
		return HAM_SUPERCEDE
	}

	return HAM_IGNORED
}

reset_limit(id)
	g_iThrownGrenades[id] = 0

Аватар
blazz3rzbg
Извън линия
AMXX Скриптър
AMXX Скриптър
Мнения: 50
Регистриран на: 22 Фев 2019, 14:38
Местоположение: Стара Загора
Се отблагодари: 12 пъти
Получена благодарност: 16 пъти

Only 1 HE Bomb per Round

Мнение от blazz3rzbg » 20 Май 2019, 02:35

OciXCrom написа: 20 Май 2019, 02:12

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

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define m_pPlayer 41
#define m_flNextPrimaryAttack 46
#define XO_WEAPON 4

new const GRENADE_LIMIT = 1
new g_iThrownGrenades[33]

public plugin_init()
{
	register_plugin("HE Grenade Limit", "1.0", "OciXCrom @ Skype")
	RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_hegrenade", "PreThrowHe", 0)
	register_logevent("OnRoundStart", 2, "0=World triggered", "1=Round_Start")
}

public client_putinserver(id)
	reset_limit(id)

public OnRoundStart()
{
    arrayset(g_iThrownGrenades, 0, sizeof(g_iThrownGrenades))
}

public PreThrowHe(iWeapon)
{
	new id = get_pdata_cbase(iWeapon, m_pPlayer, XO_WEAPON)

	if(g_iThrownGrenades[id] == GRENADE_LIMIT)
	{
		client_print(id, print_center, "You can throw only %i HE grenade per spawn", GRENADE_LIMIT)
		set_pdata_float(iWeapon, m_flNextPrimaryAttack, 1.0, XO_WEAPON)
		return HAM_SUPERCEDE
	}

	return HAM_IGNORED
}

reset_limit(id)
	g_iThrownGrenades[id] = 0
sizeof(g_iThrownGrenades) ? ? ?

I think it should be

sizeof g_iThrownGrenades

Not a big deal but I think its more correct that way.

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

Only 1 HE Bomb per Round

Мнение от OciXCrom » 20 Май 2019, 02:57

It's the same thing. You can even do:

register_plugin "HE Grenade Limit", "1.0", "OciXCrom"

... clearly we aren't using this "style" anywhere, so why should we do it with sizeof? Brackets in functions are optional.

Аватар
blazz3rzbg
Извън линия
AMXX Скриптър
AMXX Скриптър
Мнения: 50
Регистриран на: 22 Фев 2019, 14:38
Местоположение: Стара Загора
Се отблагодари: 12 пъти
Получена благодарност: 16 пъти

Only 1 HE Bomb per Round

Мнение от blazz3rzbg » 20 Май 2019, 04:46

OciXCrom написа: 20 Май 2019, 02:57 It's the same thing. You can even do:

register_plugin "HE Grenade Limit", "1.0", "OciXCrom"

... clearly we aren't using this "style" anywhere, so why should we do it with sizeof? Brackets in functions are optional.
As I know sizeof isnt a function so () will work fine but without brackets is more correct.
Depends on your style as you said.. Just wanted to mention it.

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

Only 1 HE Bomb per Round

Мнение от OciXCrom » 20 Май 2019, 16:20

It is a function, but not from AMXX itself. It's the same as if, for and the other ones. But yeah, it doesn't really matter as it's just my prefered style.

Аватар
Infamous2018
Извън линия
Foreigner
Foreigner
Мнения: 522
Регистриран на: 08 Апр 2018, 16:56
Се отблагодари: 14 пъти
Получена благодарност: 21 пъти

Only 1 HE Bomb per Round

Мнение от Infamous2018 » 20 Май 2019, 20:27

THX - I will test the Plugin and let u know if works or not.

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

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

#define m_pPlayer 41
#define m_flNextPrimaryAttack 46
#define XO_WEAPON 4

new const GRENADE_LIMIT = 1
new g_iThrownGrenades[33]

public plugin_init()
{
	register_plugin("HE Grenade Limit", "1.0", "OciXCrom @ Skype")
	RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_hegrenade", "PreThrowHe", 0)
	register_logevent("OnRoundStart", 2, "0=World triggered", "1=Round_Start")
}

public client_putinserver(id)
	reset_limit(id)

public OnRoundStart()
{
    arrayset(g_iThrownGrenades, 0, sizeof(g_iThrownGrenades))
}

public PreThrowHe(iWeapon)
{
	new id = get_pdata_cbase(iWeapon, m_pPlayer, XO_WEAPON)

	if(g_iThrownGrenades[id] == GRENADE_LIMIT)
	{
		client_print(id, print_center, "You can throw only %i HE grenade per spawn", GRENADE_LIMIT)
		set_pdata_float(iWeapon, m_flNextPrimaryAttack, 1.0, XO_WEAPON)
		return HAM_SUPERCEDE
	}

	return HAM_IGNORED
}

reset_limit(id)
	g_iThrownGrenades[id] = 0
	
This one dont work. When i jump in the pool i can use all bombs one by one :(

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

Only 1 HE Bomb per Round

Мнение от OciXCrom » 20 Май 2019, 21:25

I edited the code, try now.

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

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

Кой е на линия

Потребители разглеждащи този форум: 0 регистрирани и 16 госта