1 #include "changelevel.qh"
3 .string chmap, gametype;
6 void target_changelevel_use(entity this, entity actor, entity trigger)
8 if(this.spawnflags & CHANGELEVEL_MULTIPLAYER)
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"));
37 Target to change/end level
39 chmap: map to switch to, leave empty for endmatch
40 gametype: gametype for the next map
41 count: fraction of real players that need to trigger this entity for levelchange
43 CHANGELEVEL_MULTIPLAYER: multiplayer support
46 spawnfunc(target_changelevel)
48 this.use = target_changelevel_use;