Помогите пожалуйста заставить работать на ксдм

deniska21233

Пользователь
Регистрация
28 Июн 2017
Сообщения
101
Симпатии
3
Пол
Мужской
с регистратором оружия из зм для ксдм запустился
Так же расставил точки спавна
Но после рестарта сервера не начинает работать и скидывать грузы
очень долго ждал не увидел не одного ящика
Код:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <fun>
#include <cstrike>
#include <xs>
#include <WPMGPrintChatColor>
#include <zombieplaguenightmare>

#define PLUGIN     "[ZP]Present"
#define VERSION "1.0"
#define AUTHOR     "CrAsH"

#define ADMIN_LEVEL            ADMIN_IMMUNITY

//native give_at4( Player ) ; // 1
native give_weapon_anaconda( Player ) ; // 1

/*==========================================
                    Предметы
===========================================*/
enum _:EItems
{
    EExtra[128] = 1,
    ERand
}

//new g_ItemsNum
//new g_Items[200][EItems]

/*==========================================
                Всякая хрень
===========================================*/
//Траектория
new g_LoadMap[128]

//Выбранная траектория
new iPlayerSTracer[33]

//Идентификаторы траекторий
new g_TracerNum
new g_TracerStart[10]
new g_TracerEnd[10]

//Переменные траекторий
new g_TracerCount
new g_TracerGO

//Данные траекторий
new Float:g_TracerOrigin[999][3]
new Float:g_TracerAngles[999][3]
new Float:g_TracerAngleV[999][3]
new g_TracerDrop[999]
new g_TracerMetka[999]

//Действие траекторий
new g_CreateSteps[10][5]

//Модели
new const gModels[4][] =
{
    "models/TalRasha/presents/vert.mdl",
    "models/TalRasha/bosses/phobos/supplybox.mdl",
    "models/TalRasha/presents/parachut.mdl",
    "sprites/TalRasha/zombie/supplybox_m1.spr"
}

//Звуки
new const gSounds[3][] =
{
    "TalRasha/supplyboxes/idle2.wav",
    "TalRasha/supplyboxes/presents_get.wav",
    "TalRasha/supplyboxes/presents_respawn.wav"
}

//Объекты соприкосновение
new const szEntity[][] =
{
    "worldspawn", "func_wall", "func_door",  "func_door_rotating",
    "func_wall_toggle", "func_breakable", "func_pushable", "func_train",
    "func_illusionary", "func_button", "func_rot_button", "func_rotating", "player"
}


//Класснеймы
new const gClassname[] = "present_ver"
new const gClassnameBox[] = "present_box"
new const gClassnameSprite[] = "present_sprite"
new const gClassnamePara[] = "present_para"

//Прочее
new Float:g_fSkyOrigin[3]
new g_PresentSky[999]
new g_PresentFix[999]

/*==========================================
            Инициализация плагина
===========================================*/
public plugin_init()
{
    //Регистрация плагина
    register_plugin(PLUGIN, VERSION, AUTHOR)

    //Действие вертолета
    register_think(gClassname, "VertThink")

    //Действие подарка
    register_think(gClassnameBox, "BoxThink")

    //Соприкосновение подарка с объектами
    for(new i; i<sizeof szEntity; i++)
    {
        register_touch(gClassnameBox, szEntity[i], "BoxTouchWorld")
    }

    register_menucmd(register_menuid("Show_MainMenu"), (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9), "Handle_MainMenu")
    register_menucmd(register_menuid("Show_TracerMenu"), (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9), "Handle_TracerMenu")

    //Команды
    register_clcmd("present_manager", "Show_MainMenu")

    //Ланг файл
    register_dictionary("csnz_supplybox.txt")

}

/*==========================================
            Скачивание ресурсов
===========================================*/
public plugin_precache()
{
    for(new i = 0;i < sizeof( gModels ); i++)
        engfunc(EngFunc_PrecacheModel, gModels[i])

    for(new i = 0;i < sizeof( gSounds ); i++)
        engfunc(EngFunc_PrecacheSound, gSounds[i])
}

/*==========================================
            Загрузка траекторий
===========================================*/
public plugin_cfg()
{
    new szText[1024]
    new iFile /*iLine*/

    new g_LoadDir[128]
    get_configsdir(g_LoadDir, charsmax( g_LoadDir ))

    formatex(g_LoadDir, charsmax( g_LoadDir ), "%s/csnz", g_LoadDir)
    if(!dir_exists( g_LoadDir ))
        mkdir( g_LoadDir )

    /*new szFile[128]
    formatex(szFile, charsmax( szFile ), "%s/items.ini", g_LoadDir)
    if(!file_exists( szFile ))
    {
        formatex(szText, charsmax( szText ), "%L", LANG_PLAYER, "ZP_PRESENT_NOFILE", szFile)
        set_fail_state( szText )
    }

    iFile = fopen(szFile, "rt")
    while(!feof( iFile ))
    {
        fgets(iFile, szText, charsmax( szText ))

        trim( szText )

        iLine += 1
        if(!strlen( szText ) || szText[0] == ';' || (szText[0] == '/' && szText[1] == '/' ) || iLine == 1)
            continue

        new szParseE[3][128]
        parse(szText,
            szParseE[1], 127,
            szParseE[2], 127
        )

        g_ItemsNum += 1

        g_Items[g_ItemsNum][EExtra] = szParseE[1]
        g_Items[g_ItemsNum][ERand] = str_to_num( szParseE[2] )
    }
    fclose( iFile )*/

    formatex(g_LoadDir, charsmax( g_LoadDir ), "%s/supplybox_spawn", g_LoadDir)
    if(!dir_exists( g_LoadDir ))
        mkdir( g_LoadDir )

    new szMap[128]
    get_mapname(szMap, charsmax( szMap ))

    formatex(g_LoadMap, charsmax( g_LoadMap ), "%s/%s.ini", g_LoadDir, szMap)
    if(!file_exists( g_LoadMap ))
    {
        new iFile = fopen(g_LoadMap, "at")
            fclose( iFile )

        return PLUGIN_CONTINUE
    }

   
    iFile = fopen(g_LoadMap, "rt")
    while(!feof( iFile ))
    {
        fgets(iFile, szText, charsmax( szText ))

        trim( szText )
        if(!strlen( szText ) || szText[0] == ';' || (szText[0] == '/' && szText[1] == '/' ))
            continue

        new szParse[12][32]
        parse(szText,
            szParse[1], 31, szParse[2], 31, szParse[3], 31,
            szParse[4], 31, szParse[5], 31, szParse[6], 31,
            szParse[7], 31, szParse[8], 31, szParse[9], 31,
            szParse[10], 31, szParse[11], 31
        )

        g_TracerOrigin[g_TracerCount][0] = str_to_float( szParse[1] )
        g_TracerOrigin[g_TracerCount][1] = str_to_float( szParse[2] )
        g_TracerOrigin[g_TracerCount][2] = str_to_float( szParse[3] )

        g_TracerAngles[g_TracerCount][0] = str_to_float( szParse[4] )
        g_TracerAngles[g_TracerCount][1] = str_to_float( szParse[5] )
        g_TracerAngles[g_TracerCount][2] = str_to_float( szParse[6] )

        g_TracerAngleV[g_TracerCount][0] = str_to_float( szParse[7] )
        g_TracerAngleV[g_TracerCount][1] = str_to_float( szParse[8] )
        g_TracerAngleV[g_TracerCount][2] = str_to_float( szParse[9] )

        g_TracerDrop[g_TracerCount] = str_to_num( szParse[10] )

        if(str_to_num( szParse[11] ))
        {
            if(g_TracerNum)
            {
                g_TracerEnd[g_TracerNum] = g_TracerCount
            }

            g_TracerNum += 1
            if(strlen(szParse[1]))
            {
                g_CreateSteps[g_TracerNum][1] = true
            }

            g_TracerMetka[g_TracerCount] = true
            g_TracerStart[g_TracerNum] = g_TracerCount

            GetSkyOrigin(g_TracerOrigin[g_TracerCount])
        }

        g_TracerCount += 1
    }
    fclose( iFile )
    return PLUGIN_CONTINUE
}

/*==========================================
                Главное меню
===========================================*/
public Show_MainMenu(id)
{
    if (!is_user_connected(id) || ~get_user_flags(id) & ADMIN_LEVEL)
        return PLUGIN_HANDLED
       
    new szMenu[512], iKeys = (1<<9),
    iLen = formatex(szMenu, charsmax(szMenu), "%L^n^n", LANG_PLAYER, "ZP_PRESENT_MAINMENU_TITLE", g_TracerNum)

    iKeys |= (1<<0)
    iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y[\r1\y] \w%L^n^n",  LANG_PLAYER, "ZP_PRESENT_MAINMENU_ITEM_1")

    for(new i = 1; i <= g_TracerNum; i++)
    {
        iKeys |= (1<<i)
        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y[\r%d\y] \w%L^n", i + 1, LANG_PLAYER, "ZP_PRESENT_MAINMENU_ITEMS", i)
    }

    iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\y[\r0\y] \w%L^n", LANG_PLAYER, "ZP_PRESENT_MAINMENU_ITEM_0")

    show_menu(id, iKeys, szMenu, -1, "Show_MainMenu")
    return PLUGIN_HANDLED
}

/*==========================================
            Главное меню(Обработчик)
===========================================*/
public Handle_MainMenu(id, iKey)
{
    if (!is_user_connected(id) || ~get_user_flags(id) & ADMIN_LEVEL)
        return PLUGIN_HANDLED
       
    switch(iKey)
    {
        case 0:
        {
            g_TracerNum += 1

            iPlayerSTracer[id] = g_TracerNum
            Show_TracerMenu(id, g_TracerNum)
        }

        case 9: return PLUGIN_HANDLED

        default:
        {
            iPlayerSTracer[id] = iKey
            Show_TracerMenu(id, iKey)
        }
    }
    return PLUGIN_HANDLED
}

/*==========================================
            Управление траекторией
===========================================*/
public Show_TracerMenu(id, iType)
{
    if (!is_user_connected(id) || ~get_user_flags(id) & ADMIN_LEVEL)
        return PLUGIN_HANDLED
       
    new szMenu[512], iKeys = (1<<9),
    iLen = formatex(szMenu, charsmax(szMenu), "%L^n^n", LANG_PLAYER, "ZP_PRESENT_TRACERMENU_TITLE", iType)

    if(!g_CreateSteps[iType][1])
    {
        iKeys |= (1<<0)
        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y[\r1\y] \w%L^n^n", LANG_PLAYER, "ZP_PRESENT_TRACERMENU_ITEM_1")
    }else{
        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y[\r1\y] \d%L^n^n", LANG_PLAYER, "ZP_PRESENT_TRACERMENU_ITEM_1")
    }

    if(g_CreateSteps[iType][1])
    {
        if(!g_CreateSteps[iType][3])
        {
            if(!g_CreateSteps[iType][2])
            {
                iKeys |= (1<<1)
                iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y[\r2\y] \w%L^n", LANG_PLAYER, "ZP_PRESENT_TRACERMENU_ITEM_2")
            }else{
                iKeys |= (1<<1)
                iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y[\r2\y] \w%L^n", LANG_PLAYER, "ZP_PRESENT_TRACERMENU_ITEM_2_1")
            }
        }else{
            iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y[\r2\y] \d%L^n", LANG_PLAYER, "ZP_PRESENT_TRACERMENU_ITEM_2_1")
        }
    }else{
        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y[\r2\y] \d%L^n", LANG_PLAYER, "ZP_PRESENT_TRACERMENU_ITEM_2")
    }

    if(g_CreateSteps[iType][2])
    {
        if(!g_CreateSteps[iType][3])
        {
            iKeys |= (1<<2)
            iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y[\r3\y] \w%L^n", LANG_PLAYER, "ZP_PRESENT_TRACERMENU_ITEM_3")
        }else{
            iKeys |= (1<<2)
            iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y[\r3\y] \w%L^n", LANG_PLAYER, "ZP_PRESENT_TRACERMENU_ITEM_3_1")
        }
    }else{
        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y[\r3\y] \d%L^n", LANG_PLAYER, "ZP_PRESENT_TRACERMENU_ITEM_3")
    }

    if(g_CreateSteps[iType][3])
    {
        iKeys |= (1<<3)
        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y[\r4\y] \w%L^n", LANG_PLAYER, "ZP_PRESENT_TRACERMENU_ITEM_4")
    }else{
        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y[\r4\y] \d%L^n", LANG_PLAYER, "ZP_PRESENT_TRACERMENU_ITEM_4")
    }

    if(g_CreateSteps[iType][1] && !g_CreateSteps[iType][3] && !g_CreateSteps[iType][4])
    {
        iKeys |= (1<<4)
        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y[\r5\y] \w%L^n", LANG_PLAYER, "ZP_PRESENT_TRACERMENU_ITEM_5")
    }else{
        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y[\r5\y] \d%L^n", LANG_PLAYER, "ZP_PRESENT_TRACERMENU_ITEM_5")
    }

    if(g_CreateSteps[iType][1] && !g_CreateSteps[iType][3] && !g_CreateSteps[iType][4])
    {
        iKeys |= (1<<5)
        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y[\r6\y] \w%L^n", LANG_PLAYER, "ZP_PRESENT_TRACERMENU_ITEM_6")
    }else{
        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y[\r6\y] \d%L^n", LANG_PLAYER, "ZP_PRESENT_TRACERMENU_ITEM_6")
    }

    iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\y[\r0\y] \w%L^n", LANG_PLAYER, "ZP_PRESENT_TRACERMENU_ITEM_0")

    show_menu(id, iKeys, szMenu, -1, "Show_TracerMenu")
    return PLUGIN_HANDLED
}

/*==========================================
    Управление траекторией(Обработчик)
===========================================*/
public Handle_TracerMenu(id, iKey)
{
    if (!is_user_connected(id) || ~get_user_flags(id) & ADMIN_LEVEL)
        return PLUGIN_HANDLED
       
    switch(iKey)
    {
        case 0:
        {
            new iOrigin[3]
            get_user_origin(id, iOrigin, 3)
       
            new Float:fOrigin[3]
            IVecFVec(iOrigin, fOrigin)

            g_TracerMetka[g_TracerCount] = true
            g_TracerStart[iPlayerSTracer[id]] = g_TracerCount

            g_TracerOrigin[g_TracerCount][0] = fOrigin[0]
            g_TracerOrigin[g_TracerCount][1] = fOrigin[1]
            g_TracerOrigin[g_TracerCount][2] = fOrigin[2]

            g_TracerCount += 1
            g_CreateSteps[iPlayerSTracer[id]][1] = true

            GetSkyOrigin(fOrigin)
            Show_TracerMenu(id, iPlayerSTracer[id])
        }

        case 1:
        {
            if(!g_CreateSteps[iPlayerSTracer[id]][2])
            {
                g_CreateSteps[iPlayerSTracer[id]][2] = true

                set_user_maxspeed(id, 400.0)
                set_user_noclip(id, 1)
            }else{
                g_CreateSteps[iPlayerSTracer[id]][2] = false

                set_user_maxspeed(id)
                set_user_noclip(id, 0)
            }
            Show_TracerMenu(id, iPlayerSTracer[id])
        }

        case 2:
        {
            if(!g_CreateSteps[iPlayerSTracer[id]][3])
            {
                g_CreateSteps[iPlayerSTracer[id]][3] = true
                set_task(0.05, "TracerRecord", id + 5435, _, _, "b")
            }else{
                g_CreateSteps[iPlayerSTracer[id]][3] = false
                g_TracerEnd[iPlayerSTracer[id]] = g_TracerCount

                g_TracerCount += 1
                remove_task(id + 5435)
            }
            Show_TracerMenu(id, iPlayerSTracer[id])
        }

        case 3:
        {
            g_TracerDrop[g_TracerCount] = true
            Show_TracerMenu(id, iPlayerSTracer[id])
        }

        case 4:
        {
            g_CreateSteps[iPlayerSTracer[id]][4] = true
            g_TracerGO = g_TracerStart[iPlayerSTracer[id]]

            new Float:fAngles[3]
            pev(id, pev_angles, fAngles)
       
            new Float:fAngleV[3]
            pev(id, pev_v_angle, fAngleV)
       
            fAngleV[0] = 0.0
            fAngleV[2] = 0.0
       
            fAngles[0] = 0.0
            fAngles[2] = 0.0
   
            CreateWert(g_TracerOrigin[g_TracerGO], fAngles, fAngleV, iPlayerSTracer[id])
            client_print(id, print_chat, "start: %d, end: %d", g_TracerStart[iPlayerSTracer[id]], g_TracerEnd[iPlayerSTracer[id]])
        }

        case 5:
        {
            delete_file( g_LoadMap )

            new iFile = fopen(g_LoadMap, "at")
                fclose( iFile )

            new szText[512]
            for(new i = 0; i <= g_TracerCount; i++)
            {
                formatex(szText, charsmax( szText ), "^"%f^" ^"%f^" ^"%f^" ^"%f^" ^"%f^" ^"%f^" ^"%f^" ^"%f^" ^"%f^" ^"%d^" ^"%d^"",
                    g_TracerOrigin[i][0], g_TracerOrigin[i][1], g_TracerOrigin[i][2],
                    g_TracerAngles[i][0], g_TracerAngles[i][1], g_TracerAngles[i][2],
                    g_TracerAngleV[i][0], g_TracerAngleV[i][1], g_TracerAngleV[i][2],
                    g_TracerDrop[i], g_TracerMetka[i]
                )
                               
                write_file(g_LoadMap, szText, -1)
            }
        }

        case 9: return PLUGIN_HANDLED
    }
    return PLUGIN_HANDLED
}

/*==========================================
            Создание траектории
===========================================*/
public TracerRecord(id)
{
    id -= 5435

    new Float:fOrigin[3]
    pev(id, pev_origin, fOrigin)

    new Float:fAngles[3]
    pev(id, pev_angles, fAngles)

    new Float:fAngleV[3]
    pev(id, pev_v_angle, fAngleV)

    g_TracerOrigin[g_TracerCount] = fOrigin
    g_TracerAngles[g_TracerCount] = fAngles
    g_TracerAngleV[g_TracerCount] = fAngleV

    g_TracerCount += 1

    if(g_TracerCount == 998)
    {
        remove_task(id + 5435)
    }
}

/*==========================================
                Создание вертолета
===========================================*/
stock CreateWert(Float:fOrigin[3], Float:fAngles[3], Float:fAngleV[3], iTracer)
{
    new iEntity = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
    if(!pev_valid( iEntity ))
        return
       
    set_pev(iEntity, pev_origin, fOrigin)
    set_pev(iEntity, pev_angles, fAngles)
    set_pev(iEntity, pev_v_angle, fAngleV)

    set_pev(iEntity, pev_classname, gClassname)

    set_pev(iEntity, pev_solid, SOLID_TRIGGER)
    set_pev(iEntity, pev_movetype, MOVETYPE_NONE)
    set_pev(iEntity, pev_sequence, 0)
    set_pev(iEntity, pev_framerate, 1.0)
    set_pev(iEntity, pev_iuser1, iTracer)

    set_pev(iEntity, pev_nextthink, get_gametime() + 0.08)

    engfunc(EngFunc_SetModel, iEntity, gModels[0])
    engfunc(EngFunc_SetSize, iEntity, Float:{-1.0,-1.0,-1.0}, Float:{1.0,1.0,1.0})

    set_rendering(iEntity, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 0)
}

/*==========================================
                Полет вертолета
===========================================*/
public VertThink(iEntity)
{
        if(!pev_valid( iEntity ))
                return

    if(!g_CreateSteps[pev(iEntity, pev_iuser1)][4])
        return

    set_pev(iEntity, pev_origin, g_TracerOrigin[g_TracerGO])
    set_pev(iEntity, pev_angles, g_TracerAngles[g_TracerGO])
    set_pev(iEntity, pev_v_angle, g_TracerAngleV[g_TracerGO])

    if(pev(iEntity, pev_iuser2) >= 5)
    {
        set_rendering(iEntity)
    }else{
        set_pev(iEntity, pev_iuser2, (pev(iEntity, pev_iuser2) + 1))
    }

    g_TracerGO += 1
    if(g_TracerGO == g_TracerCount || g_TracerGO == g_TracerEnd[pev(iEntity, pev_iuser1)])
    {
        g_TracerGO = 0
        g_CreateSteps[pev(iEntity, pev_iuser1)][4] = false

        set_pev(iEntity, pev_flags, pev(iEntity, pev_flags) | FL_KILLME)
        return
    }

    if(g_TracerDrop[g_TracerGO])
    {
        new iBox = CreateBox(g_TracerOrigin[g_TracerStart[pev(iEntity, pev_iuser1)]])
        set_pev(iBox, pev_origin, g_TracerOrigin[g_TracerGO])

        new iParashute = CreatePatashute(g_TracerOrigin[g_TracerStart[pev(iEntity, pev_iuser1)]])
        set_pev(iBox, pev_iuser1, iParashute)

        new Float:fOrigin[3]

        fOrigin = g_TracerOrigin[g_TracerGO]
        fOrigin[2] -= 40.0

        set_pev(iParashute, pev_origin, fOrigin)
    }
    set_pev(iEntity, pev_nextthink, get_gametime() + 0.08)
}

/*==========================================
                 Создание подарка
===========================================*/
stock CreateBox(Float:fOrigin[3])
{
    new iEntity = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))

    set_pev(iEntity, pev_origin, fOrigin)
    set_pev(iEntity, pev_classname, gClassnameBox)

    set_pev(iEntity, pev_solid, SOLID_TRIGGER)
    set_pev(iEntity, pev_movetype, MOVETYPE_NONE)
    set_pev(iEntity, pev_sequence, 0)
    set_pev(iEntity, pev_framerate, 1.0)

    set_pev(iEntity, pev_nextthink, get_gametime() + 0.08)

    engfunc(EngFunc_SetModel, iEntity, gModels[1])
    engfunc(EngFunc_SetSize, iEntity, Float:{-1.0,-1.0,-1.0}, Float:{1.0,1.0,-1.0})
    return iEntity
}

/*==========================================
                Полет подарка(о0)
===========================================*/
public BoxThink(iEntity)
{
        if(!pev_valid( iEntity ))
                return

    new Float:fOrigin[3]
    pev(iEntity, pev_origin, fOrigin)

    if(!g_PresentSky[iEntity])
    {
        fOrigin[2] -= 10.0

        set_pev(iEntity, pev_origin, fOrigin)

        if(pev(iEntity, pev_iuser1))
        {
            pev(pev(iEntity, pev_iuser1), pev_origin, fOrigin)

            fOrigin[2] -= 10.0
            set_pev(pev(iEntity, pev_iuser1), pev_origin, fOrigin)
        }
    }

    if(g_fSkyOrigin[2] >= fOrigin[2])
    {
        g_PresentSky[iEntity] = true

        if(pev(iEntity, pev_iuser1))
        {
            set_pev(pev(iEntity, pev_iuser1), pev_flags, pev(pev(iEntity, pev_iuser1), pev_flags) | FL_KILLME)
            set_pev(iEntity, pev_iuser1, 0)
        }

        set_pev(iEntity, pev_solid, SOLID_TRIGGER)
        set_pev(iEntity, pev_movetype, MOVETYPE_BOUNCE)

        engfunc(EngFunc_SetSize, iEntity, Float:{-1.0, -1.0, -1.0}, Float:{1.0, 1.0, 1.0})
    }
    set_pev(iEntity, pev_nextthink, get_gametime() + 0.05)
}

/*==========================================
                 Создание парашута
===========================================*/
stock CreatePatashute(Float:fOrigin[3])
{
    new iEntity = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))

    set_pev(iEntity, pev_origin, fOrigin)
    set_pev(iEntity, pev_classname, gClassnamePara)

    set_pev(iEntity, pev_solid, SOLID_TRIGGER)
    set_pev(iEntity, pev_movetype, MOVETYPE_NONE)

    engfunc(EngFunc_SetModel, iEntity, gModels[2])
    engfunc(EngFunc_SetSize, iEntity, Float:{-1.0,-1.0,-1.0}, Float:{1.0,1.0,-1.0})
   
    return iEntity
}

/*==========================================
            Получение границы ская
===========================================*/
stock GetSkyOrigin(Float:fOrigin[3])
{
        while(engfunc(EngFunc_PointContents, fOrigin) == CONTENTS_EMPTY)
        {
        fOrigin[2] += 1.0

                if(engfunc(EngFunc_PointContents, fOrigin) == CONTENTS_SKY)
        {
            fOrigin[2] -= 40.0
            g_fSkyOrigin = fOrigin

            break
        }
        }
}

/*==========================================
        Соприкосновение с подарком
===========================================*/
public BoxTouchWorld(iEntity, iWorld)
{
    if(!pev_valid( iEntity ))
        return

    new szClassname[32]
    pev(iWorld, pev_classname, szClassname, charsmax( szClassname ))

    if(szClassname[0] == 'p')
    {
        if(zp_get_user_zombie(iWorld) || zp_get_user_nemesis(iWorld))
            return

        if(zp_get_user_survivor(iWorld) || zpnm_get_user_sniper(iWorld))
            return

        if(g_PresentFix[iEntity])
            return

        g_PresentSky[iEntity] = false
        g_PresentFix[iEntity] = true

        new szName[32]
        get_user_name(iWorld, szName, charsmax( szName ))

        client_print(0, print_center, "%L", LANG_PLAYER, "ZP_PRESENT_GIVE", szName)
        client_cmd(iWorld, "spk %s", gSounds[1])

        if(pev(iEntity, pev_iuser1))
        {
            set_pev(pev(iEntity, pev_iuser1), pev_flags, pev(pev(iEntity, pev_iuser1), pev_flags) | FL_KILLME)
            set_pev(iEntity, pev_iuser1, 0)
        }

        if(pev(iEntity, pev_iuser2))
        {
            set_pev(pev(iEntity, pev_iuser2), pev_flags, pev(pev(iEntity, pev_iuser2), pev_flags) | FL_KILLME)
            set_pev(iEntity, pev_iuser2, 0)
        }

        set_pev(iEntity, pev_flags, pev(iEntity, pev_flags) | FL_KILLME)
        RandomerItem(iWorld)
    }else{
        new Float:fVelocity[3]
        pev(iEntity, pev_velocity, fVelocity)
       
        fVelocity[0] *= 0.25
        fVelocity[1] *= 0.25
        fVelocity[2] *= 0.25

        set_pev(iEntity, pev_velocity, fVelocity)

        if(!pev(iEntity, pev_iuser2))
        {
            new Float:fOrigin[3]
            pev(iEntity, pev_origin, fOrigin)

            fOrigin[2] += 50.0

            new iSprite = CreateSprite(fOrigin)
            set_pev(iEntity, pev_iuser2, iSprite)
        }

        if(pev(iEntity, pev_iuser1))
        {
            set_pev(pev(iEntity, pev_iuser1), pev_flags, pev(pev(iEntity, pev_iuser1), pev_flags) | FL_KILLME)
            set_pev(iEntity, pev_iuser1, 0)
        }
    }
}

/*==========================================
            Создание спрайта дуели
===========================================*/
stock CreateSprite(Float:fOrigin[3])
{
    new iEntity = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))

    set_pev(iEntity, pev_origin, fOrigin)
    set_pev(iEntity, pev_classname, gClassnameSprite)

    set_pev(iEntity, pev_solid, SOLID_TRIGGER)
    set_pev(iEntity, pev_movetype, MOVETYPE_NONE)
    set_pev(iEntity, pev_scale, 0.5)

    engfunc(EngFunc_SetModel, iEntity, gModels[3])
    engfunc(EngFunc_SetSize, iEntity, Float:{-1.0,-1.0,-1.0}, Float:{1.0,1.0,-1.0})

    set_rendering(iEntity, kRenderFxNone, 0, 0, 0, kRenderTransAdd, 255)
    return iEntity
}

/*==========================================
                Рандомер
===========================================*/
public RandomerItem(id)
{
    new iRandom = random_num(1, 100)
    new iType

    if(zp_is_nemesis_round())
    {
        if(iRandom >= 96)
        {
            RandomerItem(id)
            return PLUGIN_CONTINUE
        }
    }

    switch( iRandom )
    {
        case 1..10:
        {
            iType = 1
        }

        case 11..95:
        {
            iType = 2
        }

        case 96..100:
        {
            iType = 3
        }
    }

    GiveItem(id, iType)
    return PLUGIN_CONTINUE
}

/*==========================================
            Рандомер предмета
===========================================*/
stock GiveItem(id, iType)
{
    if(iType == 3)
    {
        if(!zp_get_user_last_human(id))
        {
            zp_infect_user(id)
            return PLUGIN_CONTINUE
        }
    }
    new ammo_packs = random_num(1000, 5000)
       
    switch(random(24))
    {
        case 0:
        {
            //zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + ammo_packs)
            PrintChatColor(id, PRINT_COLOR_PLAYERTEAM + id, "!g[Подарки] !yТы !yнашёл в подарке !t%d$", ammo_packs)
        }
        case 1:
        {
            give_weapon_anaconda(id)                                                                                              
            give_item(id,"item_assaultsuit")
            PrintChatColor(id, PRINT_COLOR_PLAYERTEAM + id, "!g[Подарки] !yТы нашёл в подарке !tCV80 !yи 100 брони.")
        }                                
        case 2:
        {
            //give_bow(id)
            give_item(id,"item_assaultsuit")
            PrintChatColor(id, PRINT_COLOR_PLAYERTEAM + id, "!g[Подарки] !yТы нашёл в подарке !tBow !yи 100 брони.")
        }
        case 3:
        {
            //give_g11(id)
            PrintChatColor(id, PRINT_COLOR_PLAYERTEAM + id, "!g[Подарки] !yТы нашёл в подарке !tG11.")
        }
        case 4:
        {
            fm_give_item(id, "weapon_flashbang")
            PrintChatColor(id, PRINT_COLOR_PLAYERTEAM + id, "!g[Подарки] !yТы нашёл в подарке гранату Frost.")
        }
        case 5:
        {
            fm_give_item(id, "weapon_hegrenade")
            PrintChatColor(id, PRINT_COLOR_PLAYERTEAM + id, "!g[Подарки] !yТы нашёл в подарке гранату Fire.")
        }
        case 6:
        {
            fm_give_item(id, "weapon_smokegrenade")
            PrintChatColor(id, PRINT_COLOR_PLAYERTEAM + id, "!g[Подарки] !yТы нашёл в подарке гранату Flare.")
        }
        case 7:
        {
            fm_give_item(id, "weapon_hegrenade")
            fm_give_item(id, "weapon_flashbang")
            fm_give_item(id, "weapon_smokegrenade")
            PrintChatColor(id, PRINT_COLOR_PLAYERTEAM + id, "!g[Подарки] !yТы нашёл в подарке пак гранат.")
        }
        case 8:
        {
            //give_at4(id)
            PrintChatColor(id, PRINT_COLOR_PLAYERTEAM + id, "!g[Подарки] !yТы нашёл в подарке AT4.")
        }
        case 9:
        {
            //give_balrog3(id)
            PrintChatColor(id, PRINT_COLOR_PLAYERTEAM + id, "!g[Подарки] !yТы нашёл в подарке Balrog3.")
        }  
        case 10:
        {
            //give_balrog5(id)
            PrintChatColor(id, PRINT_COLOR_PLAYERTEAM + id, "!g[Подарки] !yТы нашёл в подарке Balrog5.")
        }  
        case 11:
        {
            //give_balrog11(id)
            PrintChatColor(id, PRINT_COLOR_PLAYERTEAM + id, "!g[Подарки] !yТы нашёл в подарке Balrog11.")
        }
        case 12:
        {
            //give_cartblue(id)
            PrintChatColor(id, PRINT_COLOR_PLAYERTEAM + id, "!g[Подарки] !yТы нашёл в подарке CartBlue.")
        }
        case 13:
        {
            //give_infinity(id)
            PrintChatColor(id, PRINT_COLOR_PLAYERTEAM + id, "!g[Подарки] !yТы нашёл в подарке Dual Infinity Final.")
        }
        case 14:
        {
            //give_janus1(id)
            PrintChatColor(id, PRINT_COLOR_PLAYERTEAM + id, "!g[Подарки] !yТы нашёл в подарке Janus1.")
        }
        case 15:
        {
            //give_janus7(id)
            PrintChatColor(id, PRINT_COLOR_PLAYERTEAM + id, "!g[Подарки] !yТы нашёл в подарке Janus7.")
        }
        case 16:
        {
            //give_m95(id)
            PrintChatColor(id, PRINT_COLOR_PLAYERTEAM + id, "!g[Подарки] !yТы нашёл в подарке M95.")
        }
        case 17:
        {
            //give_plasma(id)
            PrintChatColor(id, PRINT_COLOR_PLAYERTEAM + id, "!g[Подарки] !yТы нашёл в подарке PlasmaGun.")
        }
        case 18:
        {
            //give_skull3(id)
            PrintChatColor(id, PRINT_COLOR_PLAYERTEAM + id, "!g[Подарки] !yТы нашёл в подарке Skull3.")
        }
        case 19:
        {
            //give_skull4(id)
            PrintChatColor(id, PRINT_COLOR_PLAYERTEAM + id, "!g[Подарки] !yТы нашёл в подарке Skull4.")
        }
        case 20:
        {
            //give_spas12(id)
            PrintChatColor(id, PRINT_COLOR_PLAYERTEAM + id, "!g[Подарки] !yТы нашёл в подарке Spas12.")
        }
        case 21:
        {
            //give_spear(id)
            PrintChatColor(id, PRINT_COLOR_PLAYERTEAM + id, "!g[Подарки] !yТы нашёл в подарке Spear.")
        }
        case 22:
        {
            //give_triplebarrel(id)
            PrintChatColor(id, PRINT_COLOR_PLAYERTEAM + id, "!g[Подарки] !yТы нашёл в подарке TripleBarrel.")
        }
        case 23:
        {
            //give_chainsaw(id)
            PrintChatColor(id, PRINT_COLOR_PLAYERTEAM + id, "!g[Подарки] !yТы нашёл в подарке ChainSaw.")
        }
    }
    return PLUGIN_CONTINUE
}

/*==========================================
            Первоначальный запуск
===========================================*/
public zp_round_started(gamemode, id)
{
    if(g_TracerNum)
    {
        remove_task(525735)
        set_task(30.0, "GoVert", 525735)
    }
}

public zp_round_ended()
{
    if(g_TracerNum)
    {
        DeleteAllPresent()
        remove_task(525735)
    }
}

/*==========================================
                Запуск верта
===========================================*/
public GoVert()
{
    DeleteAllPresent()

    new iRandom = random_num(1, g_TracerNum)

    g_CreateSteps[iRandom][4] = true
    g_TracerGO = g_TracerStart[iRandom]
   
    CreateWert(g_TracerOrigin[g_TracerGO], g_TracerAngles[g_TracerGO], g_TracerAngleV[g_TracerGO], iRandom)
    client_print(0, print_center, "%L", LANG_PLAYER, "ZP_PRESENT_GO")
    client_cmd(0, "spk %s", gSounds[2])
    client_cmd(0, "spk %s", gSounds[0])
    set_task(60.0, "GoVert", 525735)
}

/*==========================================
            Удаление всего и вся
===========================================*/
public DeleteAllPresent()
{
    remove_entity_name(gClassname)
    remove_entity_name(gClassnameBox)
    remove_entity_name(gClassnameSprite)
    remove_entity_name(gClassnamePara)

    for(new i; i < 999; i++)
    {
        g_PresentSky[i] = false
        g_PresentFix[i] = false
    }
}

/*==========================================
                Дроп оружие
===========================================*/
stock strip_user_weapon(id, typew)
{
    new weapons[32], wpnum
    get_user_weapons(id, weapons, wpnum)
    for(new i; i <= wpnum; i++)
    {
        new wpnid = weapons[i]
        if((is_primary(wpnid) && typew == 2) || (is_pistol(wpnid) && typew == 1))
        {
            new wpname[32]
            get_weaponname(wpnid, wpname, 31)
            engclient_cmd(id, "drop", wpname)
        }
    }
}

/*==========================================
                Основное оружие
===========================================*/
stock is_primary(wpnid)
{
    if(wpnid != CSW_SCOUT && wpnid != CSW_XM1014 && wpnid != CSW_MAC10 && wpnid != CSW_AUG && wpnid != CSW_UMP45 && wpnid != CSW_SG550 && wpnid != CSW_GALIL && wpnid != CSW_FAMAS && wpnid != CSW_AWP && wpnid != CSW_MP5NAVY && wpnid != CSW_M249 && wpnid != CSW_M3 && wpnid != CSW_M4A1 && wpnid != CSW_TMP && wpnid != CSW_G3SG1 && wpnid != CSW_SG552 && wpnid != CSW_AK47 && wpnid != CSW_P90)
        return 0

    return 1
}

/*==========================================
                Второстеменное
===========================================*/
stock is_pistol(wpnid)
{
    if(wpnid != CSW_P228 && wpnid != CSW_ELITE && wpnid != CSW_FIVESEVEN && wpnid != CSW_USP && wpnid != CSW_GLOCK18 && wpnid != CSW_DEAGLE)
        return 0

    return 1
}

stock fm_give_item(id, const item[])
{
    new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item))
    if (!pev_valid(ent)) return;
   
    new Float:originF[3]
    pev(id, pev_origin, originF)
    set_pev(ent, pev_origin, originF)
    set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN)
    dllfunc(DLLFunc_Spawn, ent)
   
    new save = pev(ent, pev_solid)
    dllfunc(DLLFunc_Touch, ent, id)
    if (pev(ent, pev_solid) != save)
        return;
   
    engfunc(EngFunc_RemoveEntity, ent)
}

Я как понял надо ему зомби раунд


Код:
public zp_round_started(gamemode, id)
{
if(g_TracerNum)
{
remove_task(525735)
set_task(30.0, "GoVert", 525735)
}
}

public zp_round_ended()
{
if(g_TracerNum)
{
DeleteAllPresent()
remove_task(525735)
}
}
Что тогда надо поменять чтобы после рестарта сервера он начал работать где даже раунд не заканчивается ?
 
Последнее редактирование:
Сверху Снизу