s1lentq / ReGameDLL_CS

:hammer: Reverse-engineered gamedll (CS 1.6 / CZero)
GNU General Public License v3.0
580 stars 201 forks source link

[Feature Request] Weapon Models (RU) #95

Open ghost opened 7 years ago

ghost commented 7 years ago

Почему бы не хранит моделку (у самого 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 commented 7 years ago

А так же еще вопрос про 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)
    }
Vaqtincha commented 2 years ago

Закрывайте

RauliTop commented 2 years ago

Don't forget this. Will be a great feature

Vaqtincha commented 8 months ago

@RauliTop okay