55 lines
1.7 KiB
Plaintext
55 lines
1.7 KiB
Plaintext
/*
|
|
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
|
|
*
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
* copyright notice and this permission notice appear in all copies.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
|
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
|
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
*/
|
|
|
|
void
|
|
CSEv_TeamJoin_f(float f)
|
|
{
|
|
if (self.classname != "player") {
|
|
spawnfunc_player();
|
|
}
|
|
|
|
player pl = (player)self;
|
|
|
|
/* mess, do it better */
|
|
if (f < 10) {
|
|
pl.team = 1; /* Blue */
|
|
forceinfokey(pl, "topcolor", "0x9aff");
|
|
forceinfokey(pl, "bottomcolor", "0x9aff");
|
|
} else if (f < 20) {
|
|
pl.team = 2; /* Red */
|
|
f -= 10;
|
|
forceinfokey(pl, "topcolor", "0xff1800");
|
|
forceinfokey(pl, "bottomcolor", "0xff1800");
|
|
} else if (f < 30) {
|
|
pl.team = 3; /* Yellow */
|
|
f -= 20;
|
|
forceinfokey(pl, "topcolor", "0xffca00");
|
|
forceinfokey(pl, "bottomcolor", "0xffca00");
|
|
} else if (f < 40) {
|
|
pl.team = 4; /* Green */
|
|
f -= 30;
|
|
forceinfokey(pl, "topcolor", "0x3bff00");
|
|
forceinfokey(pl, "bottomcolor", "0x3bff00");
|
|
}
|
|
|
|
/* assign our class type for safe keeping */
|
|
pl.classtype = f;
|
|
|
|
/* turn the player into the class of his choice */
|
|
pl.MakeClass(f);
|
|
pl.SpawnIntoGame();
|
|
}
|