From 485e56906a91980087b71b21c068d78d7db0bbec Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Tue, 22 Apr 2008 22:04:46 +0000 Subject: [PATCH] Fixed amb1634 - GetPlayerResourceData incorrectly memorising offsets. --HG-- branch : sourcemod-1.0.x extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402090 --- plugins/include/tf2_stocks.inc | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/plugins/include/tf2_stocks.inc b/plugins/include/tf2_stocks.inc index 4f0df9e3..219f0734 100644 --- a/plugins/include/tf2_stocks.inc +++ b/plugins/include/tf2_stocks.inc @@ -110,7 +110,6 @@ stock TFClassType:TF2_GetPlayerClass(client) stock TF2_SetPlayerClass(client, TFClassType:class, bool:weapons=true, bool:persistant=true) { SetEntProp(client, Prop_Send, "m_iClass", _:class); - TF2_SetPlayerResourceData(client, TFResource_PlayerClass, class); if (persistant) { @@ -139,14 +138,7 @@ stock TF2_GetPlayerResourceData(client, TFResourceType:type) return -1; } - static offset; - static set = false; - - if (!set) - { - offset = FindSendPropInfo("CTFPlayerResource", TFResourceNames[type]); - set = true; - } + new offset = FindSendPropInfo("CTFPlayerResource", TFResourceNames[type]); if (offset < 1) { @@ -166,6 +158,8 @@ stock TF2_GetPlayerResourceData(client, TFResourceType:type) /** * Sets client data in the resource entity * + * Note: The game overwrites these values every frame, so changing them will have very little effect. + * * @param client Player's index. * @param type ResourceType constant * @param value Value to set. @@ -179,14 +173,7 @@ stock bool:TF2_SetPlayerResourceData(client, TFResourceType:type, any:value) return false; } - static offset; - static set = false; - - if (!set) - { - offset = FindSendPropInfo("CTFPlayerResource", TFResourceNames[type]); - set = true; - } + new offset = FindSendPropInfo("CTFPlayerResource", TFResourceNames[type]); if (offset < 1) {