mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 14:25:38 +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_SENTRY_OWNER 83 + LINUXOFFSET
|
||||||
#define PD_TIMER_OWNER 932 + 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 MAX_TRACE 13
|
||||||
//#define NADE_OFFSET 24
|
//#define NADE_OFFSET 24
|
||||||
|
|
||||||
|
@ -81,6 +81,30 @@ static cell AMX_NATIVE_CALL TFC_ClearModel(AMX *amx, cell *params) {
|
|||||||
|
|
||||||
edict_t* pPlayer = INDEXENT(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];
|
char szModel[32];
|
||||||
memset(szModel, 0x0, strlen(szModel));
|
memset(szModel, 0x0, strlen(szModel));
|
||||||
|
|
||||||
@ -137,6 +161,7 @@ static cell AMX_NATIVE_CALL TFC_ClearModel(AMX *amx, cell *params) {
|
|||||||
(g_engfuncs.pfnSetClientKeyValue)(iIndex, (g_engfuncs.pfnGetInfoKeyBuffer)(pPlayer), "model", szModel);
|
(g_engfuncs.pfnSetClientKeyValue)(iIndex, (g_engfuncs.pfnGetInfoKeyBuffer)(pPlayer), "model", szModel);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
// Vexd end :)
|
// Vexd end :)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user