Участник
Пользователь
- Сообщения
- 103
- Реакции
- 5
- Помог
- 2 раз(а)
- Ошибка
-
Внизу скрин
- Компилятор
- Локальный
- Amx Mod X
- 1.9.0
- Исходный код
-
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <colorchat>
#include <fun>
#define MAX_PLAYERS 32
#define VERSION "1.6"
#if AMXX_VERSION_NUM < 183
#define FIX_MENU
#include <fakemeta>
const m_iMenu = 205;
#endif
const PRIMARY_WEAPONS_BIT_SUM =
(1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<
CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90)
const SECONDARY_WEAPONS_BIT_SUM = (1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE)
const KEYSMENU = MENU_KEY_4|MENU_KEY_6
//АК47,М16,AWP,Deagle,Scout,Пулемет, GALIL, Армор + все гранаты.
enum _:WEAPON_DATA_SIZE
{
sz_DataName[32],
sz_DataItem[24],
i_Index,
i_DataAmmo
}
new g_szWeaponData[][WEAPON_DATA_SIZE] =
{
{ "AK47", "weapon_ak47", CSW_AK47, 90 }, //1
{ "M4A1", "weapon_m4a1", CSW_M4A1, 90 }, //2
{ "AWP", "weapon_awp", CSW_AWP, 30 }, //3
{ "SCOUT", "weapon_scout", CSW_SCOUT, 90 },
{ "M249", "weapon_m249", CSW_M249, 200 },//5
{ "GALIL", "weapon_galil", CSW_GALIL, 90 },
{ "DEAGLE", "weapon_deagle", CSW_DEAGLE, 35 }
}
new g_iBestPlayer;
new g_iRoundCounter;
new szRandomPrice;
new g_szBestPlayerName[32];
new g_iDamage[MAX_PLAYERS + 1];
new g_pCvarRoundAccess;
new g_pCvarMinPlayers;
const RESET = 0
public plugin_init()
{
register_plugin( "BEST PLAYER PRIVATE", VERSION, "DUKKHAZ0R" );
register_cvar( "nice_player_bonus", VERSION, FCVAR_SERVER | FCVAR_SPONLY );
register_logevent( "Event_Restart_Round", 2, "0=World triggered", "1&Restart_Round_", "1=Game_Commencing" );
register_logevent( "Event_New_Round", 2, "1=Round_Start" );
register_logevent( "Event_End_Round", 2, "1=Round_End" );
register_event( "Damage", "Event_Take_Damage", "b", "2!0", "3=0", "4!0" );
RegisterHam( Ham_Spawn, "player", "fw_HamSpawn_Post", .Post = 1 );
register_menucmd( register_menuid("price_menu"), KEYSMENU, "menu_handler" );
g_pCvarRoundAccess = register_cvar( "bp_round_access", "3" );
g_pCvarMinPlayers = register_cvar( "bp_minplayers", "5" );
}
public plugin_cfg()
{
new szMapPrefix[][] = { "35hp_", "1hp_", "awp_", "deathrun_" };
new szMapName[32]; get_mapname( szMapName, charsmax(szMapName) );
for( new i; i < sizeof( szMapPrefix ); i++ )
{
if( containi( szMapName, szMapPrefix[i] ) != -1 )
{
pause( "ad" );
break;
}
}
}
public client_disconnect(id)
{
g_iDamage[id] = 0;
}
public client_connect(id)
{
g_iDamage[id] = 0;
}
public Event_Take_Damage(id)
{
static pAttacker; pAttacker = get_user_attacker(id);
if( is_user_connected(pAttacker) && cs_get_user_team(pAttacker) != cs_get_user_team(id) && pAttacker != id )
g_iDamage[pAttacker] += read_data(2);
}
public Event_New_Round()
{
g_iRoundCounter++;
Reset();
}
public Event_Restart_Round()
{
g_iRoundCounter = RESET;
}
public Event_End_Round()
{
if( g_iRoundCounter < get_pcvar_num( g_pCvarRoundAccess ) || get_playersnum() < get_pcvar_num( g_pCvarMinPlayers ) )
return;
new players[32], pnum, id, iDamage, iBestPlayerDamage;
get_players( players, pnum, "ch" );
for( new i; i < pnum; i++ )
{
id = players[i];
iDamage = g_iDamage[id];
if( !iDamage || iDamage < iBestPlayerDamage )
continue;
if( iDamage > iBestPlayerDamage )
{
g_iBestPlayer = id;
iBestPlayerDamage = iDamage;
}
}
if( g_iBestPlayer )
{
get_user_name( g_iBestPlayer, g_szBestPlayerName, charsmax(g_szBestPlayerName) );
ColorChat( 0, GREEN, "^1[^4Бонус^1] Отлично! Лучший результат за ахуенный раунд: <<^4%s^1>> [ ^3%d урона ^1]", g_szBestPlayerName, g_iDamage[g_iBestPlayer] );
}
}
public fw_HamSpawn_Post(id)
{
if( !is_user_alive(id) || id != g_iBestPlayer )
return;
ShowMenu(id)
}
ShowMenu(id)
{
Reset();
static szMenu[512], iLen;
szRandomPrice = random_num( 0, 7 );
switch( szRandomPrice )
{
case 7: iLen = formatex( szMenu, charsmax(szMenu), "\wВаш приз: \rАрмор + все гранаты^n\dВзять свой приз?^n^n" );
default: iLen = formatex( szMenu, charsmax(szMenu), "\wВаш приз: \r%s^n\dВзять свой приз?^n^n", g_szWeaponData[szRandomPrice][sz_DataName] );
}
iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\r4.\wВзять подачку^n" );
iLen += formatex( szMenu[iLen], charsmax(szMenu) - iLen, "\r6.\wОтказаться от подачки^n" );
#if defined FIX_MENU
set_pdata_int(id, m_iMenu, 0 );
#endif
show_menu( id, KEYSMENU, szMenu, -1, "price_menu" );
return PLUGIN_HANDLED;
}
public menu_handler(id, iKey)
{
switch(iKey)
{
case 3:
{
switch( szRandomPrice )
{
case 7:
{
ColorChat( 0, TEAM_COLOR, "^1[^4Бонус^1] Поздравляем! <<^3%s^1>>, выиграл ^4армор + все гранаты^1 за лучший результ", g_szBestPlayerName )
equipment(id)
return
}
case 6: drop_weapons( id, 2 );
default: drop_weapons( id, 1 );
}
give_item( id, g_szWeaponData[szRandomPrice][sz_DataItem] );
cs_set_user_bpammo( id, g_szWeaponData[szRandomPrice][i_Index], g_szWeaponData[szRandomPrice][i_DataAmmo] );
ColorChat( 0, GREEN, "^1[^4Бонус^1] Поздравляем! <<^4%s^1>>, выиграл ^4%s^1 за лучший результ", g_szBestPlayerName, g_szWeaponData[szRandomPrice][sz_DataName] );
}
case 5:
{
ColorChat( 0, GREEN, "^1[^4Бонус^1] Странно, что ^4%s^1 отказался от приза", g_szBestPlayerName );
}
}
g_iBestPlayer = RESET;
}
public equipment(id)
{
give_item( id, "weapon_hegrenade" )
give_item( id, "weapon_flashbang" )
give_item( id, "weapon_flashbang" )
give_item( id, "weapon_smokegrenade" )
cs_set_user_armor( id, 100, CS_ARMOR_VESTHELM )
}
Reset()
{
arrayset( g_iDamage, RESET, MAX_PLAYERS + 1 );
}
stock drop_weapons(id, dropwhat)
{
static weapons[32], num, i, weaponid
num = 0
get_user_weapons(id, weapons, num)
for (i = 0; i < num; i++)
{
weaponid = weapons[i]
if ((dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)) || (dropwhat == 2 && ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM)))
{
static wname[32]
get_weaponname(weaponid, wname, sizeof wname - 1)
engclient_cmd(id, "drop", wname)
}
}
}
Не получается скомпилировать.
В этой теме было размещено решение! Перейти к решению.
Вложения
-
10.9 KB Просмотры: 496