Added amb1609 - Persistant option to TF2_SetPlayerClass
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%402066
This commit is contained in:
parent
d014010a99
commit
16bdac4635
@ -103,15 +103,20 @@ stock TFClassType:TF2_GetPlayerClass(client)
|
|||||||
* @param client Player's index.
|
* @param client Player's index.
|
||||||
* @param class TFClassType class symbol.
|
* @param class TFClassType class symbol.
|
||||||
* @param weapons If true, changes the players weapon set to that of the new class.
|
* @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
|
* @noreturn
|
||||||
* @error Invalid client index.
|
* @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_iClass", _:class);
|
||||||
SetEntProp(client, Prop_Send, "m_iDesiredPlayerClass", _:class);
|
|
||||||
TF2_SetPlayerResourceData(client, TFResource_PlayerClass, class);
|
TF2_SetPlayerResourceData(client, TFResource_PlayerClass, class);
|
||||||
|
|
||||||
|
if (persistant)
|
||||||
|
{
|
||||||
|
SetEntProp(client, Prop_Send, "m_iDesiredPlayerClass", _:class);
|
||||||
|
}
|
||||||
|
|
||||||
if (weapons && IsPlayerAlive(client))
|
if (weapons && IsPlayerAlive(client))
|
||||||
{
|
{
|
||||||
TF2_RemoveAllWeapons(client);
|
TF2_RemoveAllWeapons(client);
|
||||||
|
Loading…
Reference in New Issue
Block a user