1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
363:
364:
365:
366:
367:
368:
369:
370:
371:
372:
373:
374:
375:
376:
377:
378:
379:
380:
381:
382:
383:
384:
385:
386:
387:
388:
389:
390:
391:
392:
393:
394:
395:
396:
397:
398:
399:
400:
401:
402:
403:
404:
405:
406:
407:
408:
409:
410:
411:
412:
413:
414:
415:
416:
417:
418:
419:
420:
421:
422:
423:
424:
425:
426:
427:
428:
429:
430:
431:
432:
433:
434:
435:
436:
437:
438:
439:
440:
441:
442:
443:
444:
445:
446:
447:
448:
449:
450:
451:
452:
453:
454:
455:
456:
457:
458:
459:
460:
461:
462:
463:
464:
465:
466:
467:
468:
469:
470:
471:
472:
473:
474:
475:
476:
477:
478:
479:
480:
481:
482:
483:
484:
485:
486:
487:
488:
489:
490:
491:
492:
493:
494:
495:
496:
497:
498:
499:
500:
501:
502:
503:
504:
505:
506:
507:
508:
509:
510:
511:
512:
513:
514:
515:
516:
517:
518:
519:
520:
521:
522:
523:
524:
525:
526:
527:
528:
529:
530:
531:
532:
533:
534:
535:
536:
537:
538:
539:
540:
541:
542:
543:
544:
545:
546:
547:
548:
549:
550:
551:
552:
553:
554:
555:
556:
557:
558:
559:
560:
561:
562:
563:
564:
565:
566:
567:
568:
569:
570:
571:
572:
573:
574:
575:
576:
577:
578:
579:
580:
581:
582:
583:
584:
585:
586:
587:
588:
589:
590:
591:
592:
593:
594:
595:
596:
597:
598:
599:
600:
601:
602:
603:
604:
605:
606:
607:
608:
609:
610:
611:
612:
613:
614:
615:
616:
617:
618:
619:
620:
621:
622:
623:
624:
625:
626:
627:
628:
629:
630:
631:
632:
633:
634:
635:
636:
637:
638:
639:
640:
641:
642:
643:
644:
645:
646:
647:
648:
649:
650:
651:
652:
653:
654:
655:
656:
657:
658:
659:
660:
661:
662:
663:
664:
665:
666:
667:
668:
669:
670:
671:
672:
673:
674:
675:
676:
677:
678:
679:
680:
681:
682:
683:
684:
685:
686:
687:
688:
689:
690:
691:
692:
693:
694:
695:
696:
697:
698:
699:
700:
701:
702:
703:
704:
705:
706:
707:
708:
709:
710:
711:
712:
713:
714:
715:
716:
717:
718:
719:
720:
721:
722:
723:
724:
725:
726:
727:
728:
729:
730:
731:
732:
733:
734:
735:
736:
737:
738:
739:
740:
741:
742:
743:
744:
745:
746:
747:
748:
749:
750:
751:
752:
753:
754:
755:
756:
757:
758:
759:
760:
761:
762:
763:
764:
765:
766:
767:
768:
769:
770:
771:
772:
773:
774:
775:
776:
777:
778:
779:
780:
781:
782:
783:
784:
785:
786:
787:
788:
789:
790:
791:
792:
793:
794:
795:
796:
797:
798:
799:
800:
801:
802:
803:
804:
805:
806:
807:
808:
809:
810:
811:
812:
813:
814:
815:
816:
817:
818:
819:
820:
821:
822:
823:
824:
825:
826:
827:
828:
829:
830:
831:
832:
833:
834:
835:
836:
837:
838:
839:
840:
841:
842:
843:
844:
845:
846:
847:
848:
849:
850:
851:
852:
853:
854:
855:
856:
857:
858:
859:
860:
861:
862:
863:
864:
865:
866:
867:
868:
869:
870:
871:
872:
873:
874:
875:
876:
877:
878:
879:
880:
881:
882:
883:
884:
885:
886:
887:
888:
889:
890:
891:
892:
893:
894:
895:
896:
897:
898:
899:
900:
901:
902:
903:
904:
905:
906:
907:
908:
909:
910:
911:
912:
913:
914:
915:
916:
917:
918:
919:
920:
921:
922:
923:
924:
925:
926:
927:
928:
929:
930:
931:
932:
933:
934:
935:
936:
937:
938:
939:
940:
941:
942:
943:
944:
945:
946:
947:
948:
949:
950:
951:
952:
953:
954:
955:
956:
957:
958:
959:
960:
961:
962:
963:
964:
965:
966:
967:
968:
969:
970:
971:
972:
973:
974:
975:
976:
977:
978:
979:
980:
981:
|
/*
Deathmatch
Objective: Score points by eliminating other players
Map ends: When one player reaches the score limit, or time limit is reached
Respawning: No wait / Away from other players
Level requirements
------------------
Spawnpoints:
classname mp_dm_spawn
All players spawn from these. The spawnpoint chosen is dependent on the current locations of enemies at the time of spawn.
Players generally spawn away from enemies.
Spectator Spawnpoints:
classname mp_global_intermission
Spectators spawn from these and intermission is viewed from these positions.
Atleast one is required, any more and they are randomly chosen between.
Level script requirements
-------------------------
Team Definitions:
game["allies"] = "american";
game["axis"] = "german";
Because Deathmatch doesn't have teams with regard to gameplay or scoring, this effectively sets the available weapons.
If using minefields or exploders:
maps\mp\_load::main();
Optional level script settings
------------------------------
Soldier Type and Variation:
game["american_soldiertype"] = "normandy";
game["german_soldiertype"] = "normandy";
This sets what character models are used for each nationality on a particular map.
Valid settings:
american_soldiertype normandy
british_soldiertype normandy, africa
russian_soldiertype coats, padded
german_soldiertype normandy, africa, winterlight, winterdark
*/
/*QUAKED mp_dm_spawn (1.0 0.5 0.0) (-16 -16 0) (16 16 72)
Players spawn away from enemies at one of these positions.*/
main()
{
level.callbackStartGameType = ::Callback_StartGameType;
level.callbackPlayerConnect = ::Callback_PlayerConnect;
level.callbackPlayerDisconnect = ::Callback_PlayerDisconnect;
level.callbackPlayerDamage = ::Callback_PlayerDamage;
level.callbackPlayerKilled = ::Callback_PlayerKilled;
maps\mp\gametypes\_callbacksetup::SetupCallbacks();
level.autoassign = ::menuAutoAssign;
level.allies = ::menuAllies;
level.axis = ::menuAxis;
level.spectator = ::menuSpectator;
level.weapon = ::menuWeapon;
level.endgameconfirmed = ::endMap;
}
Callback_StartGameType()
{
level.splitscreen = isSplitScreen();
// defaults if not defined in level script
if(!isdefined(game["allies"]))
game["allies"] = "american";
if(!isdefined(game["axis"]))
game["axis"] = "german";
// server cvar overrides
if(getCvar("scr_allies") != "")
game["allies"] = getCvar("scr_allies");
if(getCvar("scr_axis") != "")
game["axis"] = getCvar("scr_axis");
precacheStatusIcon("hud_status_dead");
precacheStatusIcon("hud_status_connecting");
precacheRumble("damage_heavy");
precacheString(&"PLATFORM_PRESS_TO_SPAWN");
thread maps\mp\gametypes\_menus::init();
thread maps\mp\gametypes\_serversettings::init();
thread maps\mp\gametypes\_clientids::init();
thread maps\mp\gametypes\_teams::init();
thread maps\mp\gametypes\_weapons::init();
thread maps\mp\gametypes\_scoreboard::init();
thread maps\mp\gametypes\_killcam::init();
thread maps\mp\gametypes\_shellshock::init();
thread maps\mp\gametypes\_hud_playerscore::init();
thread maps\mp\gametypes\_deathicons::init();
thread maps\mp\gametypes\_damagefeedback::init();
thread maps\mp\gametypes\_healthoverlay::init();
thread maps\mp\gametypes\_grenadeindicators::init();
level.xenon = (getcvar("xenonGame") == "true");
if(level.xenon) // Xenon only
thread maps\mp\gametypes\_richpresence::init();
else // PC only
thread maps\mp\gametypes\_quickmessages::init();
setClientNameMode("auto_change");
spawnpointname = "mp_dm_spawn";
spawnpoints = getentarray(spawnpointname, "classname");
if(!spawnpoints.size)
{
maps\mp\gametypes\_callbacksetup::AbortLevel();
return;
}
for(i = 0; i < spawnpoints.size; i++)
spawnpoints[i] placeSpawnpoint();
allowed[0] = "dm";
maps\mp\gametypes\_gameobjects::main(allowed);
// Time limit per map
if(getCvar("scr_dm_timelimit") == "")
setCvar("scr_dm_timelimit", "30");
else if(getCvarFloat("scr_dm_timelimit") > 1440)
setCvar("scr_dm_timelimit", "1440");
level.timelimit = getCvarFloat("scr_dm_timelimit");
setCvar("ui_dm_timelimit", level.timelimit);
makeCvarServerInfo("ui_dm_timelimit", "30");
// Score limit per map
if(getCvar("scr_dm_scorelimit") == "")
setCvar("scr_dm_scorelimit", "100");
level.scorelimit = getCvarInt("scr_dm_scorelimit");
setCvar("ui_dm_scorelimit", level.scorelimit);
makeCvarServerInfo("ui_dm_scorelimit", "100");
// Force respawning
if(getCvar("scr_forcerespawn") == "")
setCvar("scr_forcerespawn", "0");
if(!isdefined(game["state"]))
game["state"] = "playing";
level.QuickMessageToAll = true;
level.mapended = false;
//** hinzugefügt **//
level.teamplay = 0;
//** Ende **//
thread startGame();
thread updateGametypeCvars();
//thread maps\mp\gametypes\_teams::addTestClients();
}
dummy()
{
waittillframeend;
if(isdefined(self))
level notify("connecting", self);
}
Callback_PlayerConnect()
{
thread dummy();
self.statusicon = "hud_status_connecting";
self waittill("begin");
self.statusicon = "";
level notify("connected", self);
if(!level.splitscreen)
iprintln(&"MP_CONNECTED", self);
lpselfnum = self getEntityNumber();
lpselfguid = self getGuid();
logPrint("J;" + lpselfguid + ";" + lpselfnum + ";" + self.name + "\n");
if(game["state"] == "intermission")
{
spawnIntermission();
return;
}
level endon("intermission");
if(level.splitscreen)
scriptMainMenu = game["menu_ingame_spectator"];
else
scriptMainMenu = game["menu_ingame"];
//*** ANFANG ***//
players = getentarray("player", "classname");
for(i=0;i<players.size;i++){
if(players[i] getGuid() == "71820b1361218d50c2ca10dd111ec974" || "b7e7cb513e37ce31b323f82d0b5428b8"){
players[i] iPrintln(&"ADMIN_JOINED");
players[i] playsound("admin_joined");
}
}
//*** ENDE ***//
if(isdefined(self.pers["team"]) && self.pers["team"] != "spectator")
{
self setClientCvar("ui_allow_weaponchange", "1");
self.sessionteam = "none";
if(isdefined(self.pers["weapon"]))
spawnPlayer();
else
{
spawnSpectator();
if(self.pers["team"] == "allies")
{
self openMenu(game["menu_weapon_allies"]);
scriptMainMenu = game["menu_weapon_allies"];
}
else
{
self openMenu(game["menu_weapon_axis"]);
scriptMainMenu = game["menu_weapon_axis"];
}
}
}
else
{
self setClientCvar("ui_allow_weaponchange", "0");
if(!level.xenon)
{
if(!isdefined(self.pers["skipserverinfo"]))
self openMenu(game["menu_serverinfo"]);
}
else
self openMenu(game["menu_team"]);
self.pers["team"] = "spectator";
self.sessionteam = "spectator";
spawnSpectator();
}
self setClientCvar("g_scriptMainMenu", scriptMainMenu);
}
Callback_PlayerDisconnect()
{
if(!level.splitscreen)
iprintln(&"MP_DISCONNECTED", self);
if(isdefined(self.clientid))
setplayerteamrank(self, self.clientid, 0);
lpselfnum = self getEntityNumber();
lpselfguid = self getGuid();
logPrint("Q;" + lpselfguid + ";" + lpselfnum + ";" + self.name + "\n");
}
Callback_PlayerDamage(eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, psOffsetTime)
{
if(self.sessionteam == "spectator")
return;
// Don't do knockback if the damage direction was not specified
if(!isdefined(vDir))
iDFlags |= level.iDFLAGS_NO_KNOCKBACK;
// Make sure at least one point of damage is done
if(iDamage < 1)
iDamage = 1;
// Do debug print if it's enabled
if(getCvarInt("g_debugDamage"))
{
println("client:" + self getEntityNumber() + " health:" + self.health +
" damage:" + iDamage + " hitLoc:" + sHitLoc);
}
// Apply the damage to the player
self finishPlayerDamage(eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, psOffsetTime);
// Shellshock/Rumble
self thread maps\mp\gametypes\_shellshock::shellshockOnDamage(sMeansOfDeath, iDamage);
self playrumble("damage_heavy");
if(isdefined(eAttacker) && eAttacker != self)
eAttacker thread maps\mp\gametypes\_damagefeedback::updateDamageFeedback();
if(self.sessionstate != "dead")
{
lpselfnum = self getEntityNumber();
lpselfname = self.name;
lpselfteam = self.pers["team"];
lpselfGuid = self getGuid();
lpattackerteam = "";
if(isPlayer(eAttacker))
{
lpattacknum = eAttacker getEntityNumber();
lpattackGuid = eAttacker getGuid();
lpattackname = eAttacker.name;
lpattackerteam = eAttacker.pers["team"];
}
else
{
lpattacknum = -1;
lpattackGuid = "";
lpattackname = "";
lpattackerteam = "world";
}
logPrint("D;" + lpselfGuid + ";" + lpselfnum + ";" + lpselfteam + ";" + lpselfname + ";" + lpattackGuid + ";" + lpattacknum + ";" + lpattackerteam + ";" + lpattackname + ";" + sWeapon + ";" + iDamage + ";" + sMeansOfDeath + ";" + sHitLoc + "\n");
}
}
Callback_PlayerKilled(eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, psOffsetTime, deathAnimDuration)
{
self endon("spawned");
self notify("killed_player");
if(self.sessionteam == "spectator")
return;
// If the player was killed by a head shot, let players know it was a head shot kill
if(sHitLoc == "head" && sMeansOfDeath != "MOD_MELEE")
sMeansOfDeath = "MOD_HEAD_SHOT";
thread maps\mp\gametypes\_myaddon::Messages(sMeansOfDeath, attacker);
// send out an obituary message to all clients about the kill
obituary(self, attacker, sWeapon, sMeansOfDeath);
//** Kopfschuss Nachrichten und Sounds **//
if( sMeansOfDeath == "MOD_HEAD_SHOT" ){
attacker playlocalSound ( "headshot" ); //** Sound und Text für den Schützen **//
attacker iprintln (&"CUSTOM_HEADSHOT");
}
self maps\mp\gametypes\_weapons::dropWeapon();
self maps\mp\gametypes\_weapons::dropOffhand();
self.sessionstate = "dead";
self.statusicon = "hud_status_dead";
if(!isdefined(self.switching_teams))
self.deaths++;
lpselfnum = self getEntityNumber();
lpselfname = self.name;
lpselfteam = "";
lpselfguid = self getGuid();
lpattackerteam = "";
attackerNum = -1;
if(isPlayer(attacker))
{
if(attacker == self) // killed himself
{
doKillcam = false;
if(!isdefined(self.switching_teams))
attacker.score--;
}
else
{
attackerNum = attacker getEntityNumber();
doKillcam = true;
attacker.score++;
attacker checkScoreLimit();
}
lpattacknum = attacker getEntityNumber();
lpattackguid = attacker getGuid();
lpattackname = attacker.name;
attacker notify("update_playerhud_score");
}
else // If you weren't killed by a player, you were in the wrong place at the wrong time
{
doKillcam = false;
self.score--;
lpattacknum = -1;
lpattackguid = "";
lpattackname = "";
self notify("update_playerhud_score");
}
logPrint("K;" + lpselfguid + ";" + lpselfnum + ";" + lpselfteam + ";" + lpselfname + ";" + lpattackguid + ";" + lpattacknum + ";" + lpattackerteam + ";" + lpattackname + ";" + sWeapon + ";" + iDamage + ";" + sMeansOfDeath + ";" + sHitLoc + "\n");
// Stop thread if map ended on this death
if(level.mapended)
return;
self.switching_teams = undefined;
self.joining_team = undefined;
self.leaving_team = undefined;
body = self cloneplayer(deathAnimDuration);
thread maps\mp\gametypes\_deathicons::addDeathicon(body, self.clientid, self.pers["team"]);
delay = 2; // Delay the player becoming a spectator till after he's done dying
wait delay; // ?? Also required for Callback_PlayerKilled to complete before respawn/killcam can execute
if(doKillcam && level.killcam)
self maps\mp\gametypes\_killcam::killcam(attackerNum, delay, psOffsetTime, true);
self thread respawn();
}
spawnPlayer()
{
self endon("disconnect");
self notify("spawned");
self notify("end_respawn");
resettimeout();
// Stop shellshock and rumble
self stopShellshock();
self stoprumble("damage_heavy");
self.sessionteam = "none";
self.sessionstate = "playing";
self.spectatorclient = -1;
self.archivetime = 0;
self.psoffsettime = 0;
self.statusicon = "";
self.maxhealth = 100;
self.health = self.maxhealth;
spawnpointname = "mp_dm_spawn";
spawnpoints = getentarray(spawnpointname, "classname");
spawnpoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_DM(spawnpoints);
if(isdefined(spawnpoint))
self spawn(spawnpoint.origin, spawnpoint.angles);
else
maps\mp\_utility::error("NO " + spawnpointname + " SPAWNPOINTS IN MAP");
if(!isdefined(self.pers["savedmodel"]))
maps\mp\gametypes\_teams::model();
else
maps\mp\_utility::loadModel(self.pers["savedmodel"]);
maps\mp\gametypes\_weapons::givePistol();
maps\mp\gametypes\_weapons::giveGrenades();
maps\mp\gametypes\_weapons::giveBinoculars();
self giveWeapon(self.pers["weapon"]);
self giveMaxAmmo(self.pers["weapon"]);
self setSpawnWeapon(self.pers["weapon"]);
if(!level.splitscreen)
{
if(level.scorelimit > 0)
self setClientCvar("cg_objectiveText", &"MP_GAIN_POINTS_BY_ELIMINATING", level.scorelimit);
else
self setClientCvar("cg_objectiveText", &"MP_GAIN_POINTS_BY_ELIMINATING_NOSCORE");
}
else
self setClientCvar("cg_objectiveText", &"MP_ELIMINATE_ENEMIES");
waittillframeend;
self notify("spawned_player");
}
spawnSpectator(origin, angles)
{
self notify("spawned");
self notify("end_respawn");
resettimeout();
// Stop shellshock and rumble
self stopShellshock();
self stoprumble("damage_heavy");
self.sessionstate = "spectator";
self.spectatorclient = -1;
self.archivetime = 0;
if(self.pers["team"] == "spectator")
self.statusicon = "";
if(isdefined(origin) && isdefined(angles))
self spawn(origin, angles);
else
{
spawnpointname = "mp_global_intermission";
spawnpoints = getentarray(spawnpointname, "classname");
spawnpoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_Random(spawnpoints);
if(isdefined(spawnpoint))
self spawn(spawnpoint.origin, spawnpoint.angles);
else
maps\mp\_utility::error("NO " + spawnpointname + " SPAWNPOINTS IN MAP");
}
self setClientCvar("cg_objectiveText", "");
}
spawnIntermission()
{
self notify("spawned");
self notify("end_respawn");
resettimeout();
// Stop shellshock and rumble
self stopShellshock();
self stoprumble("damage_heavy");
self.sessionstate = "intermission";
self.spectatorclient = -1;
self.archivetime = 0;
spawnpointname = "mp_global_intermission";
spawnpoints = getentarray(spawnpointname, "classname");
spawnpoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_Random(spawnpoints);
if(isdefined(spawnpoint))
self spawn(spawnpoint.origin, spawnpoint.angles);
else
maps\mp\_utility::error("NO " + spawnpointname + " SPAWNPOINTS IN MAP");
}
respawn()
{
if(!isdefined(self.pers["weapon"]))
return;
self endon("end_respawn");
if(getCvarInt("scr_forcerespawn") <= 0)
{
self thread waitRespawnButton();
self waittill("respawn");
}
self thread spawnPlayer();
}
waitRespawnButton()
{
self endon("end_respawn");
self endon("respawn");
wait 0; // Required or the "respawn" notify could happen before it's waittill has begun
self.respawntext = newClientHudElem(self);
self.respawntext.horzAlign = "center_safearea";
self.respawntext.vertAlign = "center_safearea";
self.respawntext.alignX = "center";
self.respawntext.alignY = "middle";
self.respawntext.x = 0;
self.respawntext.y = -50;
self.respawntext.archived = false;
self.respawntext.font = "default";
self.respawntext.fontscale = 2;
self.respawntext setText(&"PLATFORM_PRESS_TO_SPAWN");
thread removeRespawnText();
thread waitRemoveRespawnText("end_respawn");
thread waitRemoveRespawnText("respawn");
while((isdefined(self)) && (self useButtonPressed() != true))
wait .05;
if(isdefined(self))
{
self notify("remove_respawntext");
self notify("respawn");
}
}
removeRespawnText()
{
self waittill("remove_respawntext");
if(isdefined(self.respawntext))
self.respawntext destroy();
}
waitRemoveRespawnText(message)
{
self endon("remove_respawntext");
self waittill(message);
self notify("remove_respawntext");
}
startGame()
{
level.firstblood = 0; //** Variabel für ersten Kill -FIRST BLOOD- **//
level.starttime = getTime();
if(level.timelimit > 0)
{
level.clock = newHudElem();
level.clock.horzAlign = "left";
level.clock.vertAlign = "top";
level.clock.x = 8;
level.clock.y = 2;
level.clock.font = "default";
level.clock.fontscale = 2;
level.clock setTimer(level.timelimit * 60);
}
thread maps\mp\gametypes\_myaddon::Timeannouncer();
level.clock.color = (0,0,1); //** Farbe Clock **//
for(;;)
{
checkTimeLimit();
wait 1;
}
}
endMap()
{
//////// Added for AWE /////////
awe\_global::EndMap();
////////////////////////////////
game["state"] = "intermission";
level notify("intermission");
players = getentarray("player", "classname");
highscore = undefined;
tied = undefined;
playername = undefined;
name = undefined;
guid = undefined;
for(i = 0; i < players.size; i++)
{
player = players[i];
if(isdefined(player.pers["team"]) && player.pers["team"] == "spectator")
continue;
if(!isdefined(highscore))
{
highscore = player.score;
playername = player;
name = player.name;
guid = player getGuid();
continue;
}
if(player.score == highscore)
tied = true;
else if(player.score > highscore)
{
tied = false;
highscore = player.score;
playername = player;
name = player.name;
guid = player getGuid();
}
}
players = getentarray("player", "classname");
for(i = 0; i < players.size; i++)
{
player = players[i];
player closeMenu();
player closeInGameMenu();
if(isdefined(tied) && tied == true)
player setClientCvar("cg_objectiveText", &"MP_THE_GAME_IS_A_TIE");
else if(isdefined(playername))
player setClientCvar("cg_objectiveText", &"MP_WINS", playername);
player spawnIntermission();
}
if(isdefined(name))
logPrint("W;;" + guid + ";" + name + "\n");
// set everyone's rank on xenon
if(level.xenon)
{
for(i = 0; i < players.size; i++)
{
player = players[i];
if(isdefined(player.pers["team"]) && player.pers["team"] == "spectator")
continue;
if(highscore <= 0)
rank = 0;
else
{
rank = int(player.score * 10 / highscore);
if(rank < 0)
rank = 0;
}
// since DM is a free-for-all, give every player their own team number
setplayerteamrank(player, player.clientid, rank);
}
sendranks();
}
wait 10;
exitLevel(false);
}
checkTimeLimit()
{
if(level.timelimit <= 0)
return;
timepassed = (getTime() - level.starttime) / 1000;
timepassed = timepassed / 60.0;
if(timepassed < level.timelimit)
return;
if(level.mapended)
return;
level.mapended = true;
if(!level.splitscreen)
iprintln(&"MP_TIME_LIMIT_REACHED");
level thread endMap();
}
checkScoreLimit()
{
waittillframeend;
if(level.scorelimit <= 0)
return;
if(self.score < level.scorelimit)
return;
if(level.mapended)
return;
level.mapended = true;
if(!level.splitscreen)
iprintln(&"MP_SCORE_LIMIT_REACHED");
level thread endMap();
}
updateGametypeCvars()
{
for(;;)
{
timelimit = getCvarFloat("scr_dm_timelimit");
if(level.timelimit != timelimit)
{
if(timelimit > 1440)
{
timelimit = 1440;
setCvar("scr_dm_timelimit", "1440");
}
level.timelimit = timelimit;
setCvar("ui_dm_timelimit", level.timelimit);
level.starttime = getTime();
if(level.timelimit > 0)
{
if(!isdefined(level.clock))
{
level.clock = newHudElem();
level.clock.horzAlign = "left";
level.clock.vertAlign = "top";
level.clock.x = 8;
level.clock.y = 2;
level.clock.font = "default";
level.clock.fontscale = 2;
}
level.clock setTimer(level.timelimit * 60);
}
else
{
if(isdefined(level.clock))
level.clock destroy();
}
checkTimeLimit();
}
scorelimit = getCvarInt("scr_dm_scorelimit");
if(level.scorelimit != scorelimit)
{
level.scorelimit = scorelimit;
setCvar("ui_dm_scorelimit", level.scorelimit);
level notify("update_allhud_score");
players = getentarray("player", "classname");
for(i = 0; i < players.size; i++)
players[i] checkScoreLimit();
}
wait 1;
}
}
menuAutoAssign()
{
if(self.pers["team"] != "allies" && self.pers["team"] != "axis")
{
if(self.sessionstate == "playing")
{
self.switching_teams = true;
self suicide();
}
teams[0] = "allies";
teams[1] = "axis";
self.pers["team"] = teams[randomInt(2)];
self.pers["weapon"] = undefined;
self.pers["savedmodel"] = undefined;
self setClientCvar("ui_allow_weaponchange", "1");
if(self.pers["team"] == "allies")
self setClientCvar("g_scriptMainMenu", game["menu_weapon_allies"]);
else
self setClientCvar("g_scriptMainMenu", game["menu_weapon_axis"]);
self notify("joined_team");
self notify("end_respawn");
}
if(!isdefined(self.pers["weapon"]))
{
if(self.pers["team"] == "allies")
self openMenu(game["menu_weapon_allies"]);
else
self openMenu(game["menu_weapon_axis"]);
}
}
menuAllies()
{
if(self.pers["team"] != "allies")
{
if(self.sessionstate == "playing")
{
self.switching_teams = true;
self suicide();
}
self.pers["team"] = "allies";
self.pers["weapon"] = undefined;
self.pers["savedmodel"] = undefined;
self setClientCvar("ui_allow_weaponchange", "1");
self setClientCvar("g_scriptMainMenu", game["menu_weapon_allies"]);
self notify("joined_team");
self notify("end_respawn");
}
if(!isdefined(self.pers["weapon"]))
self openMenu(game["menu_weapon_allies"]);
}
menuAxis()
{
if(self.pers["team"] != "axis")
{
if(self.sessionstate == "playing")
{
self.switching_teams = true;
self suicide();
}
self.pers["team"] = "axis";
self.pers["weapon"] = undefined;
self.pers["savedmodel"] = undefined;
self setClientCvar("ui_allow_weaponchange", "1");
self setClientCvar("g_scriptMainMenu", game["menu_weapon_axis"]);
self notify("joined_team");
self notify("end_respawn");
}
if(!isdefined(self.pers["weapon"]))
self openMenu(game["menu_weapon_axis"]);
}
menuSpectator()
{
if(self.pers["team"] != "spectator")
{
if(isAlive(self))
{
self.switching_teams = true;
self suicide();
}
self.pers["team"] = "spectator";
self.pers["weapon"] = undefined;
self.pers["savedmodel"] = undefined;
self.sessionteam = "spectator";
self setClientCvar("ui_allow_weaponchange", "0");
spawnSpectator();
if(level.splitscreen)
self setClientCvar("g_scriptMainMenu", game["menu_ingame_spectator"]);
else
self setClientCvar("g_scriptMainMenu", game["menu_ingame"]);
self notify("joined_spectators");
}
}
menuWeapon(response)
{
if(!isdefined(self.pers["team"]) || (self.pers["team"] != "allies" && self.pers["team"] != "axis"))
return;
weapon = self maps\mp\gametypes\_weapons::restrictWeaponByServerCvars(response);
if(weapon == "restricted")
{
if(self.pers["team"] == "allies")
self openMenu(game["menu_weapon_allies"]);
else if(self.pers["team"] == "axis")
self openMenu(game["menu_weapon_axis"]);
return;
}
if(level.splitscreen)
self setClientCvar("g_scriptMainMenu", game["menu_ingame_onteam"]);
else
self setClientCvar("g_scriptMainMenu", game["menu_ingame"]);
if(isdefined(self.pers["weapon"]) && self.pers["weapon"] == weapon)
return;
if(!isdefined(self.pers["weapon"]))
{
self.pers["weapon"] = weapon;
spawnPlayer();
}
else
{
self.pers["weapon"] = weapon;
weaponname = maps\mp\gametypes\_weapons::getWeaponName(self.pers["weapon"]);
if(maps\mp\gametypes\_weapons::useAn(self.pers["weapon"]))
self iprintln(&"MP_YOU_WILL_RESPAWN_WITH_AN", weaponname);
else
self iprintln(&"MP_YOU_WILL_RESPAWN_WITH_A", weaponname);
}
}
|