mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-24 13:55:36 +03:00
Fix for amb343 - tfc_clearmodel didn't function as advertised.
This commit is contained in:
parent
7b6d4ce699
commit
8316318c31
@ -22,6 +22,12 @@
|
||||
#define PD_SENTRY_OWNER 83 + LINUXOFFSET
|
||||
#define PD_TIMER_OWNER 932 + LINUXOFFSET
|
||||
|
||||
// If somehow TFC updates, the following two offsets can be updated by
|
||||
// disassembling CBaseEntity::KeyValuePartThree(KeyValueData_s *)
|
||||
#define PD_REPLACE_MODEL 170 + LINUXOFFSET
|
||||
#define PD_REPLACE_SKIN 172 + LINUXOFFSET
|
||||
|
||||
|
||||
#define MAX_TRACE 13
|
||||
//#define NADE_OFFSET 24
|
||||
|
||||
|
@ -80,7 +80,31 @@ static cell AMX_NATIVE_CALL TFC_ClearModel(AMX *amx, cell *params) {
|
||||
CHECK_PLAYER(iIndex)
|
||||
|
||||
edict_t* pPlayer = INDEXENT(iIndex);
|
||||
|
||||
if (pPlayer->pvPrivateData == NULL)
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Player has no private data, cannot clear model!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// PD_REPLACE_MODEL is the string_t for the replacement model
|
||||
// setting it to 0 will reset the model properly
|
||||
*( (int*)pPlayer->pvPrivateData + PD_REPLACE_MODEL) = 0;
|
||||
|
||||
// PD_REPLACE_SKIN is the integer setting for the skin, by default
|
||||
// it is 0.
|
||||
*( (int*)pPlayer->pvPrivateData + PD_REPLACE_SKIN) = 0;
|
||||
|
||||
return 1;
|
||||
|
||||
/*
|
||||
// the old, buggy method here
|
||||
int iIndex = params[1];
|
||||
|
||||
CHECK_PLAYER(iIndex)
|
||||
|
||||
edict_t* pPlayer = INDEXENT(iIndex);
|
||||
|
||||
char szModel[32];
|
||||
memset(szModel, 0x0, strlen(szModel));
|
||||
|
||||
@ -135,8 +159,9 @@ static cell AMX_NATIVE_CALL TFC_ClearModel(AMX *amx, cell *params) {
|
||||
(gpGamedllFuncs->dllapi_table->pfnKeyValue)(pPlayer, &pkvd2);
|
||||
|
||||
(g_engfuncs.pfnSetClientKeyValue)(iIndex, (g_engfuncs.pfnGetInfoKeyBuffer)(pPlayer), "model", szModel);
|
||||
|
||||
|
||||
return 1;
|
||||
*/
|
||||
}
|
||||
// Vexd end :)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user