поправить Random weapon warmup

IIuToH

Пользователь
Регистрация
5 Авг 2018
Сообщения
131
Симпатии
0
OS
Linux
Amx Mod X
AMXX 1.9.0
Билд
rehlds
ReGamedll
5.14.0.456-dev
Metamod
v1.21p37
Meta модули
Код:
[ 1] SafeNameAndChat RUN - safenameandchat. v1.1 ini ANY ANY
[ 2] Reunion RUN - reunion_mm.dll v0.1.0.9 ini Start Never
[ 3] ReAuthCheck RUN - reauthcheck_mm.d v0.1.6 ini Start Never
[ 4] VoiceTranscoder RUN - voicetranscoder. v2017RC5 ini ANY ANY
[ 5] AMX Mod X RUN - amxmodx_mm.so v1.9.0.5 ini Start ANY
[ 6] Rechecker RUN - rechecker_mm.so v2.5 ini Chlvl ANY
[ 7] WHBlocker RUN - whblocker_mm.so v1.5.696 ini Chlvl ANY
[ 8] ReSemiclip RUN - resemiclip_mm.so v2.3.9 ini Chlvl ANY
[ 9] POD-Bot mm RUN - podbot_mm.so v3.0B18c ini Chlvl ANY
[10] Ham Sandwich RUN - hamsandwich_amxx v1.9.0.5 pl5 ANY ANY
[11] CSX RUN - csx_amxx.so v1.9.0.5 pl5 ANY ANY
[12] ReAPI RUN - reapi_amxx.so v5.12.0. pl5 ANY Never
[13] Fun RUN - fun_amxx.so v1.9.0.5 pl5 ANY ANY
[14] FakeMeta RUN - fakemeta_amxx.so v1.9.0.5 pl5 ANY ANY
[15] GeoIP RUN - geoip_amxx.so v1.9.0.5 pl5 ANY ANY
[16] Engine RUN - engine_amxx.so v1.9.0.5 pl5 ANY ANY
Плагины
Код:
[ 1] Admin Base 1.9.0.5263 AMXX Dev Team admin.amxx running
[ 2] Admin Commands 1.9.0.5263 AMXX Dev Team admincmd.amxx running
[ 3] Admin Help 1.9.0.5263 AMXX Dev Team adminhelp.amxx running
[ 4] Slots Reservation 1.9.0.5263 AMXX Dev Team adminslots.amxx running
[ 5] Multi-Lingual System 1.9.0.5263 AMXX Dev Team multilingual.am running
[ 6] Commands Menu 1.9.0.5263 AMXX Dev Team cmdmenu.amxx running
[ 7] Players Menu 1.9.0.5263 AMXX Dev Team plmenu.amxx running
[ 8] Maps Menu 1.9.0.5263 AMXX Dev Team mapsmenu.amxx running
[ 9] Admin Chat 1.9.0.5263 AMXX Dev Team adminchat.amxx running
[ 10] Anti Flood 1.9.0.5263 AMXX Dev Team antiflood.amxx running
[ 11] Scrolling Message 1.9.0.5263 AMXX Dev Team scrollmsg.amxx running
[ 12] Info. Messages 1.9.0.5263 AMXX Dev Team imessage.amxx running
[ 13] Admin Votes 1.9.0.5263 AMXX Dev Team adminvote.amxx running
[ 14] NextMap 1.9.0.5263 AMXX Dev Team nextmap.amxx running
[ 15] Nextmap Chooser 1.9.0.5263 AMXX Dev Team mapchooser.amxx running
[ 16] TimeLeft 1.9.0.5263 AMXX Dev Team timeleft.amxx running
[ 17] Pause Plugins 1.9.0.5263 AMXX Dev Team pausecfg.amxx running
[ 18] Stats Configuration 1.9.0.5263 AMXX Dev Team statscfg.amxx running
[ 19] StatsX 1.9.0.5263 AMXX Dev Team statsx.amxx running
[ 20] AFK Control 1.4.1 [Rnd neygomon afk_control.amx running
[ 21] Server AMXMODMENU [INI 1.0 Leo_[BH] amxmodmenu.amxx running
[ 22] [ReAPI] AWPoff 1.4.2 PAffAEJIkA :3 awp_off_t.amxx running
[ 23] [ReAPI] Random Weapons 2.4.9 neugomon/h1k3 random_weapons_ running
Amxx Модули
Код:
Ham Sandwich 1.9.0.5263 AMX Mod X Dev Team running
CSX 1.9.0.5263 AMX Mod X Dev Team running
ReAPI 5.12.0.192 Asmodai & s1lent running
Fun 1.9.0.5263 AMX Mod X Dev Team running
FakeMeta 1.9.0.5263 AMX Mod X Dev Team running
GeoIP 1.9.0.5263 AMX Mod X Dev Team running
Engine 1.9.0.5263 AMX Mod X Dev Team running
Ошибка
Код:
"Разминка на !"
Исходник
Код:
Код:
#include <amxmodx>

#include <reapi>



/*■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■*/

#define TIME_RR     60    // Время разминки

#define NUM_RR        1    // Кол-во рестартов

#define LATENCY        1.5    // Задержка между рестартами

#define DM_MODE        1    // Возрождение после смерти; 0 - отключить (будет длится раунд или до победы)

#define PROTECTED     2    // Сколько секунд действует защита после возрождения (актуально для DM_MODE); 0 - отключить



//#define SOUND            // Музыка под час разминки

//#define STOP_PLUGS        // Отключать плагины на время разминки

//#define OFF_RR            // Отключать этот плагин на указанных картах

//#define REMOVE_MAP_WPN    // Удалять ентити мешающие разминке на картах типа: awp_, 35hp_ и т.п. [по умолчанию выкл.]

//#define BLOCK           // Запрет поднятия оружия с земли (не актуально при вкл. #define REMOVE_MAP_WPN) [по умолчанию выкл.]

//#define STOP_STATS        // Отключать запись статистики на время разминки  CSStatsX SQL by serfreeman1337 0.7.4+1 [по умолчанию выкл.]

/*■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■*/



#if defined REMOVE_MAP_WPN

#include <hamsandwich>

#endif



#if defined SOUND

new const soundRR[][] =    // Указывать звук, например 1.mp3

{   

    "sound/rww/RoundStart.mp3",

//    "sound/rww/2.mp3",

//    "sound/rww/3.mp3"

}

#endif



#if defined STOP_PLUGS

new g_arPlugins[][] = // Указывать название плагинов для отключения, например test.amxx

{       

    "test.amxx",

    "test2.amxx"

}

#endif



#if DM_MODE == 0

new HookChain:fwd_RRound;

new g_iRound;

#endif



#if defined REMOVE_MAP_WPN

new HamHook:fwd_Equip,

    HamHook:fwd_WpnStrip,

    HamHook:fwd_Entity;

#endif



#if defined STOP_STATS

new g_iHudSync;

#endif

new g_szWeapon[32];

new g_iImmunuty, g_iRespawn, g_iWp, g_iHudSync2;

new HookChain:fwd_NewRound,

    #if defined BLOCK

    HookChain:fwd_BlockEntity,

    #endif

    HookChain:fwd_Spawn,

    HookChain:fwd_GiveC4;



const TASK_TIMER_ID = 33264;



public plugin_init()

{

    register_plugin("[ReAPI] Random Weapons WarmUP", "2.4.9", "neugomon/h1k3");



    RegisterHookChain(RG_RoundEnd, "fwdRoundEnd", true);

    DisableHookChain(fwd_NewRound = RegisterHookChain(RG_CSGameRules_CheckMapConditions, "fwdRoundStart", true));

    DisableHookChain(fwd_Spawn = RegisterHookChain(RG_CBasePlayer_Spawn, "fwdPlayerSpawnPost", true));

    DisableHookChain(fwd_GiveC4 = RegisterHookChain(RG_CSGameRules_GiveC4, "fwdGiveC4", false));



    #if defined REMOVE_MAP_WPN

    DisableHamForward(fwd_Equip = RegisterHam(Ham_Use, "game_player_equip", "CGamePlayerEquip_Use", false));

    DisableHamForward(fwd_WpnStrip = RegisterHam(Ham_Use, "player_weaponstrip", "CStripWeapons_Use", false));

    DisableHamForward(fwd_Entity = RegisterHam(Ham_CS_Restart, "armoury_entity", "CArmoury_Restart", false));

    #endif



    #if DM_MODE == 0

    EnableHookChain(fwd_RRound = RegisterHookChain(RG_CSGameRules_RestartRound, "fwdRestartRound_Pre"));

    #endif



    #if defined BLOCK

    DisableHookChain(fwd_BlockEntity = RegisterHookChain(RG_CBasePlayer_HasRestrictItem, "fwdHasRestrictItemPre", false));

    register_clcmd("drop", "ClCmd_Drop");

    #endif



    g_iImmunuty = get_cvar_pointer("mp_respawn_immunitytime");

    g_iRespawn  = get_cvar_pointer("mp_forcerespawn");

    #if defined STOP_STATS

    g_iHudSync = CreateHudSyncObj();

    #endif

    g_iHudSync2 = CreateHudSyncObj();



    state warmupOff;



    #if defined OFF_RR

    new sPref[][] = { "awp_", "aim_", "fy_", "$", "cs_", "35hp" };    // Указывать префиксы карт на которых плагин не будет работать

    new map[32]; get_mapname(map, charsmax(map));

    for(new i; i < sizeof sPref; i++)

    {

        if(containi(map, sPref[i]) != -1)

        {

            pause("ad");

            return;

        }

    }   

    #endif

}



public plugin_end() <warmupOff> {}



public plugin_end() <warmupOn>

{

    finishWurmUp();

}



#if defined BLOCK

public fwdHasRestrictItemPre()

{

    SetHookChainReturn(ATYPE_INTEGER, true);

    return HC_SUPERCEDE;

}



public ClCmd_Drop() <warmupOff>

    return PLUGIN_CONTINUE;

    

public ClCmd_Drop() <warmupOn>

    return PLUGIN_HANDLED;

#endif





#if defined SOUND

public plugin_precache()

{

    for(new i = 0; i < sizeof(soundRR); i++)

    {

        precache_generic(soundRR[i]);

    }

}

#endif



public fwdRoundEnd(WinStatus:status, ScenarioEventEndRound:event, Float:tmDelay)

    if(event == ROUND_GAME_COMMENCE)

        EnableHookChain(fwd_NewRound);



public fwdRoundStart()

{

    state warmupOn;



    #if defined REMOVE_MAP_WPN

    EnableHamForward(fwd_Equip);

    EnableHamForward(fwd_WpnStrip);

    EnableHamForward(fwd_Entity);

    #endif



    DisableHookChain(fwd_NewRound);

    EnableHookChain(fwd_Spawn);

    EnableHookChain(fwd_GiveC4);



    set_pcvar_num(g_iRespawn, DM_MODE);

    set_pcvar_num(g_iImmunuty, PROTECTED);



    #if DM_MODE >= 1

    set_cvar_string("mp_round_infinite", "1");

    set_task(1.0, "Show_Timer", .flags = "a", .repeat = TIME_RR);

    #endif



    #if DM_MODE == 0

    set_task(1.0, "Hud_Message", .flags = "a", .repeat = 25 );

    #endif



    #if defined SOUND

    static cmd[64];

    formatex(cmd, 63, "mp3 play ^"%s^"", soundRR[random(sizeof(soundRR))]);

    client_cmd(0, "%s", cmd);

    #endif



    #if defined STOP_STATS

    set_cvar_num("csstats_pause", 1);

    #endif



    #if defined BLOCK

    EnableHookChain(fwd_BlockEntity);

    #endif



    #if defined STOP_PLUGS   

    PluginController(1);

    #endif



    switch(g_iWp = random(8))

    {

        case 0: formatex(g_szWeapon, charsmax(g_szWeapon), "SCOUT");

        case 1: formatex(g_szWeapon, charsmax(g_szWeapon), "M3");

        case 2: formatex(g_szWeapon, charsmax(g_szWeapon), "hegrenade");

        case 3: formatex(g_szWeapon, charsmax(g_szWeapon), "AWP");

    }

}



public fwdPlayerSpawnPost(const id)

{

    if(!is_user_alive(id))

        return;



    #if defined REMOVE_MAP_WPN

    InvisibilityArmourys();

    #endif



    BuyZone_ToogleSolid(SOLID_NOT);

    rg_remove_all_items(id);

    set_member_game(m_bMapHasBuyZone, true);

    rg_give_item(id, "weapon_knife");



    switch(g_iWp)

    {

        case 0:

        {

            rg_give_item(id, "weapon_scout");

            rg_set_user_bpammo(id, WEAPON_SCOUT, 90);

        }

        case 1:

        {

            rg_give_item(id, "weapon_m3");

            rg_set_user_bpammo(id, WEAPON_M3, 90);

        }

        case 2:

        {

            rg_give_item(id, "weapon_hegrenade");

            rg_set_user_bpammo(id, WEAPON_HEGRENADE, 120);

        }

        case 3:

        {

            rg_give_item(id, "weapon_awp");

            rg_set_user_bpammo(id, WEAPON_AWP, 90);

        }       

    }   

}



public fwdGiveC4()

{

    return HC_SUPERCEDE;

}



#if DM_MODE >= 1

public Show_Timer()

{   

    static timer = -1;

    if(timer == -1) timer = TIME_RR;



    switch(--timer)

    {

        case 0:

        {

            finishWurmUp();

            timer = -1;

        }

        default:

        {

            #if defined STOP_STATS

            set_hudmessage(255, 0, 0, .x = -1.0, .y = 0.05, .holdtime = 0.9, .channel = -1);

            ShowSyncHudMsg(0, g_iHudSync, "[Статистика Отключена]");

            #endif

            set_hudmessage(135, 206, 235, .x = -1.0, .y = 0.08, .holdtime = 0.9, .channel = -1);

            ShowSyncHudMsg(0, g_iHudSync2, "Разминка на %s!^nРестарт через %d сек", g_szWeapon, timer);

        }

    }

}

#endif



#if DM_MODE == 0

public fwdRestartRound_Pre()

{

    g_iRound++;



    if(g_iRound >= 2) {

        DisableHookChain(fwd_RRound);

        finishWurmUp();

    }

}



public Hud_Message()

{

    #if defined STOP_STATS

    set_hudmessage(255, 0, 0, .x = -1.0, .y = 0.05, .holdtime = 0.9, .channel = -1);

    ShowSyncHudMsg(0, g_iHudSync, "[Статистика Отключена]");

    #endif

    set_hudmessage(135, 206, 235, .x = -1.0, .y = 0.08, .holdtime = 0.9, .channel = -1);

    ShowSyncHudMsg(0, g_iHudSync2, "Разминка на %s!", g_szWeapon);

}

#endif



public SV_Restart()

{

    set_cvar_num("sv_restart", 1);

    set_task(2.0, "End_RR");

}



public End_RR()

{

    #if defined STOP_STATS

    set_dhudmessage(255, 0, 0, .x = -1.0, .y = 0.05, .holdtime = 5.0, .channel = -1);

    ShowSyncHudMsg(0, g_iHudSync, "[Статистика Включена]");

    #endif

    set_hudmessage(255, 255, 255, .x = -1.0, .y = 0.08, .holdtime = 5.0, .channel = -1);

    ShowSyncHudMsg(0, g_iHudSync2, "Ожидание завершено!^nПриятной игры");

    for(new i = 1; i <= MaxClients; i++)

    {

        if(is_user_alive(i))

        {

            rg_remove_items_by_slot(i, PRIMARY_WEAPON_SLOT);

        }

    }

}



#if defined REMOVE_MAP_WPN

public CArmoury_Restart(const pArmoury)

{

    return HAM_SUPERCEDE;

}



public CGamePlayerEquip_Use()

{

    return HAM_SUPERCEDE;

}



public CStripWeapons_Use()

{

    return HAM_SUPERCEDE;

}



InvisibilityArmourys()

{

    new pArmoury = NULLENT

    while((pArmoury = rg_find_ent_by_class(pArmoury, "armoury_entity")))

    {

        if(get_member(pArmoury, m_Armoury_iCount) > 0)

        {

            set_entvar(pArmoury, var_effects, get_entvar(pArmoury, var_effects) | EF_NODRAW)

            set_entvar(pArmoury, var_solid, SOLID_NOT)

            set_member(pArmoury, m_Armoury_iCount, 0)

        }

    }

}

#endif



finishWurmUp()

{

    state warmupOff;

              

    BuyZone_ToogleSolid(SOLID_TRIGGER);



    #if defined REMOVE_MAP_WPN

    DisableHamForward(fwd_Equip);

    DisableHamForward(fwd_WpnStrip);

    DisableHamForward(fwd_Entity);

    #endif



    DisableHookChain(fwd_Spawn);

    DisableHookChain(fwd_GiveC4);



    set_cvar_string("mp_forcerespawn", "0");

    set_cvar_string("mp_respawn_immunitytime", "0");

    set_cvar_string("mp_round_infinite", "0");



    #if defined STOP_STATS

    set_cvar_num("csstats_pause", 0);

    #endif



    #if defined BLOCK

    DisableHookChain(fwd_BlockEntity);

    #endif



    #if defined STOP_PLUGS   

    PluginController(0);

    #endif



    #if NUM_RR > 1       

    set_task(LATENCY, "SV_Restart", .flags = "a", .repeat = NUM_RR);

    #else

    SV_Restart();

    #endif



    remove_task(TASK_TIMER_ID);

}



stock PluginController(stop)

{

    for(new i; i < sizeof g_arPlugins; i++)

    {

        if(stop)pause  ("ac", g_arPlugins[i]);

        else    unpause("ac", g_arPlugins[i]);

    }   

}



stock BuyZone_ToogleSolid(const solid)

{

    new entityIndex = 0;

    while ((entityIndex = rg_find_ent_by_class(entityIndex, "func_buyzone")))

        set_entvar(entityIndex, var_solid, solid);

}
Всем Здоровья! парни помогите подправить плагин на разминку на дефолтных пушках.
ошибка в плагине в том что когда выпадает разминка на ножах то в худе не пишет что разминка на "ножах"
даже когда прописываю в плагин weapon_knife то все равно не бывает надписи, а просто "Разминка на !"
 

Vaqtincha

aggressive
Разработчик
Регистрация
28 Янв 2018
Сообщения
774
Симпатии
481
Пол
Мужской
Скопиздили мой вармап но коряво. Гугли "Advanced Wapmup Reapi" и юзай на здоровые
 

IIuToH

Пользователь
Регистрация
5 Авг 2018
Сообщения
131
Симпатии
0
взял эту но что то не компилит
Код:
#pragma semicolon 1

#define TOGGLE_PLUGINS
#define PLAY_SOUND

#include <amxmodx>
#include <hamsandwich>
#include <reapi>

#define TASK_ID_TIMER 1
#define TASK_ID_FINISH 2

enum _:ITEM {
    WeaponIdType:ITEM_ID,
    ITEM_TITLE[32]
};

new const ITEMS[][ITEM] = {
    {WEAPON_SCOUT, "Scout"},
    {WEAPON_M3, "Дробовиках"},
    {WEAPON_HEGRENADE, "Гранатах"},
    {WEAPON_AWP, "AWP"},
    {WEAPON_ELITE, "Elite"},
    {WEAPON_KNIFE, "Ножах"},
};


//#if defined PLAY_SOUND
new const SOUNDS[][] = {
    "sound/rww/RoundStart.mp3",

};
#endif

#if defined TOGGLE_PLUGINS
new const PLUGINS[][] = {
    "awp_off_t.amxx"
    "drop_guns.amxx"
    "Respawn_dead.amxx"
};
#endif

enum {
    SPAWN,
    ON_SPAWN_EQUIP,
    HAS_RESTRICT_ITEM,
    DROP_PLAYER_ITEM,
    ADD_PLAYER_ITEM,
    DEAD_PLAYER_WEAPONS,
    GIVE_C4,
    KILLED,

    HOOK_CHAIN_LAST // DO NOT EDIT
};

enum {
    GAME_PLAYER_EQUIP,
    PLAYE_WEAPON_STRIP,
    ARMOURY_ENTITY,

    HAM_HOOKS_LAST // DO NOT EDIT
};

new HookChain:roundEndPre, HookChain:addAccount;
new HookChain:hookChains[HOOK_CHAIN_LAST], HamHook:hamForwards[HAM_HOOKS_LAST];

new mp_round_infinite, round_infinite[32];
new mp_forcerespawn, forcerespawn;
new mp_respawn_immunitytime, respawn_immunitytime;
new csstats_pause, aes_track_pause;
new warmUpTime, warmUpMode, warmUpReward;

new bool:enabled = false;
new timer, hudSync, hudSyncStats;
#if defined PLAY_SOUND
new sounds[sizeof(SOUNDS)], soundsNum = 0;
#endif
new item, WeaponIdType:itemId, itemName[32], itemTitle[32];
new kills[MAX_PLAYERS + 1];

#if defined PLAY_SOUND
public plugin_precache() {
    for (new i = 0; i < sizeof(SOUNDS); i++) {
        if (file_exists(SOUNDS[i], true)) {
            precache_generic(SOUNDS[i]);
            sounds[soundsNum++] = i;
        }
    }
}
#endif

public plugin_init() {
    register_plugin("[ReAPI] WurmUp", "0.3", "F@nt0M & h1k3");

    roundEndPre = RegisterHookChain(RG_RoundEnd, "RoundEnd_Pre", false);
    addAccount = RegisterHookChain(RG_CBasePlayer_AddAccount, "CBasePlayer_AddAccount_Pre", false);

    hookChains[SPAWN] = RegisterHookChain(RG_CBasePlayer_Spawn, "CBasePlayer_Spawn_Post", true);
    hookChains[ON_SPAWN_EQUIP] = RegisterHookChain(RG_CBasePlayer_OnSpawnEquip, "CBasePlayer_OnSpawnEquip_Pre", false);
    hookChains[HAS_RESTRICT_ITEM] = RegisterHookChain(RG_CBasePlayer_HasRestrictItem, "CBasePlayer_HasRestrictItem_Pre", false);
    hookChains[DROP_PLAYER_ITEM] = RegisterHookChain(RG_CBasePlayer_DropPlayerItem, "CBasePlayer_DropPlayerItem_Pre", false);
    hookChains[ADD_PLAYER_ITEM] = RegisterHookChain(RG_CBasePlayer_AddPlayerItem, "CBasePlayer_AddPlayerItem_Pre", false);
    hookChains[DEAD_PLAYER_WEAPONS] = RegisterHookChain(RG_CSGameRules_DeadPlayerWeapons, "CSGameRules_DeadPlayerWeapons_Pre", false);
    hookChains[GIVE_C4] = RegisterHookChain(RG_CSGameRules_GiveC4, "CSGameRules_GiveC4_Pre", false);
    hookChains[KILLED] = RegisterHookChain(RG_CBasePlayer_Killed, "CBasePlayer_Killed_Post", true);

    hamForwards[GAME_PLAYER_EQUIP] = RegisterHam(Ham_Use, "game_player_equip", "HamHookSupercede", false);
    hamForwards[PLAYE_WEAPON_STRIP] = RegisterHam(Ham_Use, "player_weaponstrip", "HamHookSupercede", false);
    hamForwards[ARMOURY_ENTITY] = RegisterHam(Ham_CS_Restart, "armoury_entity", "HamHookSupercede", false);

    // Toggle_Forwards(false);

    mp_round_infinite = get_cvar_pointer("mp_round_infinite");
    mp_forcerespawn = get_cvar_pointer("mp_forcerespawn");
    mp_respawn_immunitytime = get_cvar_pointer("mp_respawn_immunitytime");
    csstats_pause = get_cvar_pointer("csstats_pause");
    aes_track_pause = get_cvar_pointer("aes_track_pause");

    hudSync = CreateHudSyncObj();
    hudSyncStats = CreateHudSyncObj();

    Hide_ArmouryEntity();
    BuyZone_ToogleSolid(SOLID_NOT);

    warmUpTime = create_cvar("warmup_time", "60", .has_min = true, .min_val = 0.0);
    warmUpMode = create_cvar("warmup_mode", "0", .has_min = true, .min_val = 0.0, .has_max = true, .max_val = 1.0);
    warmUpReward = create_cvar("warmup_reward", "0", .has_min = true, .min_val = 0.0);
}

public plugin_pause() {
    if (!enabled) {
        return;
    }

    Toggle_Cvars(false);
    Toggle_Forwards(false);
#if defined TOGGLE_PLUGINS
    Toggle_Plugins(true);
#endif
    BuyZone_ToogleSolid(SOLID_TRIGGER);

    DisableHookChain(roundEndPre);

    set_member_game(m_bCompleteReset, true);
    set_member_game(m_bGameStarted, true);
    rg_round_end(0.1, WINSTATUS_DRAW, ROUND_GAME_COMMENCE, "");

    Players_GiveItems(true);

    DisableHookChain(addAccount);

    remove_task(TASK_ID_TIMER);
    remove_task(TASK_ID_FINISH);
}

public RoundEnd_Pre(const WinStatus:status, const ScenarioEventEndRound:event) {
    #pragma unused status
    if (event != ROUND_GAME_COMMENCE) {
        return HC_CONTINUE;
    }

    new time = get_pcvar_num(warmUpTime);
    if (time == 0) {
        DisableHookChain(roundEndPre);
        DisableHookChain(addAccount);
        return HC_CONTINUE;
    }

    enabled = true;

    Prepare_Item();

    Toggle_Cvars(true);
#if defined TOGGLE_PLUGINS
    Toggle_Plugins(false);
#endif
    Players_GiveItems(false);

    arrayset(kills, 0, sizeof(kills));
#if defined PLAY_SOUND
    Send_Audio();
#endif
    set_task(1.0, "TaskTimer", TASK_ID_TIMER, .flags = "a", .repeat = time);
    timer = time;
    
    SetHookChainReturn(ATYPE_BOOL, false);
    return HC_SUPERCEDE;
}

public CBasePlayer_AddAccount_Pre(const id, const amount, const RewardType:type) {
    if (get_pcvar_num(warmUpTime) == 0) {
        return HC_CONTINUE;
    }

    switch (type) {
        case RT_PLAYER_RESET:  {
            new reward = get_pcvar_num(warmUpReward);
            if (reward > 0) {
                SetHookChainArg(2, ATYPE_INTEGER, amount + (kills[id] * reward));
            }
        }
        case RT_PLAYER_JOIN: {
            SetHookChainArg(2, ATYPE_INTEGER, 0);
        }
        case RT_ENEMY_KILLED: {
            SetHookChainArg(2, ATYPE_INTEGER, 1);
        }
    }
    return HC_CONTINUE;
}

public CBasePlayer_Spawn_Post(const id) {
    if (is_user_alive(id)) {
        Player_GiveItem(id);
    }
}

public CBasePlayer_OnSpawnEquip_Pre(const id) {
    return HC_SUPERCEDE;
}

public CBasePlayer_HasRestrictItem_Pre() {
    SetHookChainReturn(ATYPE_BOOL, true);
    return HC_SUPERCEDE;
}

public CBasePlayer_DropPlayerItem_Pre() {
    SetHookChainReturn(ATYPE_INTEGER, 0);
    return HC_SUPERCEDE;
}

public CBasePlayer_AddPlayerItem_Pre() {
    SetHookChainReturn(ATYPE_INTEGER, 0);
    return HC_SUPERCEDE;
}

public CSGameRules_DeadPlayerWeapons_Pre() {
    SetHookChainReturn(ATYPE_INTEGER, GR_PLR_DROP_GUN_NO);
}

public CSGameRules_GiveC4_Pre() {
    return HC_SUPERCEDE;
}

public CBasePlayer_Killed_Post(const id, const killer) {
    if (id != killer && is_user_connected(killer)) {
        kills[killer]++;
    }
}

public HamHookSupercede() {
    return HAM_SUPERCEDE;
}

public TaskTimer() {
    timer--;
    if (timer > 0) {
        set_hudmessage(135, 206, 235, .x = -1.0, .y = 0.08, .holdtime = 0.9, .channel = -1);
        ShowSyncHudMsg(0, hudSync, "Разминка на %s!^nРестарт через %d сек", itemTitle, timer);

        if (csstats_pause || aes_track_pause) {
            set_hudmessage(255, 0, 0, .x = -1.0, .y = 0.05, .holdtime = 0.9, .channel = -1);
            ShowSyncHudMsg(0, hudSyncStats, "[Статистика Отключена]");
        }
    } else {
        BuyZone_ToogleSolid(SOLID_TRIGGER);
        Toggle_Cvars(false);
#if defined TOGGLE_PLUGINS
        Toggle_Plugins(true);
#endif
        Toggle_Forwards(false);
        Players_GiveItems(true);
        set_task(0.2, "TaskFinish", TASK_ID_FINISH);

        DisableHookChain(roundEndPre);
        set_member_game(m_bCompleteReset, true);
        set_member_game(m_bGameStarted, true);
        rg_round_end(0.1, WINSTATUS_DRAW, ROUND_GAME_COMMENCE, "");
    }
}

public TaskFinish() {
    set_hudmessage(135, 206, 235, .x = -1.0, .y = 0.80, .holdtime = 5.0, .channel = -1);
    ShowSyncHudMsg(0, hudSync, "Ожидание завершено!^nПриятной игры");

    if (csstats_pause || aes_track_pause) {
        set_hudmessage(255, 0, 0, .x = -1.0, .y = 0.05, .holdtime = 5.0, .channel = -1);
        ShowSyncHudMsg(0, hudSyncStats, "[Статистика Включена]");
    }

    DisableHookChain(addAccount);
    enabled = false;
}

Toggle_Forwards(const bool:enable) {
    for (new i = 0; i < HOOK_CHAIN_LAST; i++) {
        if (enable) {
            EnableHookChain(hookChains[i]);
        } else {
            DisableHookChain(hookChains[i]);
        }
    }
    for (new i = 0; i < HAM_HOOKS_LAST; i++) {
        if (enable) {
            EnableHamForward(hamForwards[i]);
        } else {
            DisableHamForward(hamForwards[i]);
        }
    }
}

Toggle_Cvars(const bool:enable) {
    if (enable) {
        get_pcvar_string(mp_round_infinite, round_infinite, charsmax(round_infinite));
        set_pcvar_string(mp_round_infinite, "1");

        forcerespawn = get_pcvar_num(mp_forcerespawn);
        set_pcvar_num(mp_forcerespawn, 3);

        respawn_immunitytime = get_pcvar_num(mp_respawn_immunitytime);
        set_pcvar_num(mp_respawn_immunitytime, 3);

        if (csstats_pause) {
            set_pcvar_num(csstats_pause, 1);
        }

        if (aes_track_pause) {
            set_pcvar_num(aes_track_pause, 1);
        }
    } else {
        set_pcvar_string(mp_round_infinite, round_infinite);
        set_pcvar_num(mp_forcerespawn, forcerespawn);
        set_pcvar_num(mp_respawn_immunitytime, respawn_immunitytime);

        if (csstats_pause) {
            set_pcvar_num(csstats_pause, 0);
        }

        if (aes_track_pause) {
            set_pcvar_num(aes_track_pause, 0);
        }
    }
}

#if defined TOGGLE_PLUGINS
Toggle_Plugins(const bool:enable) {
    for (new i = 0; i < sizeof(PLUGINS); i++) {
        if (enable) {
            unpause("ac", PLUGINS[i]);
        } else {
            pause("ac", PLUGINS[i]);
        }
    }
}
#endif

Players_GiveItems(const bool:defaultItems) {
    new players[MAX_PLAYERS], num;
    get_players(players, num, "ah");
    for (new i = 0, player; i < num; i++) {
        player = players[i];

        rg_remove_all_items(player);
        if (defaultItems) {
            rg_give_default_items(player);
        } else {
            Player_GiveItem(player);
        }
    }
}

Player_GiveItem(const id) {
    DisableHookChain(HookChain:hookChains[ADD_PLAYER_ITEM]);
    rg_give_item(id, "weapon_knife", GT_APPEND);
    new ent = rg_give_item(id, itemName, GT_APPEND);
    if (ent > 0) {
        rg_set_user_bpammo(id, itemId, rg_get_iteminfo(ent, ItemInfo_iMaxAmmo1));
    }
    EnableHookChain(HookChain:hookChains[ADD_PLAYER_ITEM]);
}

Hide_ArmouryEntity() {
    new ent = NULLENT;
    while ((ent = rg_find_ent_by_class(ent, "armoury_entity"))) {
        if(get_member(ent, m_Armoury_iCount) > 0) {
            set_entvar(ent, var_effects, get_entvar(ent, var_effects) | EF_NODRAW);
            set_entvar(ent, var_solid, SOLID_NOT);
            set_member(ent, m_Armoury_iCount, 0);
        }
    }
}

BuyZone_ToogleSolid(const solid) {
    new ent = NULLENT;
    while ((ent = rg_find_ent_by_class(ent, "func_buyzone"))) {
        set_entvar(ent, var_solid, solid);
    }
}

Prepare_Item() {
    new lastItemStr[3], lastItem;
    if (get_localinfo("warmup_last_item", lastItemStr, charsmax(lastItemStr))) {
        lastItem = str_to_num(lastItemStr);
    } else {
        lastItem = -1;
    }

    switch (get_pcvar_num(warmUpMode)) {
        case 1: {
            item = (lastItem + 1) % sizeof(ITEMS);
        }

        default: {
            new tries = 0;
            do {
                item = random(100) % sizeof(ITEMS);
            } while (item == lastItem && tries < sizeof(ITEMS));
        }
    }

    itemId = ITEMS[item][ITEM_ID];
    rg_get_weapon_info(itemId, WI_NAME, itemName, charsmax(itemName));
    copy(itemTitle, charsmax(itemTitle), ITEMS[item][ITEM_TITLE]);

    num_to_str(item, lastItemStr, charsmax(lastItemStr));
    set_localinfo("warmup_last_item", lastItemStr);
}

#if defined PLAY_SOUND
Send_Audio() {
    if (soundsNum > 0) {
        new sound = (soundsNum > 1) ? sounds[random(100) % soundsNum] : 0;
        client_cmd(0, "mp3 play ^"%s^"", SOUNDS[sound]);
    }
}
#endif
 

IIuToH

Пользователь
Регистрация
5 Авг 2018
Сообщения
131
Симпатии
0
взял ещё эту от Неугомона, когда идёт разминка на ножах и нажимаешь клавишу Q то сервер сразу падает
Код:
#include <amxmodx>
#include <reapi>

#define TIME_RR     60    // Время разминки
#define NUM_RR        1    // Кол-во рестартов
#define LATENCY        1.5    // Задержка между рестартами
#define PROTECTED     0    // Сколько секунд действует защита после возрождения, 0 - отключить (актуально для DM_MODE)
// отключаемо //
//#define SOUND            // Музыка под час разминки
#define STOP_PLUGS        // Отключать плагины на время разминки
#define DM_MODE            // Бесконечный респавн на время разминки
//#define OFF_RR            // Отключать этот плагин на указанных картах
#define BLOCK           // Запрет поднятия оружия с земли [по умолчанию выкл.]
//#define STOP_STATS      // Отключать запись статистики на время разминки (Работает только с измененным CSStatsX SQL by serfreeman1337) [по умолчанию выкл.]

#if defined SOUND
new const soundRR[] = "sound/rr/RoundStart.mp3"; // Указывать путь и название файла, например sound/serv/music.mp3
#endif
#if defined STOP_STATS
native stats_set_enabled(params_num)
#endif
#if defined STOP_PLUGS
    new g_arPlugins[][] =    // Указывать название плагинов, например test.amxx
    {
        "test.amxx"
    }
#endif
new g_iHudSync;
new g_szWeapon[32];
new g_iWp;
new HookChain:fwd_NewRound,
    HookChain:fwd_Spawn,
    HookChain:fwd_GiveC4,
#if defined BLOCK
    HookChain:fwd_BlockEntity,
#endif
#if defined DM_MODE
    HookChain:fwd_Killed;
#endif

const TASK_PROTECTION_ID = 33464;

public plugin_init()
{
    register_plugin("[ReAPI] Random Weapons WarmUP", "2.4.4", "neugomon");

    RegisterHookChain(RG_RoundEnd, "fwdRoundEnd", true);
    DisableHookChain(fwd_NewRound = RegisterHookChain(RG_CSGameRules_CheckMapConditions, "fwdRoundStart", true));
    DisableHookChain(fwd_Spawn    = RegisterHookChain(RG_CBasePlayer_Spawn, "fwdPlayerSpawnPost", true));
    DisableHookChain(fwd_GiveC4   = RegisterHookChain(RG_CSGameRules_GiveC4, "fwdGiveC4", false));
#if defined BLOCK
    DisableHookChain(fwd_BlockEntity = RegisterHookChain(RG_CBasePlayer_HasRestrictItem, "fwdHasRestrictItemPre", false));
    register_clcmd("drop", "ClCmd_Drop");
#endif
#if defined DM_MODE
    DisableHookChain(fwd_Killed   = RegisterHookChain(RG_CBasePlayer_Killed, "fwdPlayerKilledPost", true));
    g_iHudSync    = CreateHudSyncObj();
    register_clcmd("joinclass", "clCmdJoinClass");
    register_clcmd("menuselect","clCmdJoinClass");
#endif
    state warmupOff;   
#if defined OFF_RR
    new sPref[][] = { "awp_", "aim_", "fy_", "$", "cs_", "35hp" }; // Указывать префиксы карт
    new map[32]; get_mapname(map, charsmax(map));
    for(new i; i < sizeof sPref; i++)
    {
        if(containi(map, sPref[i]) != -1)
        {
            pause("ad");
            return;
        }
    }   
#endif   
}
#if defined BLOCK
public fwdHasRestrictItemPre() {
    SetHookChainReturn(ATYPE_INTEGER, true);
    return HC_SUPERCEDE;
}

public ClCmd_Drop() <warmupOff>
    return PLUGIN_CONTINUE;
    
public ClCmd_Drop() <warmupOn>
    return PLUGIN_HANDLED;
#endif
public client_putinserver(id)
{
    remove_task(id + TASK_PROTECTION_ID)
}
#if defined SOUND
public plugin_precache()
{
        precache_generic(soundRR);
}
#endif
public fwdRoundEnd(WinStatus:status, ScenarioEventEndRound:event, Float:tmDelay)
    if(event == ROUND_GAME_COMMENCE)
        EnableHookChain(fwd_NewRound);

public fwdRoundStart()
{
    state warmupOn;
    
#if defined SOUND
    client_cmd(0, "mp3 play ^"%s^"", soundRR);
#endif
    
    DisableHookChain(fwd_NewRound);
    EnableHookChain(fwd_Spawn);
    EnableHookChain(fwd_GiveC4);
#if defined STOP_STATS
    stats_set_enabled(0);
#endif
    set_cvar_string("mp_round_infinite", "1");
#if defined BLOCK
    EnableHookChain(fwd_BlockEntity);
#endif
#if defined DM_MODE   
    EnableHookChain(fwd_Killed);
#endif   
#if defined STOP_PLUGS   
    PluginController(1);
#endif
    switch((g_iWp = random(6)))
    {
        case 0: formatex(g_szWeapon, charsmax(g_szWeapon), "SCOUT");
        case 1: formatex(g_szWeapon, charsmax(g_szWeapon), "M3");
        case 2: formatex(g_szWeapon, charsmax(g_szWeapon), "Гранатах");
        case 3: formatex(g_szWeapon, charsmax(g_szWeapon), "AWP");
        case 4: formatex(g_szWeapon, charsmax(g_szWeapon), "Elite");
        case 5: formatex(g_szWeapon, charsmax(g_szWeapon), "Ножах");
    }
    set_task(1.0, "ShowTimer", .flags = "a", .repeat = TIME_RR);
}
#if defined DM_MODE
public clCmdJoinClass(id) <warmupOff>
    return;
    
public clCmdJoinClass(id) <warmupOn>
    if(get_member(id, m_iMenu) == Menu_ChooseAppearance)
        set_task(0.5, "SpawnPlayer", id);
#endif
public fwdPlayerSpawnPost(const id)
{
    if(!is_user_alive(id))
        return;

    BuyZone_ToogleSolid(SOLID_NOT);
    SetProtection(id)
    rg_remove_all_items(id);
    set_member_game(m_bMapHasBuyZone, true);

    switch(g_iWp)
    {
        case 0:
        {
            rg_give_item(id, "weapon_scout");
            rg_give_item(id, "weapon_knife");
            rg_set_user_bpammo(id, WEAPON_SCOUT, 90);
        }
        case 1:
        {
            rg_give_item(id, "weapon_m3");
            rg_give_item(id, "weapon_knife");
            rg_set_user_bpammo(id, WEAPON_M3, 90);
        }
        case 2:
        {
            rg_give_item(id, "weapon_hegrenade");
            rg_set_user_bpammo(id, WEAPON_HEGRENADE, 120);
        }
        case 3:
        {
            rg_give_item(id, "weapon_awp");
            rg_give_item(id, "weapon_knife");
            rg_set_user_bpammo(id, WEAPON_AWP, 90);
        }
        case 4:
        {
            rg_give_item(id, "weapon_elite");
            rg_give_item(id, "weapon_knife");
            rg_set_user_bpammo(id, WEAPON_ELITE, 90);
        }
        case 5:
        {
            rg_give_item(id, "weapon_knife");
            rg_set_user_bpammo(id, WEAPON_KNIFE, 35);
        }
    }   
}
#if defined DM_MODE
public fwdPlayerKilledPost(pVictim)
    set_task(1.0, "SpawnPlayer", pVictim);
#endif
public fwdGiveC4()
{
    return HC_SUPERCEDE
}

public ShowTimer()
{
    static timer = -1;
    if(timer == -1) timer = TIME_RR;
    
    switch(--timer)
    {
        case 0:
        {
            state warmupOff;
            
            BuyZone_ToogleSolid(SOLID_TRIGGER);
            DisableHookChain(fwd_Spawn);
            DisableHookChain(fwd_GiveC4);
        #if defined STOP_STATS
            stats_set_enabled(1);
        #endif
            set_cvar_string("mp_round_infinite", "0");
        #if defined BLOCK
            DisableHookChain(fwd_BlockEntity);
        #endif
        #if defined DM_MODE   
            DisableHookChain(fwd_Killed);
        #endif
        #if defined STOP_PLUGS   
            PluginController(0);
        #endif   
        #if NUM_RR > 1       
            set_task(LATENCY, "SV_Restart", .flags = "a", .repeat = NUM_RR);
        #else
            SV_Restart();
        #endif
            timer = -1;
        }
        default:
        {
        #if defined STOP_STATS
            set_hudmessage(255, 0, 0, .x = -1.0, .y = 0.55, .holdtime = 0.9, .channel = -1);
            show_hudmessage(0, "[Статистика Отключена]");
        #endif
            set_hudmessage(135, 206, 235, .x = -1.0, .y = 0.08, .holdtime = 0.9, .channel = -1);
            ShowSyncHudMsg(0, g_iHudSync, "Разминка на %s!^nРестарт через %d сек", g_szWeapon, timer);
        }
    }
}

public SV_Restart()
{
    set_cvar_num("sv_restart", 1);
    set_task(2.0, "End_RR");
}

public End_RR()
{
#if defined STOP_STATS
    set_hudmessage(255, 0, 0, .x = -1.0, .y = 0.55, .holdtime = 5.0, .channel = -1);
    show_hudmessage(0, "[Статистика Включена]");
#endif
    set_hudmessage(135, 206, 235, .x = -1.0, .y = 0.80, .holdtime = 5.0, .channel = -1);
    show_hudmessage(0, "Ожидание завершено!^nПриятной игры!");
}
#if defined DM_MODE   
public SpawnPlayer(id)
{
    if(!is_user_connected(id))
        return;
    if(is_user_alive(id))
        return;
    
    switch(get_member(id, m_iTeam))
    {
        case 1, 2: rg_round_respawn(id);
    }
}
#endif

public SetProtection(id)
{
    set_entvar(id, var_takedamage, DAMAGE_NO)

    switch(get_member(id, m_iTeam))
    {
        case TEAM_TERRORIST: rg_set_rendering(id, kRenderFxGlowShell, 255, 0, 0, 10);
        case TEAM_CT: rg_set_rendering(id, kRenderFxGlowShell, 0, 0, 255, 10);
    }

    remove_task(TASK_PROTECTION_ID + id)
    set_task( PROTECTED.0, "EndProtection", TASK_PROTECTION_ID + id)
}

public EndProtection(TaskID)
{
    new id = TaskID - TASK_PROTECTION_ID

    if(!is_user_connected(id))
        return

    set_entvar(id, var_takedamage, DAMAGE_AIM)
    rg_set_rendering(id)
}

stock rg_set_rendering(index, fx = kRenderFxNone, r=255, g=255, b=255, amount=16)
{
    new Float:RenderColor[3]
    RenderColor[0] = float(r)
    RenderColor[1] = float(g)
    RenderColor[2] = float(b)
    
    set_entvar(index, var_renderfx, fx)
    set_entvar(index, var_rendercolor, RenderColor)
    set_entvar(index, var_renderamt, float(amount))
}

stock PluginController(stop)
{
    for(new i; i < sizeof g_arPlugins; i++)
    {
        if(stop)pause  ("ac", g_arPlugins[i]);
        else    unpause("ac", g_arPlugins[i]);
    }   
}

stock BuyZone_ToogleSolid(const solid)
{
    new entityIndex = 0;
    while ((entityIndex = rg_find_ent_by_class(entityIndex, "func_buyzone")))
        set_entvar(entityIndex, var_solid, solid);
}
 

Vaqtincha

aggressive
Разработчик
Регистрация
28 Янв 2018
Сообщения
774
Симпатии
481
Пол
Мужской
IIuToH, Нужен разминка на ножах ? Скоро добавлю такой ресурс.
 

Shadowless

Пользователь
Регистрация
24 Фев 2019
Сообщения
230
Симпатии
8
Пол
Мужской
he has another problem
 
Сверху Снизу