Added amb1609 - Persistant option to TF2_SetPlayerClass

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%402066
This commit is contained in:
Matt Woodrow 2008-04-16 05:41:34 +00:00
parent d014010a99
commit 16bdac4635

View File

@ -103,15 +103,20 @@ stock TFClassType:TF2_GetPlayerClass(client)
* @param client Player's index.
* @param class TFClassType class symbol.
* @param weapons If true, changes the players weapon set to that of the new class.
* @param persistant If true changes the players desired class so the change stays after death.
* @noreturn
* @error Invalid client index.
*/
stock TF2_SetPlayerClass(client, TFClassType:class, bool:weapons=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_iDesiredPlayerClass", _:class);
TF2_SetPlayerResourceData(client, TFResource_PlayerClass, class);
if (persistant)
{
SetEntProp(client, Prop_Send, "m_iDesiredPlayerClass", _:class);
}
if (weapons && IsPlayerAlive(client))
{
TF2_RemoveAllWeapons(client);