Could someone help me in getting and setting the player class id for the game Fortress Forever?
Code:
stock int GetPlayerClass(int client)
{
if(!IsPlayer(client))
return 0;
if (GetEngineVersion() == Engine_DarkMessiah)
return GetEntProp(client, Prop_Send, "m_iPlayerClass");
return GetEntProp(client, Prop_Send, "m_iClass");
}
stock int SetPlayerClass(int client, int class, bool persistant=false)
{
if(!IsPlayer(client))
return 0;
if (GetEngineVersion() == Engine_DarkMessiah)
SetEntProp(client, Prop_Send, "m_iPlayerClass", class);
else
SetEntProp(client, Prop_Send, "m_iClass", class);
if(persistent)
SetEntProp(client, Prop_Send, "m_iDesiredPlayerClass", class);
return 1;
}
I tried to print the player class when typing console command classname but it throwed an error so I guess that something might be wrong on the stock maybe?
I got the netprops and it seems that FF indded contains the m_iClass prop.
Thanks !