Added amb1609 - Persistant option to TF2_SetPlayerClass

--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402065
This commit is contained in:
Matt Woodrow 2008-04-16 05:41:04 +00:00
parent 40046d8248
commit b7edc558b3

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);