public Action:Command_Bet(client, args)
{
if (client && IsClientInGame(client))
{
if (g_bBettingDead)
{
if (IsPlayerAlive(client))
{
ReplyToCommand(client, "[Shop|Bet] Вы должны быть мертвы чтобы делать ставки.");
return Plugin_Handled;
}
}
if (GetClientCount() < g_iBettingMinPl)
{
ReplyToCommand(client, "[Shop|Bet] Недостаточно игроков, нужно %d", g_iBettingMinPl);
return Plugin_Handled;
}
else if (g_iBettingPeriod && g_iBettingStart+g_iBettingPeriod < GetTime())
{
ReplyToCommand(client, "[Shop|Bet] Период ставок истёк");
return Plugin_Handled;
}
else if (Flood(client)) return Plugin_Handled;
else if (args < 2)
{
ReplyToCommand(client, "[Shop|Bet] sm_bet <t/ct> <bet/all/cancel>");
return Plugin_Handled;
}
/* else if (g_iPlayerPot[client])
{
ReplyToCommand(client, "[Shop|Bet] Вы уже сделали ставку (%d кр.)", g_iPlayerPot[client]);
return Plugin_Handled;
} */
decl String:sTeam[4], String:sAmount[8];
GetCmdArg(1, sTeam, sizeof(sTeam));
GetCmdArg(2, sAmount, sizeof(sAmount));
if (StrEqual(sTeam, "t", true))
g_iPlayerTeam[client] = CS_TEAM_T;
else if (StrEqual(sTeam, "ct", true))
g_iPlayerTeam[client] = CS_TEAM_CT;
else
{
ReplyToCommand(client, "[Shop] Неверная команда");
return Plugin_Handled;
}
new hascredits = Shop_GetClientCredits(client);
new credits = StringToInt(sAmount);
if (StrEqual(sAmount, "all", true))
{
g_iPlayerPot[client] = hascredits;
PrintToChatAll("[\x03Shop|Bet\x01] \x04%N \x01поставил все свои кредиты (%d кр) на команду \x04%s", client, hascredits, sTeam);
PrintToChat(client, "[\x03Shop|Bet\x01] Ваша ставка составляет %d кр.", g_iPlayerPot[client]);
PrintToChat(client, "[\x03Shop|Bet\x01] В случае успеха ваш выйгрыш составит \x03%d \x01кр.", RoundToCeil(g_iPlayerPot[client] * g_fMultiplier));
Shop_SetClientCredits(client, 0);
return Plugin_Handled;
}
else if (StrEqual(sAmount, "cancel", true))
{
Shop_GiveClientCredits(client, g_iPlayerPot[client]);
g_iPlayerPot[client] = 0;
g_iPlayerTeam[client] = CS_TEAM_NONE;
ReplyToCommand(client, "[Shop|Bet] Вы отменили свою ставку");
return Plugin_Handled;
}
else if (credits < 0)
{
PrintToChat(client, "[\x03Shop|Bet\x01] Неверное количество кредитов.");
return Plugin_Handled;
}
else if (credits < hascredits)
{
g_iPlayerPot[client] += credits;
PrintToChatAll("[\x03Shop|Bet\x01] \x04%N \x01 поставил \x04%d кр. \x01на команду \x04%s", client, credits, sTeam);
PrintToChat(client, "[\x03Shop|Bet\x01] Ваша ставка составляет %d кр.", g_iPlayerPot[client]);
PrintToChat(client, "[\x03Shop|Bet\x01] В случае успеха ваш выйгрыш составит \x03%d \x01кр.", RoundToCeil(g_iPlayerPot[client] * g_fMultiplier));
Shop_TakeClientCredits(client, credits);
return Plugin_Handled;
}
else
{
ReplyToCommand(client, "[Shop|Bet] У вас недостаточно кредитов")
}
}
return Plugin_Handled;
}