20/05/2023, 09:28 PM
(Última modificación: 20/05/2023, 09:41 PM por SVC. Edited 5 times in total.)
• EXTRA
He creado este stock (un port de SetBodyGroup del Half-Life) para hacer la tarea más facil:
SetBodygroup (HLSDK)
Al igual, que he dejado adjunto un modelo de prueba, para que puedan hacer sus pruebas
Se puede usar tan solo como esto:
Usando el mismo modelo, por ejemplo:
Resultado:
He creado este stock (un port de SetBodyGroup del Half-Life) para hacer la tarea más facil:
Código PHP:
stock bool:SetBodyGroup(const iEntity, const iGroup, const iPart)
{
new bool:bResult;
static szModel[64];
pev(iEntity, pev_model, szModel, charsmax(szModel));
new iModelPtr = fopen(szModel, "rb");
if (!iModelPtr)
goto Result;
new iBodyPartsCount = iGroup;
new iBodyPartNumModels;
new iBodyPartBase;
Model_GetBodyPartInfo(iModelPtr, iBodyPartsCount, iBodyPartNumModels, iBodyPartBase);
if (iGroup > iBodyPartsCount)
goto Result;
if (iPart >= iBodyPartNumModels)
goto Result;
new iBody;
new iCurrent;
iBody = pev(iEntity, pev_body);
iCurrent = (iBody / iBodyPartBase) % iBodyPartNumModels;
iBody = iBody - (iCurrent * iBodyPartBase) + (iPart * iBodyPartBase);
set_pev(iEntity, pev_body, iBody);
bResult = true
Result:
{
fclose(iModelPtr);
return bResult;
}
}
Model_GetBodyPartInfo(const pmodel, &numbodyparts, &nummodels, &base)
{
if (!pmodel)
return;
new group = numbodyparts;
new bodypartindex;
const studiohdr_s_numbodyparts = 204 // studiohdr_t->numbodyparts offset (from start)
const mstudiobodyparts_s_nummodels = 64; // mstudiobodyparts_t->nummodels offset (from start)
const mstudiobodyparts_s_size = 76; // mstudiobodyparts_t size (64char x 1byte + 3int * 4byte)
fseek(pmodel, studiohdr_s_numbodyparts, SEEK_SET);
fread(pmodel, numbodyparts, BLOCK_INT);
fread(pmodel, bodypartindex, BLOCK_INT);
bodypartindex += (group * mstudiobodyparts_s_size) + mstudiobodyparts_s_nummodels;
fseek(pmodel, bodypartindex, SEEK_SET);
fread(pmodel, nummodels, BLOCK_INT);
fread(pmodel, base, BLOCK_INT);
}
SetBodygroup (HLSDK)
Al igual, que he dejado adjunto un modelo de prueba, para que puedan hacer sus pruebas
Se puede usar tan solo como esto:
Código PHP:
SetBodyGroup(entity, body-group, body-part)
Usando el mismo modelo, por ejemplo:
Código PHP:
SetBodyGroup(entity, 0, 1);
SetBodyGroup(entity, 2, 4);
Resultado: