Заявка за -Bet плъгин

В този раздел можете да подавате всякакви заявки за намиране, изработка или преработка на плъгини/модове.
Аватар
Season12
Извън линия
Потребител
Потребител
Мнения: 129
Регистриран на: 10 Фев 2019, 19:41
Местоположение: V nas
Получена благодарност: 1 път
Обратна връзка:

Заявка за -Bet плъгин

Мнение от Season12 » 17 Фев 2019, 19:01

Здравейте може ли Bet плъгин.Пример:Bet да е да залагаш на някой отбор пари като bet ct 2000 или bet t 2000

Аватар
Guardian Angel
Извън линия
VIP
VIP
Мнения: 186
Регистриран на: 18 Окт 2016, 02:00
Местоположение: Петрич
Се отблагодари: 1 път
Получена благодарност: 22 пъти

Заявка за -Bet плъгин

Мнение от Guardian Angel » 17 Фев 2019, 19:12

Явно това си видял в някой сървър
https://forums.alliedmods.net/showthrea ... hlight=bet

Аватар
eaglestancex
Извън линия
Потребител
Потребител
Мнения: 25
Регистриран на: 15 Фев 2019, 12:36

Заявка за -Bet плъгин

Мнение от eaglestancex » 17 Фев 2019, 19:53

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

/********************************************************************
******************** [ DEFINES, VARIABLES, HEADERS ] ***********************
********************************************************************/

#include <amxmodx>
#include <fakemeta>
#include <color_chat.inl>

new g_MaxPlayers

new g_iBet[33]
new g_iBetTeam[33]

new g_isTerroristWin
new g_isCounterTerroristWin

new g_iCvarRatio

new g_sSaid[81]
new g_sCommand[24]
new g_sTeam[24]
new g_sMoney[24]
new g_sCheck[2]

new const g_cstrike_offset_money = 115
new const g_offset_linux = 5

stock fm_cs_get_user_money(index)
	return get_pdata_int(index, g_cstrike_offset_money, g_offset_linux)

stock fm_cs_set_user_money(index, money)
	set_pdata_int(index, g_cstrike_offset_money, money, g_offset_linux)

/********************************************************************
*************************** [ FORWARDS ] ******************************
********************************************************************/

public plugin_init()
{
	register_plugin("Betting", "1.0", "Hattrick")
	
	register_concmd("say", "cmdBet", ADMIN_ALL, "<team> <dolars>")
	register_concmd("say_team", "cmdBet", ADMIN_ALL, "<team> <dolars>")
	
	register_logevent("LogEvent_RoundStart", 2, "1=Round_Start")
	register_logevent("LogEvent_RoundEnd", 2, "1=Round_End")
	
	register_event("SendAudio", "Event_TerroristWin", "a", "2=%!MRAD_terwin")
	register_event("SendAudio", "Event_CounterTerroristWin", "a", "2=%!MRAD_ctwin")
	register_event("SendAudio", "Event_RoundDraw", "a", "2=%!MRAD_rounddraw")
	
	g_MaxPlayers = get_maxplayers()
	
	g_iCvarRatio = register_cvar("amx_betting_ratio", "0.32", FCVAR_SERVER)
	
	set_task(230.0, "FuncAnnounce", 342346, _, _, "b")
	
	color_chat_init()
}

public client_disconnect(id)
{
	g_iBet[id] = 0
	g_iBetTeam[id] = 0
}

/********************************************************************
*************************** [ LOG EVENTS ] ******************************
********************************************************************/

public LogEvent_RoundStart()
{
	for (new id = 1; id <= g_MaxPlayers; id++)
	{
		if (is_user_connected(id) && g_iBet[id])
		{
			g_iBet[id] = 0
			g_iBetTeam[id] = 0
		}
	}
	
	g_isTerroristWin = 0
	g_isCounterTerroristWin = 0
}

public LogEvent_RoundEnd()
	set_task(1.0, "FuncCheck", 234324)

/********************************************************************
***************************** [ EVENTS ] ********************************
********************************************************************/

public Event_TerroristWin()
	g_isTerroristWin = 1

public Event_CounterTerroristWin()
	g_isCounterTerroristWin = 1

public Event_RoundDraw()
{
	g_isTerroristWin = 0
	g_isCounterTerroristWin = 0
}

/********************************************************************
*************************** [ COMMANDS ] ******************************
********************************************************************/

public cmdBet(id)
{
	read_args(g_sSaid, charsmax(g_sSaid))
	remove_quotes(g_sSaid)
	
	g_sCommand[0] = '^0'
	g_sTeam[0] = '^0'
	g_sMoney[0] = '^0'
	g_sCheck[0] = '^0'
	
	parse(g_sSaid, g_sCommand, charsmax(g_sCommand), g_sTeam, charsmax(g_sTeam), g_sMoney, charsmax(g_sMoney), g_sCheck, charsmax(g_sCheck))
	
	if (g_sCheck[0] == 0)
	{
		if (!equali(g_sCommand, "bet") || !equali(g_sCommand, "Bet") || !equali(g_sCommand, "BET"))
			return PLUGIN_CONTINUE
		
		if (g_iBet[id])
		{
			ColorChat(id, RED, "[AMXX]^x01 You have already placed a bet this round.")
			return PLUGIN_HANDLED
		}
		
		if (is_user_alive(id))
		{
			ColorChat(id, RED, "[AMXX]^x01 You must be dead to place a bet.")
			return PLUGIN_HANDLED
		}
		
		if (get_user_team(id) == 3)
		{
			ColorChat(id, RED, "[AMXX]^x01 You must be 't' or 'ct' to place a bet.")
			return PLUGIN_HANDLED
		}
		
		if (fm_cs_get_user_money(id) == 0)
		{
			ColorChat(id, RED, "[AMXX]^x01 You do not have enough money for that bet.")
			return PLUGIN_HANDLED
		}
		
		if (!g_sTeam[0])
		{
			ColorChat(id, RED, "[AMXX]^x01 You can write in chat^x04 bet <team> <dolars>^x01. Teams are:^x03 T^x01 and^x03 CT^x01.")
			return PLUGIN_HANDLED
		}
		
		if (FuncGetCTs() == 0 || FuncGetTs() == 0)
		{
			ColorChat(id, RED, "[AMXX]^x01 You can't bet when either team is empty.")
			return PLUGIN_HANDLED
		}
		
		if (FuncGetAliveCTs() == 0 || FuncGetAliveTs() == 0)
		{
			ColorChat(id, RED, "[AMXX]^x01 You can't bet when either team is dead.")
			return PLUGIN_HANDLED
		}
		
		if (g_sTeam[0] == 'c' || g_sTeam[0] == 'C' || g_sTeam[0] == '2')
		{
			new iMoney
			
			if (g_sMoney[0] == 'a' || g_sMoney[0] == 'A')
				iMoney = fm_cs_get_user_money(id)
			else
				iMoney = str_to_num(g_sMoney)
			
			if (!iMoney)
			{
				ColorChat(id, RED, "[AMXX]^x01 You can't bet^x04 0 $^x01.")
				return PLUGIN_HANDLED
			}
			
			if (iMoney > fm_cs_get_user_money(id))
			{
				ColorChat(id, RED, "[AMXX]^x01 You're trying to bet a too large amount. Your money are:^x04 %d $^x01.", fm_cs_get_user_money(id))
				return PLUGIN_HANDLED
			}
			
			g_iBet[id] = iMoney
			g_iBetTeam[id] = 2
			new x = floatround(iMoney * get_pcvar_float(g_iCvarRatio))
			ColorChat(id, RED, "[AMXX]^x01 You have bet^x04 %d $^x01 on^x04 COUNTER-TERRORISTS^x01. You will receive/lost^x04 %d $^x01.", iMoney, x)
		}
		
		if (g_sTeam[0] == 't' || g_sTeam[0] == 'T' || g_sTeam[0] == '1')
		{
			new iMoney
			
			if (g_sMoney[0] == 'a' || g_sMoney[0] == 'A')
				iMoney = fm_cs_get_user_money(id)
			else
				iMoney = str_to_num(g_sMoney)
			
			if (!iMoney)
			{
				ColorChat(id, RED, "[AMXX]^x01 You can't bet^x04 0 $^x01.")
				return PLUGIN_HANDLED
			}
			
			if (iMoney > fm_cs_get_user_money(id))
			{
				ColorChat(id, RED, "[AMXX]^x01 You're trying to bet a too large amount. Your money are:^x04 %d $^x01.", fm_cs_get_user_money(id))
				return PLUGIN_HANDLED
			}
			
			g_iBet[id] = iMoney
			g_iBetTeam[id] = 1
			new x = floatround(iMoney * get_pcvar_float(g_iCvarRatio))
			ColorChat(id, RED, "[AMXX]^x01 You have bet^x04 %d $^x01 on^x04 TERRORISTS^x01. You will receive/lost^x04 %d $^x01.", iMoney, x)
		}
	}
	return PLUGIN_CONTINUE
}

/********************************************************************
*************************** [ FUNCTIONS ] *******************************
********************************************************************/

public FuncCheck()
{
	for (new id = 1; id <= g_MaxPlayers; id++)
	{
		if (!is_user_connected(id) || !g_iBet[id])
			continue
		
		if (g_isTerroristWin && g_iBetTeam[id] == 1)
		{
			new x = floatround(g_iBet[id] * get_pcvar_float(g_iCvarRatio))
			fm_cs_set_user_money(id, fm_cs_get_user_money(id) + x)
			ColorChat(id, RED, "[AMXX]^x01 You won^x04 %d $^x01 from last betting.", x)
		}
		
		if (g_isTerroristWin && g_iBetTeam[id] == 2)
		{
			new x = floatround(g_iBet[id] * get_pcvar_float(g_iCvarRatio))
			fm_cs_set_user_money(id, fm_cs_get_user_money(id) - x)
			ColorChat(id, RED, "[AMXX]^x01 You lose^x04 %d $^x01 from last betting.", x)
		}
		
		if (g_isCounterTerroristWin && g_iBetTeam[id] == 1)
		{
			new x = floatround(g_iBet[id] * get_pcvar_float(g_iCvarRatio))
			fm_cs_set_user_money(id, fm_cs_get_user_money(id) - x)
			ColorChat(id, RED, "[AMXX]^x01 You lose^x04 %d $^x01 from last betting.", x)
		}
		
		if (g_isCounterTerroristWin && g_iBetTeam[id] == 2)
		{
			new x = floatround(g_iBet[id] * get_pcvar_float(g_iCvarRatio))
			fm_cs_set_user_money(id, fm_cs_get_user_money(id) + x)
			ColorChat(id, RED, "[AMXX]^x01 You won^x04 %d $^x01 from last betting.", x)
		}
		
		if (!g_isTerroristWin && !g_isCounterTerroristWin)
			ColorChat(id, RED, "[AMXX]^x01 No one team had won! The bets will be canceled.")
	}
}

FuncGetTs()
{
	static x
	x = 0
	
	for (new id = 1; id <= g_MaxPlayers; id++)
	{
		if (!is_user_connected(id) || !(get_user_team(id) == 1))
			continue
		
		x++
	}
	return x
}

FuncGetCTs()
{
	static x
	x = 0
	
	for (new id = 1; id <= g_MaxPlayers; id++)
	{
		if (!is_user_connected(id) || !(get_user_team(id) == 2))
			continue
		
		x++
	}
	return x
}

FuncGetAliveTs()
{
	static x
	x = 0
	
	for (new id = 1; id <= g_MaxPlayers; id++)
	{
		if (!is_user_connected(id) || !(get_user_team(id) == 1) || !is_user_alive(id))
			continue
		
		x++
	}
	return x
}

FuncGetAliveCTs()
{
	static x
	x = 0
	
	for (new id = 1; id <= g_MaxPlayers; id++)
	{
		if (!is_user_connected(id) || !(get_user_team(id) == 2) || !is_user_alive(id))
			continue
		
		x++
	}
	return x
}

public FuncAnnounce()
	ColorChat(0, RED, "[AMXX]^x01 You can write in chat^x04 bet <team> <dolars>^x01 for betting on one team!")
Прикачени файлове
color_chat.zip
(1.46 KiB) Свалено 137 пъти
color_chat.zip
(1.46 KiB) Свалено 137 пъти

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

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

Кой е на линия

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