1 #include "changelevel.qh"
3 .string chmap, gametype;
6 void target_changelevel_use(entity this, entity actor, entity trigger)
8 if(this.spawnflags & 2)
10 // simply don't react if a non-player triggers it
11 if(!IS_PLAYER(actor)) { return; }
13 actor.chlevel_targ = this;
17 // let's not count bots
18 FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), {
20 if(it.chlevel_targ == this)
23 if(plnum < ceil(realplnum * min(1, this.count))) // 70% of players
27 if(this.gametype != "")
28 MapInfo_SwitchGameType(MapInfo_Type_FromString(this.gametype));
31 localcmd("endmatch\n");
33 localcmd(strcat("changelevel ", this.chmap, "\n"));
36 spawnfunc(target_changelevel)
38 this.use = target_changelevel_use;
40 if(!this.count) { this.count = 0.7; }