Added TF2_IsPlayerInDuel native to TF2 extension (bug 4695, r=psychonic).
This commit is contained in:
parent
172abb2710
commit
7627bf80b9
@ -475,6 +475,42 @@ cell_t TF2_GetClass(IPluginContext *pContext, const cell_t *params)
|
|||||||
return (cell_t)ClassnameToType(str);
|
return (cell_t)ClassnameToType(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// native TF2_IsPlayerInDuel(client)
|
||||||
|
cell_t TF2_IsPlayerInDuel(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
static ICallWrapper *pWrapper = NULL;
|
||||||
|
|
||||||
|
// DuelMiniGame_IsPlayerInDuel(CTFPlayer *)
|
||||||
|
if (!pWrapper)
|
||||||
|
{
|
||||||
|
REGISTER_NATIVE_ADDR("IsPlayerInDuel",
|
||||||
|
PassInfo pass[1]; \
|
||||||
|
pass[0].flags = PASSFLAG_BYVAL; \
|
||||||
|
pass[0].size = sizeof(CBaseEntity *); \
|
||||||
|
pass[0].type = PassType_Basic; \
|
||||||
|
PassInfo ret; \
|
||||||
|
ret.flags = PASSFLAG_BYVAL; \
|
||||||
|
ret.size = sizeof(bool); \
|
||||||
|
ret.type = PassType_Basic; \
|
||||||
|
pWrapper = g_pBinTools->CreateCall(addr, CallConv_Cdecl, &ret, pass, 1))
|
||||||
|
}
|
||||||
|
|
||||||
|
CBaseEntity *pPlayer;
|
||||||
|
if (!(pPlayer = UTIL_GetCBaseEntity(params[1], true)))
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("Client index %d is not valid", params[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char vstk[sizeof(CBaseEntity *)];
|
||||||
|
unsigned char *vptr = vstk;
|
||||||
|
*(CBaseEntity **)vptr = pPlayer;
|
||||||
|
|
||||||
|
bool retValue;
|
||||||
|
pWrapper->Execute(vstk, &retValue);
|
||||||
|
|
||||||
|
return (retValue) ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
sp_nativeinfo_t g_TFNatives[] =
|
sp_nativeinfo_t g_TFNatives[] =
|
||||||
{
|
{
|
||||||
{"TF2_IgnitePlayer", TF2_Burn},
|
{"TF2_IgnitePlayer", TF2_Burn},
|
||||||
@ -490,5 +526,6 @@ sp_nativeinfo_t g_TFNatives[] =
|
|||||||
{"TF2_SetPlayerPowerPlay", TF2_SetPowerplayEnabled},
|
{"TF2_SetPlayerPowerPlay", TF2_SetPowerplayEnabled},
|
||||||
{"TF2_StunPlayer", TF2_StunPlayer},
|
{"TF2_StunPlayer", TF2_StunPlayer},
|
||||||
{"TF2_MakeBleed", TF2_MakeBleed},
|
{"TF2_MakeBleed", TF2_MakeBleed},
|
||||||
|
{"TF2_IsPlayerInDuel", TF2_IsPlayerInDuel},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
@ -106,6 +106,13 @@
|
|||||||
"linux" "@_ZN15CTFPlayerShared9MakeBleedEP9CTFPlayerP13CTFWeaponBasef"
|
"linux" "@_ZN15CTFPlayerShared9MakeBleedEP9CTFPlayerP13CTFWeaponBasef"
|
||||||
"mac" "@_ZN15CTFPlayerShared9MakeBleedEP9CTFPlayerP13CTFWeaponBasef"
|
"mac" "@_ZN15CTFPlayerShared9MakeBleedEP9CTFPlayerP13CTFWeaponBasef"
|
||||||
}
|
}
|
||||||
|
"IsPlayerInDuel"
|
||||||
|
{
|
||||||
|
"library" "server"
|
||||||
|
"windows" "\x83\xEC\x08\x2A\x2A\x2A\x2A\x33\xC0\x89\x04\x24\x89\x44\x24\x04\x8D\x04\x24\x50\x2A\x2A\x2A\x2A\x2A\x84\xC0\x2A\x2A\x83\xC4\x08\xC3"
|
||||||
|
"linux" "@_Z21DuelMiniGame_IsInDuelP9CTFPlayer"
|
||||||
|
"mac" "@_Z21DuelMiniGame_IsInDuelP9CTFPlayer"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
"Offsets"
|
"Offsets"
|
||||||
{
|
{
|
||||||
|
@ -272,6 +272,14 @@ forward Action:TF2_CalcIsAttackCritical(client, weapon, String:weaponname[], &bo
|
|||||||
*/
|
*/
|
||||||
forward Action:TF2_OnGetHoliday(&TFHoliday:holiday);
|
forward Action:TF2_OnGetHoliday(&TFHoliday:holiday);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether or not a client (Player) is in a duel.
|
||||||
|
*
|
||||||
|
* @param client Client Index.
|
||||||
|
* @return Boolean of whether or not the client/player is dueling.
|
||||||
|
*/
|
||||||
|
native bool:TF2_IsPlayerInDuel(client);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do not edit below this line!
|
* Do not edit below this line!
|
||||||
*/
|
*/
|
||||||
@ -302,5 +310,6 @@ public __ext_tf2_SetNTVOptional()
|
|||||||
MarkNativeAsOptional("TF2_MakeBleed");
|
MarkNativeAsOptional("TF2_MakeBleed");
|
||||||
MarkNativeAsOptional("TF2_GetResourceEntity");
|
MarkNativeAsOptional("TF2_GetResourceEntity");
|
||||||
MarkNativeAsOptional("TF2_GetClass");
|
MarkNativeAsOptional("TF2_GetClass");
|
||||||
|
MarkNativeAsOptional("TF2_IsPlayerInDuel");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user