ReGameDLL_CS icon indicating copy to clipboard operation
ReGameDLL_CS copied to clipboard

[Feature Request] Weapon Models (RU)

Open ghost opened this issue 8 years ago • 4 comments

Почему бы не хранит моделку (у самого wepon entity) в viewmodel и weaponmodel. Те:

        // amxx script 
        new pEnt = give_item(pPlayer, "weapon_ak47")
        if(pev_valid(pEnt))
        {
		set_pev(pEnt, pev_viewmodel, engfunc(EngFunc_AllocString, "models/custom/v_ak47.mdl"))
		set_pev(pEnt, pev_weaponmodel, engfunc(EngFunc_AllocString, "models/custom/p_ak47.mdl"))
		ExecuteHamB(Ham_Item_Deploy, pEnt)
        }

И:

       // wpn_ak47.cpp
 	char *szViewModel = pev->viewmodel ? STRING(pev->viewmodel) : "models/v_ak47.mdl";
	char *szWeaponModel = pev->weaponmodel ? STRING(pev->weaponmodel) : "models/p_ak47.mdl";

	return DefaultDeploy(szViewModel, szWeaponModel, AK47_DRAW, "ak47", UseDecrement() != FALSE);

Полезная вещь для модов.

Или нельзя использовать viewmodel/weaponmodel для non player entity ?

ghost avatar Jan 17 '17 23:01 ghost

А так же еще вопрос про const char GetCSModelName(int item_id) почему бы не получить моделку прямо из model (pev_model) ? Ведь у каждого оружие уже https://github.com/s1lentq/ReGameDLL_CS/blob/master/regamedll/dlls/wpn_shared/wpn_ak47.cpp#L10

И убрат сбросы model https://github.com/s1lentq/ReGameDLL_CS/blob/master/regamedll/dlls/weapons.cpp#L1981 https://github.com/s1lentq/ReGameDLL_CS/blob/master/regamedll/dlls/weapons.cpp#L1124

 // custom 
const char *GetCSModelName(CBasePlayerItem *pItem)
{
	const char *modelName = STRING(pItem->pev->model);

	return (modelName[0]) ? modelName : GetCSModelName(pItem->m_iId);
        // return (*modelName != '\0') ? modelName : GetCSModelName(pItem->m_iId);
}

В итоге один раз установил и забыл

    new pEnt = give_item(pPlayer, "weapon_ak47")
    if(pev_valid(pEnt))
    {
        engfunc(EngFunc_SetModel, pEnt, "models/custom/w_ak47.mdl")
        set_pev(pEnt, pev_viewmodel, engfunc(EngFunc_AllocString, "models/custom/v_ak47.mdl"))
        set_pev(pEnt, pev_weaponmodel, engfunc(EngFunc_AllocString, "models/custom/p_ak47.mdl"))
        ExecuteHamB(Ham_Item_Deploy, pEnt)
    }

ghost avatar Jan 18 '17 00:01 ghost

Закрывайте

Vaqtincha avatar Jan 07 '22 18:01 Vaqtincha

Don't forget this. Will be a great feature

RauliTop avatar Feb 19 '22 21:02 RauliTop

@RauliTop okay

Vaqtincha avatar Feb 22 '24 03:02 Vaqtincha