[REAPI HELP] Block stripping of weapons on weapon specific maps

Сообщения
20
Реакции
1
Hey,
On maps like awp_india if I give some weapon to player via hasrestrictitem it is removed by map as map strips every weapon and gives awp. How to block that stripping making me to give player the weapon I wish to
 
Сообщения
1,293
Реакции
2,294
Помог
57 раз(а)
Try this code. Not tested, but i think this should block map strip + map equip (then you need equip players manually by custom plugin)
Код:
#include <amxmodx>
#include <engine>

public plugin_init()
{
	new iEnt, iMaxPlayers = get_maxplayers()
	if((iEnt = find_ent_by_class(iMaxPlayers, "player_weaponstrip")))
		remove_entity(iEnt)
	if((iEnt = find_ent_by_class(iMaxPlayers, "game_player_equip")))
		remove_entity(iEnt)
}
 
Сообщения
1,293
Реакции
2,294
Помог
57 раз(а)
ishchhabra, hm... On my server i remove map equip + map strip and allways equip players via plugin. I think you can do it too. when need, give custom gun, then (again, when need) change to normal behavior, and give standart equip (awp, knife, etc.). On hlds equip via plugin, - better way, cuz map equip sometime may crash server or at least drop all players. I do not know if the rehlds is affected by this issue, and therefore i continue to use plugin equip, - it's save and simple :)
 
Последнее редактирование:
Сообщения
1,293
Реакции
2,294
Помог
57 раз(а)
ishchhabra,
Код:
enum // Equip Modes
{
    EQUIP_AWP,
    EQUIP_AIM_AK_COLT,
    EQUIP_AIM_DUST,
    EQUIP_COSTOM
}

new g_iEquipType

public plugin_init()
{
    new szMapName[32]; get_mapname(szMapName, charsmax(szMapName))
    switch(szMapName[0])
    {
        case 'a':
        {
            if(equali(szMapName, "awp_", 4)) // all awp_ maps equip us with awp. One pattern -> one equip type
                g_iEquipType = EQUIP_AWP
            else if(equali(szMapName, "aim_ak_colt")) // aim maps with autoequip can have veriety of guns
                g_iEquipType = EQUIP_AIM_AK_COLT
            else if(equali(szMapName, "aim_dust"))
                g_iEquipType = EQUIP_AIM_DUST
        }
        case 'c', 'd': return // cs_, de_ maps. we stop here and do not register forwards (playerspawn and/or onspawnequip(reapi), etc).
        //case '#': {} // any other cases...
    }
  
    // Here we register our forwards
}

public PlayerSpawn(id) // Ham or Reapi (onspawnequip?)
{
    // here we strip all weapons from our player
    // alt. method is to block default equip by RG_CBasePlayer_OnSpawnEquip.
  
    switch(g_iEquipType)
    {
        case EQUIP_AWP:
        {
            // here we equip player with awp, knife
        }
        case EQUIP_AIM_AK_COLT:
        {
            // ak/colt (2 guns? or guns based on player team?)
        }
        case EQUIP_COSTOM:
        {
            // Your custom equip. All you need is to change g_iEquipType to EQUIP_COSTOM, end, when needed, change g_iEquipType back
        }
    }
}
I did't work with onspawnequip, but i think we can block default equip + give our custom equip right there
And maybe we also can block map (equip by game_player_equip) equip with it (need test)
 
Последнее редактирование:
Сообщения
2,751
Реакции
3,016
Помог
61 раз(а)
Ты их сейчас всех перепугаешь :crazy:, пойдут же голову морочить, что это такое.
25 Мар 2018
BlackSignature, это оптимизации такие или намеренный допуск вовсе не понятного поведения сервера?
Код:
new szMapName[32]; get_mapname(szMapName, charsmax(szMapName))
    switch(szMapName[0])
    {
        case 'a':
        {
            if(equali(szMapName, "awp_", 4)) // all awp_ maps equip us with awp. One pattern -> one equip type
                g_iEquipType = EQUIP_AWP
            else if(equali(szMapName, "aim_ak_colt")) // aim maps with autoequip can have veriety of guns
                g_iEquipType = EQUIP_AIM_AK_COLT
            else if(equali(szMapName, "aim_dust"))
                g_iEquipType = EQUIP_AIM_DUST
        }
        case 'c', 'd': return // cs_, de_ maps. we stop here and do not register forwards (playerspawn and/or onspawnequip(reapi), etc).
        //case '#': {} // any other cases...
    }
 
Сообщения
1,293
Реакции
2,294
Помог
57 раз(а)
wopox1337, просто пример. Я нигде и не утверждал, что он полноценен.
 

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

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