Пользователь
- Сообщения
- 17
- Реакции
- -2
- Ошибка
-
Не выдает выйгрыш и опыт игрокам
- ОС
- Linux
- Билд
-
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.4.0.654-dev
Build date: 12:09:21 May 22 2018 (1501)
- ReGamedll
-
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.4.0.654-dev
Build date: 12:09:21 May 22 2018 (1501)
- Список метамодулей
-
[ 1] VoiceTranscoder RUN - VoiceTranscoder. v2017RC3 ini ANY ANY
[ 2] Reunion RUN - reunion_mm_i386. v0.1.75 ini Start Never
[ 3] AMX Mod X RUN - amxmodx_mm_i386. v1.8.2 ini Start ANY
[ 4] ReAuthCheck RUN - reauthcheck_mm_i v0.1.6 ini Start Never
[ 5] Rechecker RUN - rechecker_mm_i38 v2.4 ini Chlvl ANY
[ 6] ReSemiclip RUN - resemiclip_mm_i3 v2.3.9 ini Chlvl ANY
[ 7] WHBlocker RUN - whblocker_mm_i38 v1.5.695 ini Chlvl ANY
[ 8] MySQL RUN - mysql_amxx_i386. v1.8.2 pl3 ANY ANY
[ 9] ReAPI RUN - reapi_amxx_i386. v5.6.0.1 pl3 ANY Never
[10] CStrike RUN - cstrike_amxx_i38 v1.8.2 pl3 ANY ANY
[11] Engine RUN - engine_amxx_i386 v1.8.2 pl3 ANY ANY
[12] FakeMeta RUN - fakemeta_amxx_i3 v1.8.2 pl3 ANY ANY
[13] Ham Sandwich RUN - hamsandwich_amxx v1.8.2 pl3 ANY ANY
[14] Fun RUN - fun_amxx_i386.so v1.8.2 pl3 ANY ANY
14 plugins, 14 running
- Список плагинов
-
Currently loaded plugins:
name version author file status
[ 1] Admin Loader 3.4 neygomon admin_loader.am running
[ 2] Lite Bans 2.1 neygomon lite_bans_182.a running
[ 3] AIM detector 0.9.4b kanagava aim_detector.am running
[ 4] Anti Flood 1.8.2 AMXX Dev Team antiflood.amxx running
[ 5] Admin Commands 1.8.2 AMXX Dev Team admincmd.amxx running
[ 6] Admin Votes 1.8.2 AMXX Dev Team adminvote.amxx running
[ 7] Admin Chat 1.8.M AMXX Dev Team adminchat.amxx running
[ 8] Commands Menu 1.8.2 AMXX Dev Team cmdmenu.amxx running
[ 9] Map Manager 2.5.54 Mistrick mapmanager.amxx running
[ 10] Map Manager: Sub Plugi 0.1 Mistrick mapmanager_subp running
[ 11] Maps Menu 1.8.2 AMXX Dev Team mapsmenu.amxx running
[ 12] Menus Front-End 1.8.2 AMXX Dev Team menufront.amxx running
[ 13] Pause Plugins 1.8.2 AMXX Dev Team pausecfg.amxx running
[ 14] Players Menu 1.8.M AMXX Dev Team plmenu.amxx running
[ 15] Restrict Weapons 1.8.2 AMXX Dev Team restmenu.amxx running
[ 16] CSStatsX SQL 0.7.4 serfreeman1337 csstatsx_sql.am running
[ 17] Stats Configuration 1.8.2 AMXX Dev Team statscfg.amxx running
[ 18] Teleport Menu 1.8.2 AMXX Dev Team telemenu.amxx running
[ 19] Plugin Menu 1.8.1.3746 AMXX Dev Team pluginmenu.amxx running
[ 20] V.I.P Custom Weapons 1.0.0 Vaqtincha vip_custom.amxx running
[ 21] V.I.P Custom M4A1 1.0.0 Vaqtincha custom_m4a1.amx running
[ 22] V.I.P Custom KNIFE 1.0.0 Vaqtincha custom_knife.am running
[ 23] V.I.P Custom DEAGLE 1.0.0 Vaqtincha custom_deagle.a running
[ 24] V.I.P Custom AWP 1.0.0 Vaqtincha custom_awp.amxx running
[ 25] V.I.P Custom AK-47 1.0.0 Vaqtincha custom_ak47.amx running
[ 26] Killa HP 1.0 jas0n killa_hp.amxx running
[ 27] ComboSprites 0.5 Chrescoe1 combo_sprtes.am running
[ 28] Kill Assist 1.0 Dom1no_[KZ] kill_assist.amx running
[ 29] Parachute 1.0 maeStro parachute.amxx running
[ 30] Automatic knife duel 0.3 JGHG automatic_knife running
[ 31] COLORS MENU 1.2 DUKKHAZ0R color.amxx running
[ 32] Knife WarnUP 1.0 ill knife_warm-up.a running
[ 33] AFK Manager v1.4d Leon McVeran afk_manager.amx running
[ 34] Ultimate Sounds 1.7 Dizzy / Bmann_42 f_ultimate_soun running
[ 35] No Players Map 0.1 X-factor nomap_players.a running
[ 36] Block HudTextArgs 1.0 ConnorMcLeod hudTextArgsBloc running
[ 37] IP 2.1 Bl0ck IP.amxx running
[ 38] Nade Messages 1.0 v3x nademessages.am running
[ 39] mute menu 1.0 cheap_suit mutemenu.amxx running
[ 40] Auto recording demo 2.0 IzI | Bonaqua (R amx_autodemorec running
[ 41] custom.hpk Control 2.0 Northon customhpk_contr running
[ 42] Reset_Score 1.0 Silenttt Fixed b Resetscore.amxx running
[ 43] Instant AutoTeamBalanc 1.2.0 ConnorMcLeod instant_autotea running
[ 44] AWPoff 3.0 PAffAEJIkA :3 awp.amxx running
[ 45] Rock to Ban 1.01 Safety1st rock2ban.amxx running
[ 46] Player Model 2.13c commonbullet playermodel.amx running
[ 47] Autoresponder/Advertis 0.5 MaximusBrood ad_manager.amxx running
[ 48] Grenade Mode 0.6 gyxoBka grenade_mode.am running
[ 49] Effects plug-in 1.0 OverGame effects.amxx running
[ 50] say /vk by gena 0.1 GeNa say_vk.amxx running
[ 51] FullSpawns 1.0 Eg@r4$il{ FullSpawns.amxx running
[ 52] Stop Chat Ad 2.0.0 MastaMan stop_chat_ad.am running
[ 53] Nice Gamer 1.0 Got Milk? Nice.amxx running
[ 54] Accuracy Fix 1.0 Numb accuracy_fix.am running
[ 55] First Killer Bonus 0.0.1f wopox1337 FirstKillerBonu running
[ 56] Ping Checker 26.0.1 RC1 h1k3 ping_checker.am running
[ 57] DHUD Advert. 2.0 DUKKHAZ0R dhud_advert.amx running
[ 58] Game Namer Version 1. NeuroToxin gamenamechanger running
[ 59] Knives Shop 1.2 OverGame knives.amxx running
[ 60] say /me and /hp 0.3 neygomon sayme.amxx running
[ 61] Team Flash Snitch 1.1 Tender teamflashsnitch running
[ 62] SpecList by HENRI(_)LL 3.0 HENRI(_)LLOYD speclist_remake running
[ 63] [Reapi] Custom Models 1.6.1 neygomon custom_models.a running
[ 64] sf_bets running
[ 65] Lite Translit 2.8 neygomon lite_translit_c running
[ 66] Advanced Experience Sy 0.5.9 [REA serfreeman1337/s aes_main.amxx running
[ 67] AES: CStrike Addon 0.5.9 [REA serfreeman1337/s aes_exp_cstrike running
[ 68] AES: Informer 0.5 Vega serfreeman1337 aes_informer.am running
[ 69] AES: Admin Tools 0.5.9 [REA serfreeman1337/s aes_exp_editor. running
[ 70] AES: StatsX 0.5.9 [REA serfreeman1337/s aes_statsx_cstr running
70 plugins, 70 running
- Исходный код
-
/*
* SF Bets v. 0.1.5
* by serfreeman1337 http://1337.uz/
*/
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta>
#define PLUGIN "SF Bets"
#define VERSION "0.1.5"
#define AUTHOR "serfreeman1337"
#define AES // раскомментируйте для возможности ставить опыт AES (http://1337.uz/advanced-experience-system/)
//#define ACP // раскомментируйте для возможности ставить очки ACP (http://www.a114games.com/community/threads/igrovye-akkaunty-ili-sistema-registracii-nikov.1658/)
#if defined AES
#include <aes_main>
#endif
#if defined ACP
#include <acp>
/*acp_get_player_auth(id)
return 1
acp_get_player_points(id)
return 1337*/
acp_take_player_points(id,points)
{
if(callfunc_begin("TakePoints","acp_general.amxx"))
{
callfunc_push_int(id)
callfunc_push_int(points)
callfunc_end()
}
}
acp_give_player_points(id,points)
{
if(callfunc_begin("GivePoints","acp_general.amxx"))
{
callfunc_push_int(id)
callfunc_push_int(points)
callfunc_end()
}
}
#endif
#if AMXX_VERSION_NUM < 183
#include <colorchat>
#define print_team_default DontChange
#define print_team_grey Grey
#define print_team_red Red
#define print_team_blue Blue
#define MAX_PLAYERS 32
#define MAX_NAME_LENGTH 32
#define argbreak strbreak
#endif
// данный код не рекомендуется смотреть людям страдающим синдромом оптимизации
// -- КОНСТАНТЫ -- //
enum _:players_data_struct
{
BET_FOR, // на кого поставил игрок
BET_MONEY // деньги
#if defined AES
,BET_EXP,
BET_BONUS
#endif
#if defined ACP
,BET_POINTS
#endif
}
enum _:cvars
{
CVAR_MIN_PLAYERS,
CVAR_BET_TIME,
CVAR_BET_AUTOOPEN,
CVAR_BET_MONEY,
CVAR_BET_MODE,
CVAR_BET_MULTIPLER
#if defined AES
,CVAR_BET_EXP,
CVAR_BET_BONUS
#endif
#if defined ACP
,CVAR_BET_POINTS
#endif
}
const taskid_updatemenu = 31337
new const lyl_array[][] = {
{CVAR_BET_MONEY,BET_MONEY}
#if defined AES
,{CVAR_BET_EXP,BET_EXP}
,{CVAR_BET_BONUS,BET_BONUS}
#else
,{-1,-1}
,{-1,-1}
#endif
#if defined ACP
,{CVAR_BET_POINTS,BET_POINTS}
#else
,{-1,-1}
#endif
}
#define m_iJoinedState 121
// -- ПЕРЕМЕННЫЕ -- //
new t_id,ct_id // id игроков 1х1
new Float:bet_time // время ставки
new bet_menu
new players_data[MAX_PLAYERS + 1][players_data_struct]
new cvar[cvars]
new HamHook:hook_playerKilled
new menuCB_bet
public plugin_init()
{
register_plugin(PLUGIN,VERSION,AUTHOR)
// sf plugin tracker
register_cvar("sf_bets", VERSION, FCVAR_SERVER | FCVAR_SPONLY | FCVAR_UNLOGGED)
hook_playerKilled = RegisterHam(Ham_Killed,"player","HamHook_PlayerKilled",true)
register_logevent("Bet_CheckMinPlayers",3,"1=joined team")
register_event("SendAudio", "EventHook_TWin", "a", "2&%!MRAD_terwin")
register_event("SendAudio", "EventHook_CtWin", "a", "2&%!MRAD_ctwin")
register_event("HLTV", "EventHook_NewRound", "a", "1=0", "2=0")
//
// Минимальное количество игроков в обеих командах для работы ставок
//
cvar[CVAR_MIN_PLAYERS] = register_cvar("sf_bet_min_players","2")
//
// Время, в течении которого можно сделать ставку
//
cvar[CVAR_BET_TIME] = register_cvar("sf_bet_time","15")
//
// Ставка денег
//
cvar[CVAR_BET_MONEY] = register_cvar("sf_bet_money","100 1000 3000")
//
// Как расчитывается выигрыш
// 0 - выигрышем является сумма поставленная на проигравшего, делится в процентом соотношении ставки победителей
// 1 - выигрышем является ваша ставка
//
cvar[CVAR_BET_MODE] = register_cvar("sf_bet_mode","0")
//
// Множитель выигрыша
//
cvar[CVAR_BET_MULTIPLER] = register_cvar("sf_bet_multipler","1.0")
#if defined AES
//
// Ставка опыта
//
cvar[CVAR_BET_EXP] = register_cvar("sf_bet_exp","50 100 300")
//
// Ставка бонусов
//
cvar[CVAR_BET_BONUS] = register_cvar("sf_bet_bonus","")
#endif
#if defined ACP
//
// Ставка очков ACP
//
cvar[CVAR_BET_POINTS] = register_cvar("sf_bet_points","")
#endif
//
// Автоматическое открытие меню ставок
//
cvar[CVAR_BET_AUTOOPEN] = register_cvar("sf_bet_auto","1")
register_clcmd("say /bet","Bet_ShowMenu",-1,"- open bet menu")
register_dictionary("sf_bets.txt")
register_dictionary("common.txt")
}
public plugin_cfg()
{
server_exec()
// --- МЕНЮ --- //
bet_menu = menu_create("Bet Menu","Bet_MenuHandler")
menuCB_bet = menu_makecallback("Bet_MenuCallback")
menu_additem(bet_menu,"Player T","0",.callback = menuCB_bet)
menu_additem(bet_menu,"Player CT","1",.callback = menuCB_bet)
new v_cvar[10]
get_pcvar_string(cvar[CVAR_BET_MONEY],v_cvar,charsmax(v_cvar))
if(v_cvar[0])
menu_additem(bet_menu,"Money","2",.callback = menuCB_bet)
#if defined AES
get_pcvar_string(cvar[CVAR_BET_EXP],v_cvar,charsmax(v_cvar))
if(v_cvar[0])
menu_additem(bet_menu,"Exp","3",.callback = menuCB_bet)
get_pcvar_string(cvar[CVAR_BET_BONUS],v_cvar,charsmax(v_cvar))
if(v_cvar[0])
menu_additem(bet_menu,"Bonus","4",.callback = menuCB_bet)
#endif
#if defined ACP
get_pcvar_string(cvar[CVAR_BET_POINTS],v_cvar,charsmax(v_cvar))
if(v_cvar[0])
menu_additem(bet_menu,"Points","5",.callback = menuCB_bet)
#endif
}
public client_disconnect(id)
{
// TODO: придумать что-то
set_task(0.1,"Bet_CheckMinPlayers")
if(players_data[id][BET_FOR])
{
#if defined AES
if(players_data[id][BET_EXP])
{
aes_add_player_exp(id,-players_data[id][BET_EXP],true)
}
if(players_data[id][BET_BONUS])
{
aes_add_player_bonus(id,-players_data[id][BET_BONUS])
}
#endif
#if defined ACP
if(players_data[id][BET_POINTS])
{
acp_take_player_points(id,players_data[id][BET_POINTS])
}
#endif
}
arrayset(players_data[id],0,players_data_struct)
}
//
// Победа T
//
public EventHook_TWin()
{
if(t_id && ct_id)
Bet_End1x1(t_id)
}
//
// Победа CT
//
public EventHook_CtWin()
{
if(t_id && ct_id)
Bet_End1x1(ct_id)
}
public EventHook_NewRound()
{
if(t_id || ct_id)
{
new players[MAX_PLAYERS],pnum
get_players(players,pnum,"ch")
for(new i ; i < pnum ; i++)
{
arrayset(players_data[players[i]],0,players_data_struct)
}
t_id = 0
ct_id = 0
bet_time = 0.0
}
}
//
// Вкл/выкл обнаружения 1x1 по кол-ву игроков в командах
//
public Bet_CheckMinPlayers()
{
new players[MAX_PLAYERS],pnum,min_players = get_pcvar_num(cvar[CVAR_MIN_PLAYERS])
// проверяем кол-во игроков за T
get_players(players,pnum,"e","TERRORIST")
if(pnum < min_players)
{
DisableHamForward(hook_playerKilled)
return PLUGIN_CONTINUE
}
// проверяем кол-во игроков за CT
get_players(players,pnum,"e","CT")
if(pnum < min_players)
{
DisableHamForward(hook_playerKilled)
return PLUGIN_CONTINUE
}
// вкл все
if(Bet_Check1x1())
{
Bet_Start()
}
EnableHamForward(hook_playerKilled)
return PLUGIN_CONTINUE
}
public HamHook_PlayerKilled()
{
if(Bet_Check1x1())
{
Bet_Start()
}
}
//
// Начало 1х1
//
public Bet_Start()
{
bet_time = get_gametime() + get_pcvar_float(cvar[CVAR_BET_TIME])
// показываем меню всем
if(get_pcvar_num(cvar[CVAR_BET_AUTOOPEN]))
{
new players[MAX_PLAYERS],pnum
get_players(players,pnum,"ch")
for(new i,player ; i < pnum ; i++)
{
player = players[i]
Bet_ShowMenu(player)
}
}
// таск обновление меню игрокам
if(!task_exists(taskid_updatemenu))
set_task(0.5,"Bet_UpdateMenu",taskid_updatemenu,.flags = "b")
}
//
// Конец 1x1
//
public Bet_End1x1(win_practicant)
{
new players[MAX_PLAYERS],pnum
get_players(players,pnum,"ch")
bet_time = 0.0
remove_task(taskid_updatemenu)
Bet_UpdateMenu()
for(new i,player ; i < pnum ; i++)
{
player = players[i]
// игрок не делал ставку
if(!players_data[player][BET_FOR])
{
continue
}
// победная ставка
if(players_data[player][BET_FOR] == win_practicant)
{
new win_name[MAX_NAME_LENGTH]
get_user_name(players_data[player][BET_FOR],win_name,charsmax(win_name))
new prize,prize_str[128],prize_len
prize = Bet_GetWinPool(player,BET_MONEY,win_practicant)
// выдаем деньги
if(prize)
{
prize_len += formatex(prize_str[prize_len],charsmax(prize_str) - prize_len,"%L",
player,"SF_BET14",
prize
)
cs_set_user_money(player,
cs_get_user_money(player) + prize
)
}
#if defined AES
// выдаем опыт
prize = Bet_GetWinPool(player,BET_EXP,win_practicant)
if(prize)
{
prize_len += formatex(prize_str[prize_len],charsmax(prize_str) - prize_len,"%s%L",
prize_len ? ", " : "",
player,"SF_BET15",
prize
)
aes_add_player_exp(player,prize)
}
// выдаем бонусы
prize = Bet_GetWinPool(player,BET_BONUS,win_practicant)
if(prize)
{
prize_len += formatex(prize_str[prize_len],charsmax(prize_str) - prize_len,"%s%L",
prize_len ? ", " : "",
player,"SF_BET21",
prize
)
aes_add_player_bonus(player,prize)
}
#endif
#if defined ACP
prize = Bet_GetWinPool(player,BET_POINTS,win_practicant)
if(prize)
{
prize_len += formatex(prize_str[prize_len],charsmax(prize_str) - prize_len,"%s%L",
prize_len ? ", " : "",
player,"SF_BET25",
prize
)
acp_give_player_points(player,prize)
}
#endif
if(!prize_len)
{
formatex(prize_str,charsmax(prize_str),"%L",player,"SF_BET22")
}
client_print_color(player,print_team_blue,"%L %L",
player,"SF_BET9",
player,"SF_BET13",
win_name,prize_str
)
}
// фейловая ставка
else
{
new lose_name[MAX_NAME_LENGTH]
get_user_name(players_data[player][BET_FOR],lose_name,charsmax(lose_name))
client_print_color(player,print_team_red,"%L %L",
player,"SF_BET9",
player,"SF_BET12",
lose_name
)
if(players_data[player][BET_MONEY])
{
cs_set_user_money(player,
cs_get_user_money(player) - players_data[player][BET_MONEY]
)
}
#if defined AES
if(players_data[player][BET_EXP])
{
aes_add_player_exp(player,-players_data[player][BET_EXP],true)
}
if(players_data[player][BET_BONUS])
{
aes_add_player_bonus(player,-players_data[player][BET_BONUS])
}
#endif
#if defined ACP
if(players_data[player][BET_POINTS])
{
acp_take_player_points(player,players_data[player][BET_POINTS])
}
#endif
}
arrayset(players_data[player],0,players_data_struct)
}
}
//
// Функция обновления меню игрокам
//
public Bet_UpdateMenu()
{
new players[MAX_PLAYERS],pnum
get_players(players,pnum,"ch")
new Float:bet_left = bet_time - get_gametime()
for(new i,player,menu,newmenu,menupage ; i < pnum ; i++)
{
player = players[i]
player_menu_info(player,menu,newmenu,menupage)
// обновляем меню ставок игроку
if(newmenu == bet_menu)
{
// обновляем меню
if(floatround(bet_left) > 0)
{
Bet_MenuFormat(player)
menu_display(player,bet_menu)
}
// закрываем меню по истечению времени
else
{
menu_cancel(player)
show_menu(player,0,"^n")
}
}
}
// сбрасываем такс
if(bet_left <= 0.0)
{
remove_task(taskid_updatemenu)
}
}
//
// Показываем меню ставок
//
public Bet_ShowMenu(id)
{
// hax
if(id == t_id || id == ct_id)
{
return PLUGIN_HANDLED
}
// не показываем меню игрокам в спектаторах
if(!(CS_TEAM_T <= cs_get_user_team(id) <= CS_TEAM_CT) || get_pdata_int(id,m_iJoinedState))
{
return PLUGIN_HANDLED
}
// меню можно вызвать только 1x1
if(!t_id || !ct_id)
{
client_print_color(id,print_team_red,"%L %L",
id,"SF_BET9",
id,"SF_BET10"
)
return PLUGIN_CONTINUE
}
if(players_data[id][BET_FOR])
{
client_print_color(id,print_team_red,"%L %L",
id,"SF_BET9",
id,"SF_BET18"
)
return PLUGIN_CONTINUE
}
// меню можно вызвать только живым
if(is_user_alive(id))
{
client_print_color(id,print_team_red,"%L %L",
id,"SF_BET9",
id,"SF_BET11"
)
return PLUGIN_CONTINUE
}
new Float:bet_left = bet_time - get_gametime()
if(bet_left <= 0.0)
{
client_print_color(id,print_team_red,"%L %L",
id,"SF_BET9",
id,"SF_BET17"
)
return PLUGIN_CONTINUE
}
Bet_MenuFormat(id)
menu_display(id,bet_menu)
return PLUGIN_CONTINUE
}
//
// Обработка действий в меню
//
public Bet_MenuHandler(id,menu,r_item)
{
if(r_item == MENU_EXIT)
{
return PLUGIN_HANDLED
}
new ri[2],di[2]
menu_item_getinfo(menu,r_item,di[0],ri,charsmax(ri),di,charsmax(di),di[0])
new item = str_to_num(ri)
switch(item)
{
// делаем ставки
case 0,1:
{
// ставим деньги
if(players_data[id][BET_MONEY])
{
new user_money = cs_get_user_money(id)
// игроку не хватает денег
if(user_money < players_data[id][BET_MONEY])
{
Bet_MenuFormat(id)
menu_display(id,menu)
return PLUGIN_HANDLED
}
}
#if defined AES
new rt[AES_ST_END]
aes_get_player_stats(id,rt)
// ставим опыт
if(players_data[id][BET_EXP])
{
if(rt[AES_ST_EXP] < players_data[id][BET_EXP])
{
Bet_MenuFormat(id)
menu_display(id,menu)
return PLUGIN_HANDLED
}
}
if(players_data[id][BET_BONUS])
{
if(rt[AES_ST_BONUSES] < players_data[id][BET_BONUS])
{
Bet_MenuFormat(id)
menu_display(id,menu)
return PLUGIN_HANDLED
}
}
#endif
#if defined ACP
if(players_data[id][BET_POINTS])
{
if(acp_get_player_points(id) < players_data[id][BET_POINTS])
{
Bet_MenuFormat(id)
menu_display(id,menu)
return PLUGIN_HANDLED
}
}
#endif
// запоминаем на кого поставили
players_data[id][BET_FOR] = item == 0 ? t_id : ct_id
if(!players_data[id][BET_FOR])
{
return PLUGIN_HANDLED
}
// сообщение в чат
new plr_name[MAX_NAME_LENGTH],bet_name[MAX_NAME_LENGTH]
get_user_name(id,plr_name,charsmax(plr_name))
get_user_name(players_data[id][BET_FOR],bet_name,charsmax(bet_name))
// сообщение всем мертвым игрокам
new players[MAX_PLAYERS],pnum
get_players(players,pnum,"bch")
for(new i,player ; i < pnum ; i++)
{
player = players[i]
if(player == id)
{
client_print_color(player,
print_team_default,
"%L %L",
player,"SF_BET9",
player,"SF_BET27",
bet_name
)
}
else
{
client_print_color(player,
(cs_get_user_team(player) == CS_TEAM_CT ? print_team_blue : print_team_red), // красим ник в цвет команды
"%L %L",
player,"SF_BET9",
player,"SF_BET28",
plr_name,bet_name
)
}
}
}
// переключатели стаовк
case 2,3,4,5:
{
new cp = lyl_array[item - 2][0]
new sp = lyl_array[item - 2][1]
new bet_str[128],bet_val[10],bool:set
get_pcvar_string(cvar[cp],bet_str,charsmax(bet_str))
while(argbreak(bet_str,
bet_val,charsmax(bet_val),
bet_str,charsmax(bet_str)) != -1
)
{
if(!bet_val[0])
break
bet_val[0] = str_to_num(bet_val)
// переключаем на большее значение
if(bet_val[0] > players_data[id][sp])
{
set = true
players_data[id][sp] = bet_val[0]
break
}
}
// сбрасываем переключатель
if(bet_val[0] <= players_data[id][sp] && !set)
{
players_data[id][sp] = 0
}
switch(item)
{
case 2:
{
if(cs_get_user_money(id) < players_data[id][sp])
{
players_data[id][sp] = 0
}
}
#if defined AES
case 3,4:
{
new rt[AES_ST_END]
aes_get_player_stats(id,rt)
if(
(item == 3 && rt[AES_ST_EXP] < players_data[id][sp])
||
(item == 4 && rt[AES_ST_BONUSES] < players_data[id][sp])
)
{
players_data[id][sp] = 0
}
}
#endif
#if defined ACP
case 5:
{
if(acp_get_player_points(id) < players_data[id][sp])
{
players_data[id][sp] = 0
}
}
#endif
}
Bet_MenuFormat(id)
menu_display(id,menu)
}
}
return PLUGIN_HANDLED
}
//
// Настраиваем отображение меню
//
public Bet_MenuFormat(id)
{
new fmt[512],len
// --- ЗАГОЛОВОК --- //
len += formatex(fmt[len],charsmax(fmt) - len,"%L^n%L^n%L",
id,"SF_BET1",
id,"SF_BET2",bet_time - get_gametime(),
id,"SF_BET3",Bet_Menu_GetBetString(id)
)
menu_setprop(bet_menu,MPROP_TITLE,fmt)
// --- ВЫХОД --- //
formatex(fmt,charsmax(fmt),"%L",id,"EXIT")
menu_setprop(bet_menu,MPROP_EXITNAME,fmt)
}
//
// Настраиваем кнопки в меню
//
public Bet_MenuCallback(id, menu, r_item)
{
new fmt[256],len
new ri[2],di[2]
menu_item_getinfo(menu,r_item,di[0],ri,charsmax(ri),di,charsmax(di),di[0])
new item = str_to_num(ri)
if(item == 0)
{
Bet_MenuFormat(id)
}
switch(item)
{
// ставки на T или CT
case 0,1:
{
new ct_name[MAX_NAME_LENGTH],bet_id = (item == 0 ? t_id : ct_id)
new rt = ITEM_DISABLED
get_user_name(bet_id,ct_name,charsmax(ct_name))
len = formatex(fmt[len],charsmax(fmt) - len,"%L",
id,"SF_BET6",
ct_name,
item == 0 ? "T" : "CT"
)
if(players_data[id][BET_MONEY])
{
rt = ITEM_ENABLED
}
new prize = Bet_GetWinPool(id,BET_MONEY,bet_id)
new prize_str[128],prize_len
if(prize)
{
prize_len += formatex(prize_str[prize_len],charsmax(prize_str) - prize_len,"%L",
id,"SF_BET5",
prize
)
}
#if defined AES
prize = Bet_GetWinPool(id,BET_EXP,bet_id)
if(prize)
{
prize_len += formatex(prize_str[prize_len],charsmax(prize_str) - prize_len,"%s%L",
prize_len ? ", " : "",
id,"SF_BET4",
prize
)
}
prize = Bet_GetWinPool(id,BET_BONUS,bet_id)
if(prize)
{
prize_len += formatex(prize_str[prize_len],charsmax(prize_str) - prize_len,"%s%L",
prize_len ? ", " : "",
id,"SF_BET20",
prize
)
}
if(players_data[id][BET_EXP] || players_data[id][BET_EXP])
{
rt = ITEM_ENABLED
}
#endif
#if defined ACP
prize = Bet_GetWinPool(id,BET_POINTS,bet_id)
if(prize)
{
prize_len += formatex(prize_str[prize_len],charsmax(prize_str) - prize_len,"%s%L",
prize_len ? ", " : "",
id,"SF_BET24",
prize
)
}
if(players_data[id][BET_POINTS])
{
rt = ITEM_ENABLED
}
#endif
if(prize_str[0])
{
len += formatex(fmt[len],charsmax(fmt) - len," %L",
id,"SF_BET16",
prize_str
)
}
if(item == 1)
{
len += formatex(fmt[len],charsmax(fmt) - len,"^n")
}
menu_item_setname(menu,r_item,fmt)
return rt
}
// переключатели
case 2,3,4,5:
{
new cp = lyl_array[item - 2][0]
new sp = lyl_array[item - 2][1]
switch(item)
{
case 2: len = formatex(fmt[len],charsmax(fmt) - len,"%L",id,"SF_BET7")
#if defined AES
case 3: len = formatex(fmt[len],charsmax(fmt) - len,"%L",id,"SF_BET8")
case 4: len = formatex(fmt[len],charsmax(fmt) - len,"%L",id,"SF_BET19")
#endif
#if defined ACP
case 5:
{
len = formatex(fmt[len],charsmax(fmt) - len,"%L %L",id,"SF_BET23",id,"SF_BET26",acp_get_player_points(id))
// игрок не зарегистрирован, выкл. этот пункт
if(acp_get_player_auth(id) == 0)
{
menu_item_setname(bet_menu,r_item,fmt)
return ITEM_DISABLED
}
}
#endif
}
new bet_str[128],bet_val[10]
get_pcvar_string(cvar[cp],bet_str,charsmax(bet_str))
if(!bet_str[0])
{
menu_item_setname(bet_menu,r_item,fmt)
return ITEM_DISABLED
}
while(argbreak(bet_str,
bet_val,charsmax(bet_val),
bet_str,charsmax(bet_str)) != -1
)
{
if(!bet_val[0])
break
bet_val[0] = str_to_num(bet_val)
if(bet_val[0] != players_data[id][sp])
{
len += formatex(fmt[len],charsmax(fmt) - len," \d[%d]",bet_val[0])
}
else
{
len += formatex(fmt[len],charsmax(fmt) - len," \r[\y%d\r]",bet_val[0])
}
}
menu_item_setname(bet_menu,r_item,fmt)
}
}
return ITEM_ENABLED
}
//
// лул
//
Bet_Menu_GetBetString(id)
{
new fmt[512],len
if(players_data[id][BET_MONEY])
{
len += formatex(fmt[len],charsmax(fmt) - len,"%L",id,"SF_BET5",
players_data[id][BET_MONEY]
)
}
#if defined AES
if(players_data[id][BET_EXP])
{
len += formatex(fmt[len],charsmax(fmt) - len,"%s%L",fmt[0] ? ", " : "",id,"SF_BET4",
players_data[id][BET_EXP]
)
}
if(players_data[id][BET_BONUS])
{
len += formatex(fmt[len],charsmax(fmt) - len,"%s%L",fmt[0] ? ", " : "",id,"SF_BET20",
players_data[id][BET_BONUS]
)
}
#endif
#if defined ACP
if(players_data[id][BET_POINTS])
{
len += formatex(fmt[len],charsmax(fmt) - len,"%s%L",fmt[0] ? ", " : "",id,"SF_BET24",
players_data[id][BET_POINTS]
)
}
#endif
if(!fmt[0])
{
copy(fmt,charsmax(fmt),"\d-\w")
}
return fmt
}
//
// Узнаем выигрыш ставки
//
Bet_GetWinPool(id,pool,practicant)
{
new win_bet
switch(get_pcvar_num(cvar[CVAR_BET_MODE]))
{
case 0:
{
new players[MAX_PLAYERS],pnum
get_players(players,pnum,"ch")
new bet_pool
new win_pool
for(new i,player ; i <pnum ; i++)
{
player = players[i]
if(players_data[player][BET_FOR] == 0 && player != id)
{
continue
}
if(players_data[player][BET_FOR] == practicant || !players_data[player][BET_FOR])
bet_pool += players_data[player][pool]
else
win_pool += players_data[player][pool]
}
if(!bet_pool)
return 0
// процент ставки игрока от общей суммы
new Float:bet_perc = float(players_data[id][pool]) * 100.0 / float(bet_pool)
win_bet = (win_pool * floatround(bet_perc) / 100)
}
case 1:
{
win_bet = (players_data[id][pool])
}
}
win_bet = floatround(win_bet * get_pcvar_float(cvar[CVAR_BET_MULTIPLER]))
return win_bet
}
//
// Функция проверки 1x1
//
Bet_Check1x1()
{
if(t_id && ct_id)
return false
new players[MAX_PLAYERS],tnum,ctnum
// живые игрока из T
get_players(players,tnum,"aeh","TERRORIST")
if(tnum == 1)
{
// запоминаем ID посл. живого T
t_id = players[0]
}
else
{
t_id = 0
return false
}
// живые игроки за CT
get_players(players,ctnum,"aeh","CT")
if(ctnum == 1)
{
// запоминаем ID посл. живого CT
ct_id = players[0]
}
else
{
ct_id = 0
return false
}
// это 1x1
return true
}
Помогите пожалуйста.