From 16bdac4635a81a0c31b8e92c52fa55b1464f6b0f Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Wed, 16 Apr 2008 05:41:34 +0000 Subject: [PATCH] Added amb1609 - Persistant option to TF2_SetPlayerClass --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%402066 --- plugins/include/tf2_stocks.inc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/include/tf2_stocks.inc b/plugins/include/tf2_stocks.inc index a4998049..4f0df9e3 100644 --- a/plugins/include/tf2_stocks.inc +++ b/plugins/include/tf2_stocks.inc @@ -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);