|
11 | 11 |
|
12 | 12 | #include <stocksoup/memory>
|
13 | 13 |
|
14 |
| -#define PLUGIN_VERSION "0.18.0" |
| 14 | +#define PLUGIN_VERSION "0.19.0" |
15 | 15 | public Plugin myinfo = {
|
16 | 16 | name = "TF2 Utils",
|
17 | 17 | author = "nosoop",
|
@@ -54,6 +54,7 @@ Address offs_CTFPlayer_hMyWearables;
|
54 | 54 |
|
55 | 55 | Address offs_CTFPlayerShared_flBurnDuration;
|
56 | 56 | Address offs_CTFPlayerShared_ConditionData;
|
| 57 | +Address offs_CTFPlayerShared_pOuter; |
57 | 58 |
|
58 | 59 | Address offs_TFCondInfo_flDuration;
|
59 | 60 | Address offs_TFCondInfo_hProvider;
|
@@ -106,6 +107,8 @@ public APLRes AskPluginLoad2(Handle self, bool late, char[] error, int maxlen) {
|
106 | 107 |
|
107 | 108 | CreateNative("TF2Util_IsPointInRespawnRoom", Native_IsPointInRespawnRoom);
|
108 | 109 |
|
| 110 | + CreateNative("TF2Util_GetPlayerFromSharedAddress", Native_GetPlayerFromSharedAddress); |
| 111 | + |
109 | 112 | // deprecated name for backcompat
|
110 | 113 | CreateNative("TF2Util_GetPlayerMaxHealth", Native_GetMaxHealthBoost);
|
111 | 114 |
|
@@ -231,6 +234,9 @@ public void OnPluginStart() {
|
231 | 234 | offs_CTFPlayerShared_flBurnDuration = GameConfGetAddressOffset(hGameConf,
|
232 | 235 | "CTFPlayerShared::m_flBurnDuration");
|
233 | 236 |
|
| 237 | + offs_CTFPlayerShared_pOuter = GameConfGetAddressOffset(hGameConf, |
| 238 | + "CTFPlayerShared::m_pOuter"); |
| 239 | + |
234 | 240 | sizeof_TFCondInfo = GameConfGetOffset(hGameConf, "sizeof(TFCondInfo_t)");
|
235 | 241 |
|
236 | 242 | offs_TFCondInfo_flDuration = GameConfGetAddressOffset(hGameConf,
|
@@ -763,6 +769,13 @@ any Native_SetPlayerRespawnTimeOverride(Handle plugin, int numParams) {
|
763 | 769 | return;
|
764 | 770 | }
|
765 | 771 |
|
| 772 | +// int(Address pShared); |
| 773 | +any Native_GetPlayerFromSharedAddress(Handle plugin, int numParams) { |
| 774 | + Address pShared = GetNativeCell(1); |
| 775 | + Address pOuter = DereferencePointer(pShared + offs_CTFPlayerShared_pOuter); |
| 776 | + return GetEntityFromAddress(pOuter); |
| 777 | +} |
| 778 | + |
766 | 779 | bool IsEntityWeapon(int entity) {
|
767 | 780 | if (!IsValidEntity(entity)) {
|
768 | 781 | ThrowNativeError(SP_ERROR_NATIVE, "Entity %d (%d) is invalid", entity,
|
|
0 commit comments