Удаление оружий после смерти игрока

Aleksandros

Участник
Сообщения
202
Реакции
6
Здравствуйте, нужен плагин который бы удалял оружие после смерти игрока, но не трогал оружие которое вначале раунда уже находится на карте. Или как вариант наличие возможности отфильтровать оружие которое нужно удалять.

П.С. Пробовал ставить вот этот плагин, но он удаляет все подряд.

П.С. Нашел рабочий плагин, кто сможет в него таймер засунуть, что бы не сразу удалял, а через секунд 20?
 
Последнее редактирование:

DarklSide

Участник
Сообщения
931
Реакции
468
Num #1:
PHP:
#include <sdktools>
public Action:CS_OnCSWeaponDrop(client, index)if (IsClientInGame(client) && GetClientHealth(client) <= 0)CreateTimer(20.0, dellent, index, TIMER_FLAG_NO_MAPCHANGE);
public Action:dellent(Handle:timer, any:index) { if (IsValidEntity(index))AcceptEntityInput(index, "kill"); return Plugin_Stop; }

Num #2:
PHP:
#include <sdktools>
#define FTIME 20.0
//#define DROP // Drop => dell
new bool:b_round, bool:b_playerRound[MAXPLAYERS + 1];
public OnPluginStart()HookEvent("round_end", Event_OnRoundEnd, EventHookMode_PostNoCopy);
public Event_OnRoundEnd(Handle:event, const String:name[], bool:dontBroadcast)b_round = !b_round;
public Action:CS_OnCSWeaponDrop(client, index)
{
    if (IsClientInGame(client))
    {
        #if !defined DROP
        if (GetClientHealth(client) <= 0)
        {
            #endif
            b_playerRound[client] = b_round;
            new Handle:h_dentpack = INVALID_HANDLE;
            CreateDataTimer(FTIME, dellent, h_dentpack, TIMER_FLAG_NO_MAPCHANGE | TIMER_DATA_HNDL_CLOSE);
            WritePackCell(h_dentpack, client);
            WritePackCell(h_dentpack, index);
            ResetPack(h_dentpack);
            #if !defined DROP
        }
        #endif
    }
}
public Action:dellent(Handle:timer, Handle:h_dentpack)
{
    if (b_playerRound[ReadPackCell(h_dentpack)] == b_round)
    {
        new intp = ReadPackCell(h_dentpack);
        if (IsValidEntity(intp))AcceptEntityInput(intp, "kill");
    }
    return Plugin_Stop;
}

P.S.: №2 - если будет исчезать оружие в следующих раундах.
 

Жора

Участник
Сообщения
8
Реакции
0
Здравствуйте, нужен плагин который бы удалял оружие после смерти игрока, но не трогал оружие которое вначале раунда уже находится на карте. Или как вариант наличие возможности отфильтровать оружие которое нужно удалять.

П.С. Пробовал ставить вот этот плагин, но он удаляет все подряд.

П.С. Нашел рабочий плагин, кто сможет в него таймер засунуть, что бы не сразу удалял, а через секунд 20?

вот держи Посмотреть вложение weaponcleanup.sp
 

DJser

Участник
Сообщения
278
Реакции
15
есть плагин без таймера , 2-ая ссылка не работает
 

AlmazON

Не путать с самим yand3xmail
Сообщения
5,099
Реакции
2,755
плагин без таймера
PHP:
#include <sdktools>

public Action:CS_OnCSWeaponDrop(client, index)
{
	if (IsClientInGame(client) && GetClientHealth(client) < 1 && IsValidEntity(index)) AcceptEntityInput(index, "kill");
}
 

DJser

Участник
Сообщения
278
Реакции
15
PHP:
#include <sdktools>

public Action:CS_OnCSWeaponDrop(client, index)
{
    if (IsClientInGame(client) && GetClientHealth(client) < 1 && IsValidEntity(index)) AcceptEntityInput(index, "kill");
}
еслиб знал я куда это вставлять
 

DJser

Участник
Сообщения
278
Реакции
15
Последнее редактирование:

Aleksandros

Участник
Сообщения
202
Реакции
6
Num #1:
PHP:
#include <sdktools>
public Action:CS_OnCSWeaponDrop(client, index)if (IsClientInGame(client) && GetClientHealth(client) <= 0)CreateTimer(20.0, dellent, index, TIMER_FLAG_NO_MAPCHANGE);
public Action:dellent(Handle:timer, any:index) { if (IsValidEntity(index))AcceptEntityInput(index, "kill"); return Plugin_Stop; }

Num #2:
PHP:
#include <sdktools>
#define FTIME 20.0
//#define DROP // Drop => dell
new bool:b_round, bool:b_playerRound[MAXPLAYERS + 1];
public OnPluginStart()HookEvent("round_end", Event_OnRoundEnd, EventHookMode_PostNoCopy);
public Event_OnRoundEnd(Handle:event, const String:name[], bool:dontBroadcast)b_round = !b_round;
public Action:CS_OnCSWeaponDrop(client, index)
{
    if (IsClientInGame(client))
    {
        #if !defined DROP
        if (GetClientHealth(client) <= 0)
        {
            #endif
            b_playerRound[client] = b_round;
            new Handle:h_dentpack = INVALID_HANDLE;
            CreateDataTimer(FTIME, dellent, h_dentpack, TIMER_FLAG_NO_MAPCHANGE | TIMER_DATA_HNDL_CLOSE);
            WritePackCell(h_dentpack, client);
            WritePackCell(h_dentpack, index);
            ResetPack(h_dentpack);
            #if !defined DROP
        }
        #endif
    }
}
public Action:dellent(Handle:timer, Handle:h_dentpack)
{
    if (b_playerRound[ReadPackCell(h_dentpack)] == b_round)
    {
        new intp = ReadPackCell(h_dentpack);
        if (IsValidEntity(intp))AcceptEntityInput(intp, "kill");
    }
    return Plugin_Stop;
}

P.S.: №2 - если будет исчезать оружие в следующих раундах.


Перестал работать плагин N2. У кого то есть актуальная версия с такими же характеристиками как описано в первом посте?
 

qubka

Zombie Plague Разработчик
Сообщения
245
Реакции
244
Из моего мода (ZP) вытащил

PHP:
#include <sdktools>

#define DELETE_TIME     20.0

/**
 * Called once a client is authorized and fully in-game, and 
 * after all post-connection authorizations have been performed.  
 *
 * This callback is gauranteed to occur on all clients, and always 
 * after each OnClientPutInServer() call.
 * 
 * @param clientIndex        The client index. 
 **/
public void OnClientPostAdminCheck(int clientIndex)
{
    // Hook weapon events
    SDKHook(clientIndex, SDKHook_WeaponDropPost, WeaponsOnDropPost);
}

/**
 * Called after dropping of the weapon.
 *
 * @param clientIndex        The client index.
 * @param weaponIndex       The weapon index.
 **/
public Action WeaponsOnDropPost(int clientIndex, int weaponIndex)
{
    // Create timer if weapon is valid
    if(IsValidEdict(weaponIndex)) 
    {
        CreateTimer(DELETE_TIME, WeaponsRemoveDropedWeapon, weaponIndex, TIMER_FLAG_NO_MAPCHANGE);
    }
}

/**
 * Function for removing dropped weapon, from the ground.
 *
 * @param hTimer             The timer handle.
 * @param weaponIndex        The weapon index.
 **/
public Action WeaponsRemoveDropedWeapon(Handle hTimer, any weaponIndex)
{
    // If weapon isn't valid, then stop
    if(!IsValidEdict(weaponIndex))
    {
        return Plugin_Stop;
    }

    // If weapon without any owner, then delete it
    if(GetEntPropEnt(weaponIndex, Prop_Data, "m_pParent") == -1)
    {
        RemoveEdict(weaponIndex);
    }
   
    // Destroy timer
    return Plugin_Stop;
}
 

Aleksandros

Участник
Сообщения
202
Реакции
6
Из моего мода (ZP) вытащил

PHP:
#include <sdktools>

#define DELETE_TIME     20.0

/**
* Called once a client is authorized and fully in-game, and
* after all post-connection authorizations have been performed. 
*
* This callback is gauranteed to occur on all clients, and always
* after each OnClientPutInServer() call.
*
* @param clientIndex        The client index.
**/
public void OnClientPostAdminCheck(int clientIndex)
{
    // Hook weapon events
    SDKHook(clientIndex, SDKHook_WeaponDropPost, WeaponsOnDropPost);
}

/**
* Called after dropping of the weapon.
*
* @param clientIndex        The client index.
* @param weaponIndex       The weapon index.
**/
public Action WeaponsOnDropPost(int clientIndex, int weaponIndex)
{
    // Create timer if weapon is valid
    if(IsValidEdict(weaponIndex))
    {
        CreateTimer(DELETE_TIME, WeaponsRemoveDropedWeapon, weaponIndex, TIMER_FLAG_NO_MAPCHANGE);
    }
}

/**
* Function for removing dropped weapon, from the ground.
*
* @param hTimer             The timer handle.
* @param weaponIndex        The weapon index.
**/
public Action WeaponsRemoveDropedWeapon(Handle hTimer, any weaponIndex)
{
    // If weapon isn't valid, then stop
    if(!IsValidEdict(weaponIndex))
    {
        return Plugin_Stop;
    }

    // If weapon without any owner, then delete it
    if(GetEntPropEnt(weaponIndex, Prop_Data, "m_pParent") == -1)
    {
        RemoveEdict(weaponIndex);
    }
  
    // Destroy timer
    return Plugin_Stop;
}

Screenshot
 

Aleksandros

Участник
Сообщения
202
Реакции
6
Странно, плагин поставил, оружие убирает, а некоторые карты всеравно лагают... например mg_sonic_islands_v2 и mg_airmap_run_v2
 

AlmazON

Не путать с самим yand3xmail
Сообщения
5,099
Реакции
2,755
некоторые карты всеравно лагают
Если такой любитель удалять: Manual Cleaning Map.
Например: убираешь плагин удаления оружия и грузишь карту. Смотришь, насколько лагает. Дальше вводишь в чат: !cleanmap weapon_ (полный снос всего оружия) и снова проверяешь фризы. Если разницы не заметно, значит, плагин этой темы тебе вообще ни к чему. Оффтоп
 

qubka

Zombie Plague Разработчик
Сообщения
245
Реакции
244
Сервер слабый значит если фризит от моего кода, у меня на ноутбуке не фризит почти сервер и клиент одновременно запущенный да и еще поверх этого ZP
 
Сверху Снизу