Fixed amb1634 - GetPlayerResourceData incorrectly memorising offsets.

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%402091
This commit is contained in:
Matt Woodrow 2008-04-22 22:05:03 +00:00
parent eac0e274a6
commit d0286c1391

View File

@ -110,7 +110,6 @@ stock TFClassType:TF2_GetPlayerClass(client)
stock TF2_SetPlayerClass(client, TFClassType:class, bool:weapons=true, bool:persistant=true) stock TF2_SetPlayerClass(client, TFClassType:class, bool:weapons=true, bool:persistant=true)
{ {
SetEntProp(client, Prop_Send, "m_iClass", _:class); SetEntProp(client, Prop_Send, "m_iClass", _:class);
TF2_SetPlayerResourceData(client, TFResource_PlayerClass, class);
if (persistant) if (persistant)
{ {
@ -139,14 +138,7 @@ stock TF2_GetPlayerResourceData(client, TFResourceType:type)
return -1; return -1;
} }
static offset; new offset = FindSendPropInfo("CTFPlayerResource", TFResourceNames[type]);
static set = false;
if (!set)
{
offset = FindSendPropInfo("CTFPlayerResource", TFResourceNames[type]);
set = true;
}
if (offset < 1) if (offset < 1)
{ {
@ -166,6 +158,8 @@ stock TF2_GetPlayerResourceData(client, TFResourceType:type)
/** /**
* Sets client data in the resource entity * 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 client Player's index.
* @param type ResourceType constant * @param type ResourceType constant
* @param value Value to set. * @param value Value to set.
@ -179,14 +173,7 @@ stock bool:TF2_SetPlayerResourceData(client, TFResourceType:type, any:value)
return false; return false;
} }
static offset; new offset = FindSendPropInfo("CTFPlayerResource", TFResourceNames[type]);
static set = false;
if (!set)
{
offset = FindSendPropInfo("CTFPlayerResource", TFResourceNames[type]);
set = true;
}
if (offset < 1) if (offset < 1)
{ {