Поиск Ищу плагин, который убирает оружие с карты

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
468
Реакции
249
Помог
6 раз(а)
Раньше (на HLDS и AMX 1.8.2) на карте cs_pf_dust после рестарта оставалось только по одному экземпляру каждого оружия. Сейчас же такая схема не работает. Находятся особо "догадливые" ребята, которые раскидывают это оружие по всему респу и начинает падать FPS. Нужен плагин, который будет убирать только то оружие, которое есть на карте по дефолту.
 
Сообщения
1,175
Реакции
2,144
Помог
57 раз(а)
CHEL74,
C++:
#include <amxmodx>
#include <engine>

public plugin_init() {
    new const szEntName[] = "armoury_entity"
    new iEnt = get_maxplayers()

    while((iEnt = find_ent_by_class(iEnt, szEntName))) {
        remove_entity(iEnt)
    }
}
 
Сообщения
400
Реакции
147
Помог
11 раз(а)
CHEL74,
C++:
/**
*    Modified by Safety1st
*      6/23/2015
*
*    Home post:
*      http://c-s.net.ua/forum/index.php?act=findpost&pid=591184
*
*    Changes are:
*    - added feature to exclude bomb from auto-removing
*    - added feature to include shield to auto-removing
*    - minor changes
*/

/**
*    The game itself remove dropped weapons after 5 minutes. It is too long time for servers with deathmatch mode.
*    Firstly weaponbox is created with its default model then the game assigns custom model to it
*    (model of the weapon it holds). The idea is simple: we catch custom model assigning and modify autoremoving time.
*    Unfortunately for shield it is not suitable because it doesn't receive custom model. Therefore we can't catch 'right' moment and
*    must use delay to definitely set our autoremoving time AFTER the game does.
*
*    See CSSDK\player.cpp (CBasePlayer::DropPlayerItem and CBasePlayer::DropShield) for more information.
*/

/*    Copyright © 2015  Safety1st

    Remove Dropped Weapons is free software;
    you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

#include <amxmodx>
#include <engine>
#include <fakemeta>

/*---------------EDIT ME------------------*/
#define WPN_REMOVE_TIME 10    // set auto-removing time
//#define EXCLUDE_BOMB        // uncomment to exclude bomb from auto-removing
//#define INCLUDE_SHIELD      // uncomment to include shield to auto-removing
/*----------------------------------------*/

#define PLUGIN "Remove Dropped Weapons"
#define AUTHOR "WPMG PRoSToTeM@ / Safety1st"
#define VERSION "0.13b"

#if defined EXCLUDE_BOMB
    #include <cstrike>
    new giStartEnt, giMaxEntities
#endif

#if defined INCLUDE_SHIELD
    static const gszWpnShieldClass[] = "weapon_shield"
    static szClassName[14]
#else
    static szClassName[10]
#endif

public plugin_init() {
    register_plugin( PLUGIN, VERSION, AUTHOR )

    register_forward( FM_SetModel, "SetModelPre", 0 )

#if defined EXCLUDE_BOMB
    giStartEnt = get_maxplayers() + 1
    giMaxEntities = global_get( glb_maxEntities )
#endif
}

public SetModelPre( const ent, const model[] ) {
    static const szWpnboxClass[] = "weaponbox"

    entity_get_string( ent, EV_SZ_classname, szClassName, charsmax(szClassName) )

    if( !strcmp( szClassName, szWpnboxClass ) ) {
        // it is a weaponbox
#if defined EXCLUDE_BOMB
            new i
            for( i = giStartEnt; i < giMaxEntities; i++ ) {
                // search for an entity that is owned by the weaponbox, this should be a weapon_* entity
                if( is_valid_ent(i) && entity_get_edict( i, EV_ENT_owner ) == ent ) {
                    if( cs_get_weapon_id(i) == CSW_C4 )
                        return
                    else
                        break
                }
            }
#endif
        entity_set_float( ent, EV_FL_nextthink, get_gametime() + WPN_REMOVE_TIME.0 )
    }
#if defined INCLUDE_SHIELD
    else if( !strcmp( szClassName, gszWpnShieldClass ) )
        set_task( 0.1, "ChangeNextThinkTime", ent )
#endif
}

#if defined INCLUDE_SHIELD
public ChangeNextThinkTime( const ent ) {
    /* 100 ms is too big time comparing with server FPS.
       So we must make sure that shield entity still exists. */
    if( is_valid_ent(ent) ) {
        entity_get_string( ent, EV_SZ_classname, szClassName, charsmax(szClassName) )
        if( !strcmp( szClassName, gszWpnShieldClass ) )
            entity_set_float( ent, EV_FL_nextthink, get_gametime() + WPN_REMOVE_TIME.0 )
    }
}
#endif
C#:
Настройки - в исходнике:
• WPN_REMOVE_TIME - через сколько секунд удалить оружие; по дефолту 10, 0 - сразу;
• EXCLUDE_BOMB - раскомментировать, чтобы дропнутая бомба не удалялась; имеет смысл включать только на серверах, где она выдаётся;
• INCLUDE_SHIELD - раскомментировать, чтобы дропнутый щит удалялся; имеет смысл включать только на серверах, где игроки могут его получить.
 
Сообщения
2,491
Реакции
2,790
Помог
61 раз(а)
CHEL74, можна пример видеозапись. Если я верно понял, то нужно чистить карту после смены раунда.
 
Сообщения
468
Реакции
249
Помог
6 раз(а)
BlackSignature, спасибо, поставил. Протестирую, когда игроков на сервере не будет, либо когда номинируем.
Izmayl7, спасибо, буду иметь на примете)
fantom, могу демку HLTV скинуть вам.
 
Сообщения
468
Реакции
249
Помог
6 раз(а)
Прошло время, набрался немного опыта и понял, что проблему можно решить по-другому, даже не убирая оружие полностью и вообще без плагина. Напишу тут, может быть кому-то пригодится, кто пользуется этой картой.

Нужно всего-лишь открыть cs_pf_dust.bsp в программе BSPEdit и найти все armory_entity (это и есть оружия, лежащие на карте):
Код:
{
"origin" "160 960 -1888"
"item" "2"
"count" "100"
"classname" "armoury_entity"
}
{
"origin" "288 -1056 -1904"
"count" "100"
"classname" "armoury_entity"
}
{
"origin" "512 -992 -1904"
"item" "6"
"count" "100"
"classname" "armoury_entity"
}
{
"origin" "320 1152 -1904"
"item" "4"
"count" "100"
"classname" "armoury_entity"
}
{
"origin" "512 1056 -1904"
"item" "5"
"count" "100"
"classname" "armoury_entity"
}
{
"origin" "288 -896 -1904"
"item" "11"
"count" "100"
"classname" "armoury_entity"
}
Где origin - координаты, на которых лежит оружие, где item - айди оружия, а где count - количество.
Как можно заметить, везде по сотне. Просто ставим там "1", либо вообще убираем все armory_entity, если оружие на карте не нужно. Ошибок у клиентов со старой версией карты не будет.
На всякий случай:
0: "weapon_mp5navy"
1: "weapon_tmp"
2: "weapon_p90"
3: "weapon_mac10"
4: "weapon_ak47"
5: "weapon_sg552"
6: "weapon_m4a1"
7: "weapon_aug"
8: "weapon_scout"
9: "weapon_g3sg1"
10: "weapon_awp"
11: "weapon_m3"
12: "weapon_xm1014"
13: "weapon_m249"
14: "weapon_flashbang"
15: "weapon_hegrenade"
16: "item_kevlar"
17: "item_assaultsuit"
18: "weapon_smokegrenade"
 
Статус
В этой теме нельзя размещать новые ответы.

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу