0%
Обязательно ознакомьтесь с правилами форума!
Требуются люди в Команду форума для наполнения сайта ресурсами и полезным контентом. Писать в Telegram: @g_r_e_a_t_z_a_r_a_z_a
Чат для серверодержателей CS 1.6

Чат для серверодержателей Counter-Strike 1.6 а так же владельцев сайтов на движке GameCMS

Сообщество администраторов, разработчиков и владельцев серверов

GameCMS обсуждение Разработка плагинов Администрирование Опытные специалисты Безопасность и оптимизация
Чат помощи XenForo

Чат помощи по XenForo

Вопросы и обсуждения · Реклама · Услуги · Исполнители

XenForo помощь Услуги и исполнители Обсуждение движка Реклама проектов Разработка дополнений
Рекламное место

Рекламное место свободно

Разместите свою рекламу прямо здесь!

Активная аудитория Высокая конверсия Доступная цена Эффективная реклама
Bonus Platform

CS 1.6 Amxx Bonus Platform 3.5

Бонусные платформы на ваш сервер
Код:
#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <hamsandwich>
#include <cstrike>
#include <xs>

#define PLUGIN_NAME    "BONUS PLATFORM"
#define PLUGIN_VERSION    "3.5"
#define PLUGIN_AUTHOR    "AnonymousAmx ( aka g3cKpunTop | vk/krisiso ) | MayroN"

#define pev_smoke                pev_fuser2
#define pev_uptime                pev_fuser1

#define CLNAME_PLATFORM            "info_target"
#define CLNAME_PLATFORM_CUSTOM    "ent_platform"

enum _:eData_PlatformType
{
    PlatformType_None = 0,
    PlatformType_Health,
    PlatformType_Armor,
    PlatformType_LongJump,
    PlatformType_Ammo,
};

new const g_szModelDir[] = "models/bonus_platform/bonus_platform_2.mdl";

new const g_szSoundTake[eData_PlatformType][] =
{
    "",
    "bonus_platform/bonus_health.wav",
    "bonus_platform/bonus_armor.wav",
    "bonus_platform/bonus_longjump.wav",
    "bonus_platform/bonus_ammo.wav",
};

#define LONG_JUMP        4.0        // Время Большого прыжка

const LONG_JUMP_REMOVE = 0xA443;

new bool:LongJump[MAX_PLAYERS + 1] = false;

new const LIMIT_HEALTH = 120;         // Лимит Здоровья
new const LIMIT_ARMOR = 200;        // Лимит Брони

new const Float:g_fUpdatePlatform = 35.0;    // Сколько секунд до восстановления бонуса на Платформе

new const g_iBlinkColor[eData_PlatformType][4] =
{
    { 0,0,0 },       
    { 255,0,0 },        // Screenfade для здоровья ( цвет в формате RGB )
    { 0,0,255 },        // Screenfade для брони ( цвет в формате RGB )
    { 255,255,0 },        // Screenfade для Большого прыжка ( цвет в формате RGB )
    { 118,118,118 },    // Screenfade для Бесконечных патронов ( цвет в формате RGB )
};
    
new const Float:g_fSizeMins[3] = { -1.0,-1.0,-1.0 };       
new const Float:g_fSizeMaxs[3] = { 1.0, 1.0, 1.0 };

new Float: cl_pushangle[MAX_PLAYERS + 1][3]   

const WEAPONS_BITSUM = (1<<CSW_KNIFE|1<<CSW_HEGRENADE|1<<CSW_FLASHBANG|1<<CSW_SMOKEGRENADE|1<<CSW_C4|1<<CSW_GLOCK)
 
#if cellbits == 32
const OFFSET_CLIPAMMO = 51
#else
const OFFSET_CLIPAMMO = 65
#endif
const OFFSET_LINUX_WEAPONS = 4
 
new const MAXCLIP[] = { -1, 13, -1, 10, 1, 7, -1, 30, 30, 1, 30, 20, 25, 30, 35, 25, 12, 20,
         10, 30, 100, 8, 30, 30, 20, 2, 7, 30, 30, -1, 50 }

new g_has_unlimited_clip[MAX_PLAYERS + 1]

new const g_iBody[eData_PlatformType] = { 0, 1, 2, 4, 5};

new g_pSpriteColorField[4];

enum _:eTime   
{
        Plural, Singular, Nominative
};

new szTime2[eTime][] =
{
    "минут", "минуты", "минуту"
};

new szTime[eTime][] =
{
    "секунд", "секунды", "секунду"
};

public plugin_init()
{
    register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
    
    RegisterHam(Ham_Player_Jump, "player", "Player_Jump");
    RegisterHam(Ham_Killed, "player", "Killed_Hook_Jump");

    register_touch(CLNAME_PLATFORM_CUSTOM, "player", "PlatformTouch")
    register_think(CLNAME_PLATFORM_CUSTOM, "PlatformThink");

       register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
 
       new weapon_name[24]
       for (new i = 1; i <= 30; i++)
       {
              if (!(WEAPONS_BITSUM & 1 << i) && get_weaponname(i, weapon_name, 23))
              {
                 RegisterHam(Ham_Weapon_PrimaryAttack, weapon_name, "fw_Weapon_PrimaryAttack_Pre")
                 RegisterHam(Ham_Weapon_PrimaryAttack, weapon_name, "fw_Weapon_PrimaryAttack_Post", 1)
              }
       }
    
    register_clcmd("platform", "Create_Platform");
}

public plugin_precache()
{
    precache_model(g_szModelDir);

    for(new i; i < sizeof(g_szSoundTake); i++)
        if (g_szSoundTake[i][0])    precache_sound(g_szSoundTake[i]);
    
    g_pSpriteColorField[0] = precache_model("sprites/bonus_platform/smoke_health.spr");
    g_pSpriteColorField[1] = precache_model("sprites/bonus_platform/smoke_armor.spr");
    g_pSpriteColorField[2] = precache_model("sprites/bonus_platform/smoke_longjump.spr");
    g_pSpriteColorField[3] = precache_model("sprites/bonus_platform/smoke_ammo.spr");
}

public plugin_cfg()
{
    new szFile[128], szMapName[32];
    get_localinfo("amxx_datadir", szFile, charsmax(szFile));
    add(szFile, charsmax(szFile), "/bonus_platform");
    if(!dir_exists(szFile)) { mkdir(szFile); }
    get_mapname(szMapName, charsmax(szMapName));
    add(szFile, charsmax(szFile), fmt("/%s.txt", szMapName));
    if(!file_exists(szFile)) { return; }
    new szOrigin[3][8], szBuffer[8 * 3 + 5], iLine, iMaxLen, Float:vecOrigin[3];
    while(read_file(szFile, iLine++, szBuffer, charsmax(szBuffer), iMaxLen))
    {
        if(!szBuffer[0]) { continue; }
        parse(szBuffer,
            szOrigin[0], charsmax(szOrigin[]),
            szOrigin[1], charsmax(szOrigin[]),
            szOrigin[2], charsmax(szOrigin[])
        );

        vecOrigin[0] = str_to_float(szOrigin[0]);
        vecOrigin[1] = str_to_float(szOrigin[1]);
        vecOrigin[2] = str_to_float(szOrigin[2]);
        bp_create_platform(vecOrigin);
    }
}

public plugin_end()
{
    new szFile[128], szMapName[35];
    get_localinfo("amxx_datadir", szFile, charsmax(szFile));
    add(szFile, charsmax(szFile), "/bonus_platform");
    if(!dir_exists(szFile)) { mkdir(szFile); }
    get_mapname(szMapName, charsmax(szMapName));
    add(szFile, charsmax(szFile), fmt("/%s.txt", szMapName));
    if(file_exists(szFile)) { delete_file(szFile); }
    
    new iEntity = FM_NULLENT, Float:vecOrigin[3];
    while((iEntity = find_ent_by_class(iEntity, CLNAME_PLATFORM_CUSTOM)))
    {
        if(!pev_valid(iEntity))    continue;
        
        pev(iEntity, pev_origin, vecOrigin);
        write_file(szFile, fmt("%f %f %f", vecOrigin[0], vecOrigin[1], vecOrigin[2]), -1);
    }
}

public Create_Platform(pId)
{
    if(!(get_user_flags(pId) & ADMIN_RCON))
    {
        client_print(pId, print_center, "У Вас нет доступа для создания платформы")
        return PLUGIN_HANDLED;
    }

    ShowMenu_PlatformSetting(pId);
    return PLUGIN_CONTINUE;
}

public ShowMenu_PlatformSetting(pId)
{
    if(!is_user_connected(pId))
        return PLUGIN_HANDLED;

    new szNum[2], hMenu = bp_create_menu("HandleMenu_PlatformSetting", "\yБонус платформа");

    (szNum[0] = 1, menu_additem(hMenu, "Создать платформу", szNum));
    (szNum[0] = 2, menu_additem(hMenu, "Удалить платформу", szNum));
    
    Menu_SetRussian(hMenu, "Выход");
    return menu_display(pId, hMenu, 0);
}

public HandleMenu_PlatformSetting(pId, hMenu, iItem)
{
    if(iItem == MENU_EXIT)
    {
        menu_destroy(hMenu);
        return PLUGIN_HANDLED;
    }
    
    new szData[3];
    menu_item_getinfo(hMenu, iItem, _, szData, charsmax(szData));
    menu_destroy(hMenu);
    
    switch(szData[0])
    {
        case 1:
        {
            new Float:vecOrigin[3];
            fm_get_aiming_position(pId, vecOrigin);
            vecOrigin[2] += 23.0;
            if(!isObjectInvalidOrigin(vecOrigin, 0, 22.0)) { bp_create_platform(vecOrigin); }
            else { client_print_color(pId, print_team_default, "^4[ Бонус платформа ] ^3Обьект можно установить только на земле !"); }
        }
        case 2:
        {
            new Float:vecOrigin[3], iHit = FM_NULLENT;
            fm_get_aiming_position(pId, vecOrigin, iHit);
            if(isEntityClassName(iHit, CLNAME_PLATFORM_CUSTOM)) { killObject(iHit); }
            else {
                iHit = FM_NULLENT;
                while((iHit = find_ent_in_sphere(iHit, vecOrigin, 32.0)))
                {
                    if(isEntityClassName(iHit, CLNAME_PLATFORM_CUSTOM)) { killObject(iHit); break; }
                }
            }
        }
    }
    
    return ShowMenu_PlatformSetting(pId);
}

public PlatformTouch(iEntity, id)
{
    if(!pev_valid(iEntity) || !is_user_alive(id))
        return;
    
    if(pev(iEntity, pev_fuser3) > get_gametime())   
        return;
    
    new iType;   
    switch(iType = pev(iEntity, pev_iuser1))
    {
        case PlatformType_None:   
        {
            if(pev(iEntity, pev_uptime) > get_gametime())
            {
                set_pev(iEntity, pev_fuser3, get_gametime() + 0.5);
                
                new fTime = floatround(pev(iEntity, pev_uptime) - get_gametime());
                new iMin, iSec;    get_minutes(fTime, iMin, iSec);
                
                if(iMin)   
                {
                    client_print_color(id, print_team_default, "^4Бонус появиться через ^3%d %s %d %s", iMin, szTime2[get_numerical_noun_form(iMin)], iSec, szTime[get_numerical_noun_form(iSec)]);
                }
                else   
                {
                    client_print_color(id, print_team_default, "^4Бонус появиться через ^3%d %s", fTime, szTime[get_numerical_noun_form(fTime)]);
                }
            }
        }
        case PlatformType_Health:
        {
            if(pev(id, pev_health) >= LIMIT_HEALTH)
            {
                client_print(id, print_center, "У Вас Максимум Здоровья");
                set_pev(iEntity, pev_fuser3, get_gametime() + 0.5);
                return;
            }
            else
            {
                new iNum = random_num(50, 100);
                set_pev(id, pev_health, float(min(pev(id, pev_health) + iNum, LIMIT_HEALTH)));
                
                client_print(id, print_center, "Вы Взяли %d %% Здоровья", iNum);
                client_cmd(id,"spk %s",g_szSoundTake[PlatformType_Health]);
            }
        }
        case PlatformType_Armor:
        {
            if(pev(id, pev_armorvalue) >= LIMIT_ARMOR)
            {
                client_print(id, print_center, "У Вас Максимум Брони");
                set_pev(iEntity, pev_fuser3, get_gametime() + 0.5);
                return;
            }
            else
            {
                new iNum = random_num(50, 100);
                set_pev(id, pev_armorvalue, float(min(pev(id, pev_armorvalue) + iNum, LIMIT_ARMOR)));       
                client_print(id, print_center, "Вы Взяли %d %% Брони", iNum);
                client_cmd(id,"spk %s",g_szSoundTake[PlatformType_Armor]);
            }
        }
        case PlatformType_LongJump:
        {
            if(LongJump[id])
            {
                client_print(id, print_center, "У Вас уже есть Большой прыжок");
                set_pev(iEntity, pev_fuser3, get_gametime() + 0.5);
                return;
            }
            else
            {
                LongJump[id] = true;

                Player_Jump(id);
                Icon_LongJump(id);

                client_print(id, print_center, "Вы Взяли Большой прыжок на %.0f секунд.", LONG_JUMP);
                client_cmd(id,"spk %s",g_szSoundTake[PlatformType_LongJump]);

                set_task(LONG_JUMP, "Delete_LongJump", id + LONG_JUMP_REMOVE);
            }
        }
        case PlatformType_Ammo:
        {
            if(g_has_unlimited_clip[id])
            {
                client_print(id, print_center, "Больше нельзя взять Свободную стрельбу");
                set_pev(iEntity, pev_fuser3, get_gametime() + 0.5);
            }
             else
            {
                g_has_unlimited_clip[id] = true
                client_print(id, print_center, "Вы Взяли Свободную стрельбу");
                client_cmd(id,"spk %s",g_szSoundTake[PlatformType_Ammo]);
            }
        }       
    }
    
    if (iType != PlatformType_None)
    {
        UTIL_ScreenFade(id, (1<<10), (1<<10), 0, g_iBlinkColor[iType][0], g_iBlinkColor[iType][1], g_iBlinkColor[iType][2], 75);
        
        set_pev(iEntity, pev_body, g_iBody[PlatformType_None]);   
        set_pev(iEntity, pev_iuser1, PlatformType_None);
        set_pev(iEntity, pev_uptime, get_gametime() + g_fUpdatePlatform);
    }
    
    set_pev(iEntity, pev_fuser3, get_gametime() + 1.0);
}

public PlatformThink(iEntity)
{
    if(!pev_valid(iEntity))
        return;
    
    switch(pev(iEntity, pev_iuser1))   
    {
        case PlatformType_None:   
        {
            if(pev(iEntity, pev_uptime) < get_gametime())
            {
                new iRandom = random_num(PlatformType_Health, eData_PlatformType - 1);
                set_pev(iEntity, pev_body, g_iBody[iRandom]);
                set_pev(iEntity, pev_iuser1, iRandom);
                set_pev(iEntity, pev_uptime, get_gametime() + g_fUpdatePlatform);
            }
        }
        default:   
        {
            if(pev(iEntity, pev_smoke) < get_gametime())   
            {
                set_pev(iEntity, pev_smoke, get_gametime() + 0.5);

                new Float:vecOrigin[3];    pev(iEntity, pev_origin, vecOrigin);
                Create_TE_FIREFIELD(vecOrigin, 2, g_pSpriteColorField[pev(iEntity, pev_iuser1) - 1], 1, TEFIRE_FLAG_ALLFLOAT | TEFIRE_FLAG_ALPHA, 10 );
            }
        }
    }
    
    set_pev(iEntity, pev_nextthink, get_gametime() + 0.1);
}

public Player_Jump(id)
{
        if(is_user_alive(id))
        {
        if(LongJump[id])
        {
            if((pev(id, pev_button) & IN_JUMP) && (pev(id, pev_flags) & FL_ONGROUND))
            {
                set_speed(id, 500.0)

                static Float:velocity[3]
                pev(id, pev_velocity, velocity)

                velocity[2] = 800 / 3.0

                if((pev(id, pev_button) & (IN_LEFT|IN_RIGHT)))
                {
                    velocity[0] *= -1
                    velocity[1] *= -1
                }

                set_pev(id, pev_velocity, velocity)
            }
        }
    }
}

public Delete_LongJump(id)
{
    id -= LONG_JUMP_REMOVE;

    if(!is_user_connected(id))
    {
        remove_task(id + LONG_JUMP_REMOVE);
        return;
    }

    LongJump[id] = false;

    client_print(id, print_center, "Время Большого прыжка истекло!");
}

public fw_Weapon_PrimaryAttack_Pre(entity)
{
       new id = pev(entity, pev_owner)
 
    if (g_has_unlimited_clip[id])
        pev(id, pev_punchangle, cl_pushangle[id])

       return HAM_IGNORED;
}
 
public fw_Weapon_PrimaryAttack_Post(entity)
{
       new id = pev(entity, pev_owner)
 
       if (!g_has_unlimited_clip[id])
        return HAM_IGNORED

    new Float: push[3]
    pev(id, pev_punchangle, push)
    xs_vec_sub(push, cl_pushangle[id], push)
    xs_vec_mul_scalar(push, 0.0, push)
    xs_vec_add(push, cl_pushangle[id], push)
    set_pev(id, pev_punchangle, push)
    set_pdata_int(entity, 51, MAXCLIP[get_pdata_int(entity, 43, 4)], 4)

    return HAM_IGNORED;
}

public Killed_Hook_Jump(iVictim, iKiller, iShouldGIB)
{
    if(!is_user_connected(iVictim) || is_user_alive(iVictim))
        return HAM_IGNORED;

    LongJump[iVictim] = false;
    remove_task(iVictim + LONG_JUMP_REMOVE);

    return HAM_HANDLED;
}

stock bp_create_platform(Float:vecOrigin[3])
{
    static iszPlatform; new iEntity;

    if(iszPlatform || (iszPlatform = engfunc(EngFunc_AllocString, CLNAME_PLATFORM)))
    {
        iEntity = engfunc(EngFunc_CreateNamedEntity, iszPlatform);
    }

    if(!iEntity || !pev_valid(iEntity)) { return 0; }

    engfunc(EngFunc_SetSize, iEntity, Float:g_fSizeMins, Float:g_fSizeMaxs);
    engfunc(EngFunc_SetModel, iEntity, g_szModelDir);
    engfunc(EngFunc_SetOrigin, iEntity, vecOrigin);
    set_pev(iEntity, pev_classname, CLNAME_PLATFORM_CUSTOM);
    
    set_pev(iEntity, pev_body, g_iBody[PlatformType_None]);
    
    set_pev(iEntity, pev_movetype, MOVETYPE_TOSS);
    set_pev(iEntity, pev_solid, SOLID_TRIGGER);
    
    set_pev(iEntity, pev_sequence, 0);
    set_pev(iEntity, pev_gaitsequence, 1);
    set_pev(iEntity, pev_framerate, 1.0);
    
    set_pev(iEntity, pev_iuser1, PlatformType_None);
    set_pev(iEntity, pev_uptime, get_gametime() + g_fUpdatePlatform);
    
    set_pev(iEntity, pev_smoke, get_gametime() + 1.0);
    set_pev(iEntity, pev_nextthink, get_gametime() + 1.0);
    
    engfunc(EngFunc_DropToFloor, iEntity);

    return iEntity;
}

stock Menu_SetRussian(hMenu, szExitName[])
{
    menu_setprop(hMenu, MPROP_NUMBER_COLOR, "\r");
    menu_setprop(hMenu, MPROP_NEXTNAME, "Далее");
    menu_setprop(hMenu, MPROP_BACKNAME, "Назад");
    menu_setprop(hMenu, MPROP_EXITNAME, szExitName);
}

stock bp_create_menu(szHandle[], szTitle[], any:...)
{
    new szBuffer[512], iLen;   
    if(numargs() > 2) vformat(szBuffer[iLen], charsmax(szBuffer) - iLen, szTitle, 3);
    else copy(szBuffer[iLen], charsmax(szBuffer) - iLen, szTitle);
    return menu_create(szBuffer, szHandle);
}

stock killObject(iEntity)
{
    if(pev_valid(iEntity))
    {
        set_pev(iEntity, pev_flags, pev(iEntity, pev_flags) | FL_KILLME);
        set_pev(iEntity, pev_nextthink, get_gametime());
    }
}

stock Create_TE_FIREFIELD( Float:vecOrigin[3], radius, iSprite, count, flags, duration )
{
    message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
    write_byte(TE_FIREFIELD);
    write_coord_f(vecOrigin[0]);
    write_coord_f(vecOrigin[1]);
    write_coord_f(vecOrigin[2] + 15.0);
    write_short(radius);
    write_short(iSprite);
    write_byte(count);
    write_byte(flags);
    write_byte(duration);
    message_end();
}

stock UTIL_ScreenFade(pPlayer = 0, iDuration = ( 1<<12 ), iHoldTime = ( 1<<12 ), iFlags = 0, iRed = 255, iGreen = 255, iBlue = 255, iAlpha = 200)
{
    static iMsgId_ScreenFade;
    if( iMsgId_ScreenFade || (iMsgId_ScreenFade = get_user_msgid("ScreenFade")) )
    {
        message_begin(MSG_ONE, iMsgId_ScreenFade, _, pPlayer);           
        write_short(iDuration);
        write_short(iHoldTime);
        write_short(iFlags);
        write_byte(iRed);
        write_byte(iGreen);
        write_byte(iBlue);
        write_byte(iAlpha);
        message_end();
    }
}

stock fm_get_aiming_position(pPlayer, Float:vecReturn[3], &iHit = 0, Float:fMaxDistance = 8192.0)
{
    new Float:vecOrigin[3], Float:vecViewOfs[3], Float:vecAngle[3], Float:vecForward[3];
    pev(pPlayer, pev_origin, vecOrigin);
    pev(pPlayer, pev_view_ofs, vecViewOfs);
    xs_vec_add(vecOrigin, vecViewOfs, vecOrigin);
    pev(pPlayer, pev_v_angle, vecAngle);
    engfunc(EngFunc_MakeVectors, vecAngle);
    global_get(glb_v_forward, vecForward);
    xs_vec_mul_scalar(vecForward, fMaxDistance, vecForward);
    xs_vec_add(vecOrigin, vecForward, vecForward);
    engfunc(EngFunc_TraceLine, vecOrigin, vecForward, DONT_IGNORE_MONSTERS, pPlayer, 0);
    get_tr2(0, TR_vecEndPos, vecReturn);
    iHit = get_tr2(0, TR_pHit);
}

get_minutes(const iInSecond, &iOutMin, &iOutSec)
{
    #define SECONDS_IN_MINUTE    60

    iOutMin = iInSecond / SECONDS_IN_MINUTE;
    iOutSec = iInSecond % SECONDS_IN_MINUTE;
}

stock get_numerical_noun_form(iNum)
{
        if(iNum > 10 && ((iNum % 100) / 10) == 1)
            return Plural;                   

    switch (iNum % 10)
    {
            case 1: return Nominative;       
            case 2, 3, 4: return Singular;   
        }

        return Plural;                       
}

stock bool:isObjectInvalidOrigin(Float:vecObjectOrigin[3], iEntity = 0, Float:fZ = 36.0)
{
    new Float:vecOrigin[3], i;
    
    for(i = 0; i < 3; i++) { vecOrigin[i] = vecObjectOrigin[i]; }
    if(engfunc(EngFunc_PointContents , vecObjectOrigin) != CONTENTS_EMPTY)
        { return true; }
    
    new Float:vecMins[3];

    if(iEntity == 0) {vecMins[0] = g_fSizeMins[0]; vecMins[1] = g_fSizeMins[1]; vecMins[2] = -fZ;}
    else pev(iEntity, pev_mins, vecMins);
    
    for(i = 0; i < 3; i++) { vecOrigin[i] += vecMins[i]; }

    if(engfunc(EngFunc_PointContents, vecObjectOrigin) != CONTENTS_EMPTY || !checkTraceLineSolid(vecObjectOrigin, vecOrigin, iEntity))
        { return true; }
    
    for(i = 0; i < 3; i++) { vecOrigin[i] = vecObjectOrigin[i]; }

    new Float:vecMaxs[3];
    if(iEntity == 0) { vecMaxs[0] = g_fSizeMaxs[0]; vecMaxs[1] = g_fSizeMaxs[1]; vecMaxs[2] = fZ; }
    else pev(iEntity, pev_maxs, vecMaxs);
    
    for(i = 0; i < 3; i++) { vecOrigin[i] += vecMaxs[i]; }
    if(engfunc(EngFunc_PointContents, vecObjectOrigin) != CONTENTS_EMPTY || !checkTraceLineSolid(vecObjectOrigin, vecOrigin, iEntity))
        { return true; }
    
    vecOrigin[2] += 35.0;
    if(engfunc(EngFunc_PointContents, vecOrigin) != CONTENTS_EMPTY || !checkTraceLineSolid(vecObjectOrigin, vecOrigin, iEntity))
        { return true; }
        
    return false;
}

stock bool:checkTraceLineSolid(Float:vecStartOrigin[3], Float:vecEndOrigin[3], ignore = 0)
{
    engfunc(EngFunc_TraceLine, vecStartOrigin, vecEndOrigin, DONT_IGNORE_MONSTERS, ignore, 0);
    new Float:fFraction; get_tr2(0, TR_flFraction, fFraction);
    if(fFraction != 1.0) { return false; }
    return true;
}

stock bool:isEntityClassName(iEntity, szClassName[])
{
    if(!pev_valid(iEntity)) { return false; }

    new szCurrentClassName[40];
    pev(iEntity, pev_classname, szCurrentClassName, charsmax(szCurrentClassName));
    return bool:equal(szCurrentClassName, szClassName);
}

stock set_speed(ent, Float:speed)
{
    if(!pev_valid(ent))
        return;

    static Float:vangle[3], Float:new_velo[3], Float:y, Float:x
    if(ent<=get_maxplayers())
    {
        pev(ent,pev_v_angle,vangle)
    }

    pev(ent,pev_velocity,new_velo)

    y = new_velo[0]*new_velo[0] + new_velo[1]*new_velo[1]
    if(y) x = floatsqroot(speed*speed / y)

    new_velo[0] *= x
    new_velo[1] *= x

    if(speed<0.0)
    {
        new_velo[0] *= -1
        new_velo[1] *= -1
    }

    set_pev(ent,pev_velocity,new_velo)
}

stock Icon_LongJump(client)
{
    static msgid_itempickup;

    if(!msgid_itempickup)
        msgid_itempickup = get_user_msgid("ItemPickup");

    message_begin(MSG_ONE, msgid_itempickup, _, client);
    write_string("item_longjump");
    message_end();
}

stock fm_set_entity_visibility(entity, visible = 1)
{
    entity_set_int(entity, EV_INT_effects, visible == 1 ? entity_get_int(entity, EV_INT_effects) & ~EF_NODRAW : entity_get_int(entity, EV_INT_effects) | EF_NODRAW);
    return 1;
}

public client_disconnected(id)
{
    LongJump[id] = false;
    g_has_unlimited_clip[id] = false;
}

public event_round_start()
{
    arrayset(g_has_unlimited_clip, false, sizeof(g_has_unlimited_clip));
}
Верх Низ