Advertisement
techforce

client.qc (Tekbotctf+)

Sep 13th, 2011
499
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Clone C 61.67 KB | None | 0 0
  1. void () player_pain;
  2. void () player_stand1;
  3. float pregameover;
  4.  
  5. void () CheckDimLight =
  6. {
  7. local float flag;
  8.  
  9. flag = 0;
  10. if ((self.invincible_finished > time))
  11. {
  12. flag = 1;
  13. }
  14. if ((self.super_damage_finished > time))
  15. {
  16. flag = 2;
  17. }
  18. if ((flag == 1))
  19. {
  20. self.effects = (self.effects | EF_DIMLIGHT);
  21. }
  22. if ((flag == 2))
  23. {
  24. self.effects = (self.effects | EF_MUZZLEFLASH);
  25. }
  26. if (!flag)
  27. {
  28. self.effects = ((self.effects - (self.effects & DO_VOID)) - (self.effects & 2));
  29. }
  30. };
  31.  
  32. void () info_intermission =
  33. {
  34. INTERMISSIONS = INTERMISSIONS + 1;
  35.    
  36. };
  37. void () SetChangeParms =
  38. {
  39.  
  40. bprint ("setchgparms \n");
  41.  
  42.  
  43. parm15 = self.accesslvl;
  44. parm14 = self.observer;
  45. parm13 = self.best_wep;
  46. if ((self.health <= 0))
  47. {
  48. SetNewParms ();
  49. parm10 = self.lastteam;
  50. parm11 = self.motd_count;
  51. parm14 = self.observer;
  52. parm13 = self.best_wep;
  53. parm12 = self.sex;
  54. parm16 = self.player_flag;
  55. return;
  56. }
  57. self.items = (self.items - (((((IT_KEY1 | IT_KEY2) | IT_INVISIBILITY) | IT_INVULNERABILITY) | IT_SUIT) | IT_QUAD));
  58. if ((self.health > 100))
  59. {
  60. self.health = 100;
  61. }
  62. if ((self.health < 50))
  63. {
  64. self.health = 50;
  65. }
  66. parm14 = self.observer;
  67. parm11 = self.motd_count;
  68. parm12 = self.sex;
  69. parm13 = self.best_wep;
  70. SetNewParms ();
  71. if (((deathmatch & DM_START_SMALL) || (deathmatch & DM_START_BIG)))
  72. {
  73. SetNewParms ();
  74. }
  75. if ((gamestart || self.observer))
  76. {
  77. parm10 = -1;
  78. }
  79. else
  80. {
  81. parm10 = self.lastteam;
  82. }
  83. if (clienttype(self) == CLIENTTYPE_REAL)
  84. parm15 = self.accesslvl;
  85. parm16 = self.player_flag;
  86.  
  87. Dump_parms ();
  88. };
  89.  
  90. void () SetNewParms =
  91. {
  92.  
  93. bprint ("pre-setnewparms \n");
  94. Dump_parms ();
  95.  
  96.  
  97. if ((gamestart && !pregameover))
  98. {
  99. parm1 = (IT_SHOTGUN | IT_AXE);
  100. parm2 = 100;
  101. parm4 = 15;
  102. parm8 = IT_AXE;
  103. parm10 = 1;
  104. }
  105. else
  106. {
  107. parm1 = (IT_SHOTGUN | IT_AXE); // | IT_HOOK
  108. parm2 = 100;
  109. parm3 = 50;
  110. parm1 = (parm1 + IT_ARMOR1);
  111. parm4 = 40;
  112. parm8 = IT_SHOTGUN;
  113. parm10 = -1;
  114. }
  115. parm5 = 0;
  116. parm6 = 0;
  117. parm7 = 0;
  118. if ((deathmatch & DM_START_SMALL))
  119. {
  120. parm1 = (((IT_HOOK | IT_SUPER_SHOTGUN) | IT_NAILGUN) | IT_ARMOR1);
  121. parm2 = 100;
  122. parm3 = 100;
  123. parm4 = 69;
  124. parm5 = 40;
  125. parm6 = 0;
  126. parm7 = 0;
  127. parm8 = IT_NAILGUN;
  128. }
  129. if ((deathmatch & DM_START_BIG))
  130. {
  131. parm1 = ((((IT_HOOK | IT_SUPER_SHOTGUN) | IT_SUPER_NAILGUN) | IT_ROCKET_LAUNCHER) | IT_ARMOR1);
  132. parm2 = 100;
  133. parm3 = 100;
  134. parm4 = 69;
  135. parm5 = 60;
  136. parm6 = 5;
  137. parm7 = 0;
  138. parm8 = IT_SUPER_NAILGUN;
  139.  
  140. }
  141. if ((deathmatch & DM_INFINITE_AMMO))
  142. {
  143. parm4 = 69;
  144. parm5 = 69;
  145. parm6 = 69;
  146. parm7 = 69;
  147. }
  148.  
  149. parm11 = self.motd_count;
  150. parm12 = self.sex;
  151. parm13 = self.best_wep;
  152. if (self.classname == "player")
  153. {
  154. parm9 = self.statstate; // status bar size
  155. parm14 = self.observer;
  156. parm15 = self.accesslvl;
  157. }
  158. //if (clienttype(self) == CLIENTTYPE_BOT)
  159. //set_player_main_index ();
  160.  
  161. parm16 = 0;
  162. bprint ("post-setnewparms \n");
  163. Dump_parms ();
  164.  
  165. };
  166.  
  167. void () DecodeLevelParms =
  168. {
  169.  
  170.  
  171.  
  172.  
  173. if (clienttype(self) == CLIENTTYPE_BOT)
  174. {
  175.  
  176. parm14 = self.games;
  177. parm15 = self.playtime;
  178. ReParseBotTalkname ();
  179. dprint ("Talkname is: ");
  180. dprint (self.talkname);
  181. dprint ("\n");
  182. }
  183. else
  184. {
  185. self.statstate = parm9; // status bar size
  186. self.player_flag = (self.player_flag | parm16);
  187. self.player_flag = (self.player_flag - (self.player_flag & ITEM_RUNE_MASK));
  188. self.player_flag = (self.player_flag - (self.player_flag & ITEM_ENEMY_FLAG));
  189. self.skin = ((self.player_flag & 65280) / DM_INFINITE_AMMO);
  190. self.accesslvl = parm15;
  191. self.observer = parm14;
  192. }
  193.  
  194.  
  195.  
  196.  
  197. self.sex = parm12;
  198.  
  199.  
  200. if (((parm13 > 0) && (parm13 < DO_VOID)))
  201. {
  202. self.best_wep = parm13;
  203. }
  204. else
  205. {
  206. self.best_wep = 1;
  207. }
  208. if ((parm11 != 0))
  209. {
  210. self.motd_count = parm11;
  211. }
  212. else
  213. {
  214. self.motd_count = 1;
  215. }
  216. SetNewParms ();
  217. self.items = parm1;
  218. self.health = parm2;
  219. self.armorvalue = parm3;
  220. self.ammo_shells = parm4;
  221. self.ammo_nails = parm5;
  222. self.ammo_rockets = parm6;
  223. self.ammo_cells = parm7;
  224. self.weapon = parm8;
  225. self.last_returned_flag = -10;
  226. self.last_fragged_carrier = -10;
  227. self.flag_since = -10;
  228. self.last_hurt_carrier = -10;
  229. if (TeamColorIsLegal (parm10))
  230. {
  231. self.lastteam = parm10;
  232. }
  233. // free up parm9
  234. if (self.items & IT_ARMOR1)
  235. self.armortype = 0.3;
  236. else if (self.items & IT_ARMOR2)
  237. self.armortype = 0.6;
  238. else if (self.items & IT_ARMOR3)
  239. self.armortype = 0.8;
  240. else
  241. self.armortype = 0;
  242. bprint ("decodelevelparms\n");
  243. Dump_parms ();
  244. };
  245.  
  246. entity () FindIntermission =
  247. {
  248. local entity spot;
  249. local float cyc;
  250.  
  251. spot = find (world, classname, "info_intermission");
  252. if (spot)
  253. {
  254. cyc = (random () * 4);
  255. while ((cyc > 1))
  256. {
  257. spot = find (spot, classname, "info_intermission");
  258. if (!spot)
  259. {
  260. spot = find (spot, classname, "info_intermission");
  261. }
  262. cyc = (cyc - 1);
  263. }
  264. return (spot);
  265. }
  266. spot = find (world, classname, "info_player_start");
  267. if (spot)
  268. {
  269. return (spot);
  270. }
  271. spot = find (world, classname, "testplayerstart");
  272. if (spot)
  273. {
  274. return (spot);
  275. }
  276. else
  277. {
  278. objerror ("Client.qc: No View Spot For Intermission");
  279. }
  280. return (world);
  281. };
  282.  
  283. void () GotoNextMap =
  284. {
  285. if ((cvar ("samelevel") == 1))
  286. {
  287. changelevel (mapname);
  288. }
  289. else
  290. {
  291. if (FindNextCTFBotMap ())
  292. {
  293. changelevel (nextmap);
  294. }
  295. else
  296. {
  297. if (((nextmap == "start") && (teamplay & TEAM_CAPTURE_CUSTOM)))
  298. {
  299. nextmap = "ctfstart";
  300. }
  301. else
  302. {
  303. if ((nextmap == "ctf9"))
  304. {
  305. nextmap = "ctf2m1";
  306. }
  307. else
  308. {
  309. if (((nextmap == "end") && (mapname == "start")))
  310. {
  311. nextmap = "dm1";
  312. }
  313. else
  314. {
  315. if (((nextmap == "rand") && (mapname == "start")))
  316. {
  317. localcmd ("samelevel -1\n");
  318. nextmap = "e1m1";
  319. }
  320. }
  321. }
  322. }
  323. }
  324. changelevel (nextmap);
  325. }
  326. };
  327.  
  328. void () ExitIntermission =
  329. {
  330. if ((self.health < 1))
  331. stuffcmd (self, "v_cshift \n");
  332.  
  333. WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  334. WriteByte (MSG_BROADCAST, TE_TELEPORT);
  335. WriteCoord (MSG_BROADCAST, self.origin_x);
  336. WriteCoord (MSG_BROADCAST, self.origin_y);
  337. WriteCoord (MSG_BROADCAST, self.origin_z);
  338. if (deathmatch)
  339. {
  340. GotoNextMap ();
  341. return;
  342. }
  343. intermission_exittime = (time + 1);
  344. intermission_running = (intermission_running + 1);
  345. GotoNextMap ();
  346. };
  347.  
  348. void () IntermissionThink =
  349. {
  350. if ((time < intermission_exittime))
  351. return;
  352.  
  353. if (((!self.button0 && !self.button1) && !self.button2))
  354. return;
  355.  
  356. ExitIntermission ();
  357. };
  358.  
  359. void () execute_changelevel =
  360. {
  361. local entity pos;
  362. local float cd;
  363. cd = ((random () * 3)) + 97;
  364. intermission_running = 1;
  365. intermission_exittime = (time + 15);
  366.  
  367.  
  368. pos = FindIntermission ();
  369. other = find (world, classname, "player");
  370. while ((other != world))
  371. {
  372. other.view_ofs = VEC_ORIGIN;
  373. other.v_angle = pos.mangle;
  374. other.angles = pos.mangle;
  375. other.fixangle = TRUE;
  376. other.nextthink = (time + 0.5);
  377. other.takedamage = DAMAGE_NO;
  378. other.solid = SOLID_NOT;
  379. other.movetype = MOVETYPE_NONE;
  380. other.modelindex = 0;
  381. setorigin (other, pos.origin);
  382. other = find (other, classname, "player");
  383. }
  384. WriteByte (MSG_ALL, SVC_CDTRACK);
  385. WriteByte (MSG_ALL, cd);
  386. WriteByte (MSG_ALL, cd);
  387. if (random () > 0.5 && (pointcontents (self.origin) == -1))
  388. lightstyle(0, "abcdefghijklmlkjihgfedcb");
  389. //pointsound (pos.origin,  "test.wav", 1, 0);
  390.  
  391.  
  392. WriteByte (MSG_ALL, 30);
  393. };
  394.  
  395. void () changelevel_touch =
  396. {
  397. local entity pos;
  398. local float noexit;
  399.  
  400. if ((other.classname != "player"))
  401. {
  402. return;
  403. }
  404. noexit = cvar ("noexit");
  405. if (((noexit == 1) || ((noexit == 2) && !gamestart)))
  406. {
  407. return;
  408. }
  409. if ((cvar ("temp1") < 65535))
  410. {
  411. bprint (other.netname);
  412. bprint (" exited the level\n");
  413. }
  414. nextmap = self.map;
  415. SUB_UseTargets ();
  416. if (((self.spawnflags & 1) && (deathmatch == 0)))
  417. {
  418. GotoNextMap ();
  419. return;
  420. }
  421. self.touch = SUB_Null;
  422. self.think = execute_changelevel;
  423. self.nextthink = (time + 0.1);
  424. };
  425.  
  426. void () trigger_changelevel =
  427. {
  428. if ((gamestart && !(teamplay & TEAM_CAPTURE_CUSTOM)))
  429. {
  430. if ((self.map == "e1m1"))
  431. {
  432. self.message = "E1 Dimension of the Doomed";
  433. }
  434. else
  435. {
  436. if ((self.map == "e2m1"))
  437. {
  438. self.message = "E2 The Realm of Black Magic";
  439. }
  440. else
  441. {
  442. if ((self.map == "e3m1"))
  443. {
  444. self.message = "E3 The Netherworld";
  445. }
  446. else
  447. {
  448. if ((self.map == "e4m1"))
  449. {
  450. self.message = "E4 The Elder World";
  451. }
  452. else
  453. {
  454. if ((self.map == "end"))
  455. {
  456. self.message = "The Deathmatch Arenas";
  457. }
  458. else
  459. {
  460. if ((self.map == "rand"))
  461. {
  462. self.message = "TEKBOT_CTF+ Best ID Levels";
  463. }
  464. else
  465. {
  466. self.message = "Unknown";
  467. }
  468. }
  469. }
  470. }
  471. }
  472. }
  473. self.classname = "trigger_voteexit";
  474. trigger_voteexit ();
  475. return;
  476. }
  477. if (!self.map)
  478. {
  479. objerror ("changelevel trigger doesn't have map");
  480. }
  481. InitTrigger ();
  482. self.touch = changelevel_touch;
  483. };
  484. void () set_suicide_frame;
  485.  
  486. void () respawn =
  487. {
  488. SetNewParms ();
  489. PutClientInServer ();
  490. self.sFloating = string_null;
  491.  
  492. stuffcmd (self, "v_cshift \n");
  493.  
  494. };
  495.  
  496. void () ClientKill =
  497. {
  498. if ((self.observer || intermission_running)) return;
  499.  
  500. if ((self.suicide_count > 3))
  501. {
  502. sprint (self, "You have suicided too much already.\n");
  503. return;
  504. }
  505. if (((self.sex == 2) && (temp1 & TEMP1_PLAYER2SOUNDS)))
  506. sound (self, CHAN_BODY, "player_f/death3.wav", 1, ATTN_IDLE);
  507. else
  508. sound (self, CHAN_BODY, "enforcer/death1.wav", 1, ATTN_IDLE);
  509. bprint (self.netname);
  510. bprint (" suicides\n");
  511. self.skin = self.skin + 1;
  512. DropRune ();
  513. TeamCaptureDropFlagOfPlayer (self);
  514. self.teleport_time = time + 1.5;
  515. set_suicide_frame ();
  516. set_player_main_index ();
  517. UpdateClientFrags (self, CONTENT_SOLID);
  518. self.suicide_count = (self.suicide_count + 1);
  519. self.num_suicides = (self.num_suicides + 1);
  520. respawn ();
  521. };
  522.  
  523. void () SilentKill =
  524. {
  525. set_suicide_frame ();
  526. set_player_main_index ();
  527. respawn ();
  528. };
  529.  
  530.  
  531. entity () SelectSpawnPoint =
  532. {
  533. local entity ssp;
  534. ssp= lastspawn;
  535.     return (ssp);
  536.  
  537. };
  538.  
  539.  
  540. void () PlayerDie;
  541.  
  542. void () PutClientInServer =
  543. {
  544. local entity spot;
  545. local string type;
  546. self.fChasing = 0;
  547.  
  548. bprint ("team ");
  549. bprint (ftos(self.team));
  550.  
  551.  
  552.  
  553.      
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.        
  562. if (clienttype(self) == CLIENTTYPE_REAL)
  563. {
  564. if (gamestart )
  565.   {
  566.    if (!(deathmatch & DM_SPAWN_RANDOM))
  567.   spot = TeamCaptureSpawn();
  568.    if ((deathmatch & DM_SPAWN_RANDOM))
  569.   spot = MultiSelectSpawnPoint ();
  570.    }
  571.    
  572.    
  573. if (parm10 == -1  || self.team == -1)
  574. {
  575.  
  576.          if (lastspawn != world)
  577.          spot = lastspawn;
  578.          if (runespawn != world)
  579.          spot = runespawn;
  580.         if (spot == world)
  581.            {
  582.             if (random () < 0.5)
  583.             spot = MultiSelectSpawnPoint ();
  584.             else
  585.             spot = HeadSelectSpawnPoint ();
  586.            }}
  587.  
  588.  
  589.       if (! gamestart && self.team > 1)
  590.     {
  591.     if (time < qtr_1)
  592.    spot = TeamCaptureSpawn();
  593.      else
  594.      spot = MultiSelectSpawnPoint ();
  595.   }
  596.  
  597. if (spot.origin == self.origin)
  598. {
  599. bprint  (self.netname);
  600. spot = HeadSelectSpawnPoint ();
  601. bprint (" tried to respawn at same location !\n");
  602. }
  603. if (spot.origin == world.origin)
  604. {
  605. spot = HeadSelectSpawnPoint ();
  606. bprint  (self.netname);
  607. bprint ("tried to respawn at world origin !\n");
  608. }
  609.  
  610.  
  611.        
  612. self.classname = "player";
  613. self.health = 100;
  614. self.takedamage = DAMAGE_AIM;
  615. self.solid = SOLID_SLIDEBOX;
  616. self.movetype = MOVETYPE_WALK;
  617. self.show_hostile = 0;
  618. self.max_health = 100;
  619. self.flags = FL_CLIENT;
  620. self.air_finished = (time + 12);
  621. self.sprint_finished = time;
  622. self.dmg = 2;
  623. self.super_damage_finished = 0;
  624. self.radsuit_finished = 0;
  625. self.invisible_finished = 0;
  626. self.invincible_finished = 0;
  627. self.effects = 0;
  628. self.invincible_time = 0;
  629. self.staydeadtime = 0;
  630. self.regen_time = 0;
  631. self.rune_notice_time = 0;
  632. self.hook_out = FALSE;
  633. self.observer_flags = 0;
  634. self.escort_time = (time - 999);
  635. self.last_hurt_carrier = -10;
  636. self.altweap = -1;
  637. self.onfire = FALSE;
  638. DecodeLevelParms ();
  639. W_SetCurrentAmmo ();
  640.  
  641.  
  642.  
  643. if (self.aflag)
  644. YCamChasePlayer ();
  645.  
  646.  
  647. self.attack_finished = time;
  648. self.th_pain = player_pain;
  649. self.th_die = PlayerDie;
  650. self.deadflag = DEAD_NO;
  651. self.pausetime = 0;
  652. self.fixangle = TRUE;
  653. self.punchangle = ' 0 0 0';
  654. self.velocity = '0 0 0';
  655. self.oldskin = self.skin;
  656. //setmodel (self, "progs/eyes.mdl");
  657. //modelindex_eyes = self.modelindex;
  658. if ((self.sex == 0))
  659. {
  660. self.sex = 1;
  661. }
  662. if ((temp1 & TEMP1_SUPPORT_PLAYER2))
  663. {
  664. setmodel (self, "progs/player_f.mdl");
  665. modelindex_playerf = self.modelindex;
  666. }
  667. if ((temp1 & TEMP1_SUPPORT_PLAYER3))
  668. {
  669. setmodel (self, "progs/player3.mdl");
  670. modelindex_player3 = self.modelindex;
  671. }
  672. if ((temp1 & TEMP1_SUPPORT_PLAYER4))
  673. {
  674. setmodel (self, "progs/player4.mdl");
  675. modelindex_player4 = self.modelindex;
  676. }
  677.  
  678. setmodel (self, "progs/player.mdl");
  679. modelindex_player = self.modelindex;
  680.  
  681. if ((temp1 & TEMP1_MULTI))
  682. {
  683. set_player_modelindexes ();
  684. }
  685. setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
  686. self.view_ofs = '0 0 22';
  687. self.spawntime = time + rint ((random () * 4));
  688. spot.spawn_time = spot.spawn_time + 5;
  689. self.origin = (spot.origin + '0 0 1');
  690. if (spot.classname == "info_teleport_destination")
  691. self.angles = spot.mangle;
  692. else
  693. self.angles = spot.angles;
  694. //self.angles = self.v_angle = spot.angles;  //
  695. player_stand1 ();
  696. if (self.do_observer || parm14 == 1)
  697. {
  698. BecomeObserver (self);
  699. return;
  700. }
  701. if ((deathmatch || coop))
  702. {
  703. makevectors (self.angles);
  704. spawn_tfog ((self.origin + (v_forward * 20)));
  705. }
  706. spawn_tdeath (self.origin, self);
  707. }
  708. if (clienttype(self) == CLIENTTYPE_BOT)
  709. {
  710.  
  711. DecodeLevelParms ();
  712. self.punchangle = ' 0 0 0';
  713. BotRespawn ();
  714. }
  715.  
  716.  
  717. };
  718.  
  719. void () info_player_start =
  720. {
  721. };
  722.  
  723. void () info_player_start2 =
  724. {
  725. };
  726.  
  727. void () testplayerstart =
  728. {
  729. setorigin (self, self.origin);
  730. };
  731.  
  732. void () info_player_deathmatch =
  733. {
  734. };
  735.  
  736. void () info_player_team1 =
  737. {
  738. };
  739.  
  740. void () info_player_team2 =
  741. {
  742. };
  743.  
  744. void () info_player_coop =
  745. {
  746. };
  747.  
  748. void () NextLevel =
  749. {
  750. local entity o;
  751.  
  752. if ((cvar ("samelevel") == -1))
  753. {
  754. if ((mapname == "e1m1"))
  755. {
  756. nextmap = "dm4";
  757. }
  758. else
  759. {
  760. if ((mapname == "dm4"))
  761. {
  762. nextmap = "e1m2";
  763. }
  764. else
  765. {
  766. if ((mapname == "e1m2"))
  767. {
  768. if ((random () < 0.5))
  769. {
  770. nextmap = "e1m5";
  771. }
  772. else
  773. {
  774. nextmap = "e2m7";
  775. }
  776. }
  777. else
  778. {
  779. if (((mapname == "e2m7") || (mapname == "e1m5")))
  780. {
  781. nextmap = "e3m6";
  782. }
  783. else
  784. {
  785. if ((mapname == "e3m6"))
  786. {
  787. nextmap = "e3m3";
  788. }
  789. else
  790. {
  791. if ((mapname == "e3m3"))
  792. {
  793. nextmap = "e4m2";
  794. }
  795. else
  796. {
  797. if ((mapname == "e4m2"))
  798. {
  799. nextmap = "end";
  800. }
  801. else
  802. {
  803. if ((mapname == "end"))
  804. {
  805. if ((random () < 0.5))
  806. {
  807. nextmap = "e2m1";
  808. }
  809. else
  810. {
  811. nextmap = "e1m7";
  812. }
  813. }
  814. else
  815. {
  816. nextmap = "start";
  817. localcmd ("samelevel 0\n");
  818. }
  819. }
  820. }
  821. }
  822. }
  823. }
  824. }
  825. }
  826. o = spawn ();
  827. o.map = nextmap;
  828. o.think = execute_changelevel;
  829. o.nextthink = (time + 0.1);
  830. return;
  831. }
  832. if ((mapname == "start"))
  833. {
  834. nextmap = "start";
  835. }
  836. if ((mapname == "e1m1"))
  837. {
  838. nextmap = "e1m2";
  839. }
  840. else
  841. {
  842. if ((mapname == "e1m2"))
  843. {
  844. nextmap = "e1m3";
  845. }
  846. else
  847. {
  848. if ((mapname == "e1m3"))
  849. {
  850. nextmap = "e1m4";
  851. }
  852. else
  853. {
  854. if ((mapname == "e1m4"))
  855. {
  856. nextmap = "e1m5";
  857. }
  858. else
  859. {
  860. if ((mapname == "e1m5"))
  861. {
  862. nextmap = "e1m6";
  863. }
  864. else
  865. {
  866. if ((mapname == "e1m6"))
  867. {
  868. nextmap = "e1m7";
  869. }
  870. else
  871. {
  872. if ((mapname == "e1m7"))
  873. {
  874. nextmap = "e1m8";
  875. }
  876. else
  877. {
  878. if ((mapname == "e1m8"))
  879. {
  880. nextmap = "start";
  881. }
  882. else
  883. {
  884. if ((mapname == "e2m1"))
  885. {
  886. nextmap = "e2m2";
  887. }
  888. else
  889. {
  890. if ((mapname == "e2m2"))
  891. {
  892. nextmap = "e2m3";
  893. }
  894. else
  895. {
  896. if ((mapname == "e2m3"))
  897. {
  898. nextmap = "e2m4";
  899. }
  900. else
  901. {
  902. if ((mapname == "e2m4"))
  903. {
  904. nextmap = "e2m5";
  905. }
  906. else
  907. {
  908. if ((mapname == "e2m5"))
  909. {
  910. nextmap = "e2m6";
  911. }
  912. else
  913. {
  914. if ((mapname == "e2m6"))
  915. {
  916. nextmap = "e2m7";
  917. }
  918. else
  919. {
  920. if ((mapname == "e2m7"))
  921. {
  922. nextmap = "start";
  923. }
  924. else
  925. {
  926. if ((mapname == "e3m1"))
  927. {
  928. nextmap = "e3m2";
  929. }
  930. else
  931. {
  932. if ((mapname == "e3m2"))
  933. {
  934. nextmap = "e3m3";
  935. }
  936. else
  937. {
  938. if ((mapname == "e3m3"))
  939. {
  940. nextmap = "e3m4";
  941. }
  942. else
  943. {
  944. if ((mapname == "e3m4"))
  945. {
  946. nextmap = "e3m5";
  947. }
  948. else
  949. {
  950. if ((mapname == "e3m5"))
  951. {
  952. nextmap = "e3m6";
  953. }
  954. else
  955. {
  956. if ((mapname == "e3m6"))
  957. {
  958. nextmap = "e3m7";
  959. }
  960. else
  961. {
  962. if ((mapname == "e3m7"))
  963. {
  964. nextmap = "start";
  965. }
  966. else
  967. {
  968. if ((mapname == "e4m1"))
  969. {
  970. nextmap = "e4m2";
  971. }
  972. else
  973. {
  974. if ((mapname == "e4m2"))
  975. {
  976. nextmap = "e4m3";
  977. }
  978. else
  979. {
  980. if ((mapname == "e4m3"))
  981. {
  982. nextmap = "e4m4";
  983. }
  984. else
  985. {
  986. if ((mapname == "e4m4"))
  987. {
  988. nextmap = "e4m5";
  989. }
  990. else
  991. {
  992. if ((mapname == "e4m5"))
  993. {
  994. nextmap = "e4m6";
  995. }
  996. else
  997. {
  998. if ((mapname == "e4m6"))
  999. {
  1000. nextmap = "e4m7";
  1001. }
  1002. else
  1003. {
  1004. if ((mapname == "e4m7"))
  1005. {
  1006. nextmap = "e4m8";
  1007. }
  1008. else
  1009. {
  1010. if ((mapname == "e4m8"))
  1011. {
  1012. nextmap = "start";
  1013. }
  1014. else
  1015. {
  1016. if ((mapname == "dm1"))
  1017. {
  1018. nextmap = "dm2";
  1019. }
  1020. else
  1021. {
  1022. if ((mapname == "dm2"))
  1023. {
  1024. nextmap = "dm3";
  1025. }
  1026. else
  1027. {
  1028. if ((mapname == "dm3"))
  1029. {
  1030. nextmap = "dm4";
  1031. }
  1032. else
  1033. {
  1034. if ((mapname == "dm4"))
  1035. {
  1036. nextmap = "dm5";
  1037. }
  1038. else
  1039. {
  1040. if ((mapname == "dm5"))
  1041. {
  1042. nextmap = "dm6";
  1043. }
  1044. else
  1045. {
  1046. if ((mapname == "dm6"))
  1047. {
  1048. nextmap = "end";
  1049. }
  1050. else
  1051. {
  1052. if ((mapname == "end"))
  1053. {
  1054. nextmap = "start";
  1055. }
  1056. else
  1057. {
  1058. if ((mapname == "babel"))
  1059. {
  1060. nextmap = "titan2";
  1061. }
  1062. else
  1063. {
  1064. if ((mapname == "titan2"))
  1065. {
  1066. nextmap = "ericctf1";
  1067. }
  1068. else
  1069. {
  1070. if ((mapname == "ericctf1"))
  1071. {
  1072. nextmap = "efdm11";
  1073. }
  1074. else
  1075. {
  1076. if ((mapname == "efdm11"))
  1077. {
  1078. nextmap = "efdm12";
  1079. }
  1080. else
  1081. {
  1082. if ((mapname == "efdm12"))
  1083. {
  1084. nextmap = "mayhem";
  1085. }
  1086. else
  1087. {
  1088. if ((mapname == "mayhem"))
  1089. {
  1090. nextmap = "argonaut";
  1091. }
  1092. else
  1093. {
  1094. if ((mapname == "argonaut"))
  1095. {
  1096. nextmap = "rc2";
  1097. }
  1098. else
  1099. {
  1100. if ((mapname == "rc2"))
  1101. {
  1102. nextmap = "start";
  1103. }
  1104. else
  1105. {
  1106. if ((mapname == "ctf1"))
  1107. {
  1108. nextmap = "ctf2";
  1109. }
  1110. else
  1111. {
  1112. if ((mapname == "ctf2"))
  1113. {
  1114. nextmap = "ctf3";
  1115. }
  1116. else
  1117. {
  1118. if ((mapname == "ctf3"))
  1119. {
  1120. nextmap = "ctf4";
  1121. }
  1122. else
  1123. {
  1124. if ((mapname == "ctf4"))
  1125. {
  1126. nextmap = "ctf5";
  1127. }
  1128. else
  1129. {
  1130. if ((mapname == "ctf5"))
  1131. {
  1132. nextmap = "ctf6";
  1133. }
  1134. else
  1135. {
  1136. if ((mapname == "ctf6"))
  1137. {
  1138. nextmap = "ctf7";
  1139. }
  1140. else
  1141. {
  1142. if ((mapname == "ctf7"))
  1143. {
  1144. nextmap = "ctf8";
  1145. }
  1146. else
  1147. {
  1148. if ((mapname == "ctf8"))
  1149. {
  1150. nextmap = "ctfstart";
  1151. }
  1152. else
  1153. {
  1154. if ((mapname == "ctf2m1"))
  1155. {
  1156. nextmap = "ctf2m2";
  1157. }
  1158. else
  1159. {
  1160. if ((mapname == "ctf2m2"))
  1161. {
  1162. nextmap = "ctf2m3";
  1163. }
  1164. else
  1165. {
  1166. if ((mapname == "ctf2m3"))
  1167. {
  1168. nextmap = "ctf2m4";
  1169. }
  1170. else
  1171. {
  1172. if ((mapname == "ctf2m4"))
  1173. {
  1174. nextmap = "ctf2m5";
  1175. }
  1176. else
  1177. {
  1178. if ((mapname == "ctf2m5"))
  1179. {
  1180. nextmap = "ctf2m6";
  1181. }
  1182. else
  1183. {
  1184. if ((mapname == "ctf2m6"))
  1185. {
  1186. nextmap = "ctf2m7";
  1187. }
  1188. else
  1189. {
  1190. if ((mapname == "ctf2m7"))
  1191. {
  1192. nextmap = "ctf2m8";
  1193. }
  1194. else
  1195. {
  1196. if ((mapname == "ctf2m8"))
  1197. {
  1198. nextmap = "ctfstart";
  1199. }
  1200. else
  1201. {
  1202. if ((mapname == "ctf3m1"))
  1203. {
  1204. nextmap = "ctf3m2";
  1205. }
  1206. else
  1207. {
  1208. if ((mapname == "ctf3m2"))
  1209. {
  1210. nextmap = "ctf3m3";
  1211. }
  1212. else
  1213. {
  1214. if ((mapname == "ctf3m3"))
  1215. {
  1216. nextmap = "ctf3m4";
  1217. }
  1218. else
  1219. {
  1220. if ((mapname == "ctf3m4"))
  1221. {
  1222. nextmap = "ctf3m5";
  1223. }
  1224. else
  1225. {
  1226. if ((mapname == "ctf3m5"))
  1227. {
  1228. nextmap = "ctf3m6";
  1229. }
  1230. else
  1231. {
  1232. if ((mapname == "ctf3m6"))
  1233. {
  1234. nextmap = "ctf3m7";
  1235. }
  1236. else
  1237. {
  1238. if ((mapname == "ctf3m7"))
  1239. {
  1240. nextmap = "ctf3m8";
  1241. }
  1242. else
  1243. {
  1244. if ((mapname == "ctf3m8"))
  1245. {
  1246. nextmap = "ctf3m9";
  1247. }
  1248. else
  1249. {
  1250. if ((mapname == "ctf3m9"))
  1251. {
  1252. nextmap = "ctf3m1";
  1253. }
  1254. else
  1255. {
  1256. if ((mapname == "xeno1"))
  1257. {
  1258. nextmap = "xeno2";
  1259. }
  1260. else
  1261. {
  1262. if ((mapname == "xeno2"))
  1263. {
  1264. nextmap = "xeno3";
  1265. }
  1266. else
  1267. {
  1268. if ((mapname == "xeno3"))
  1269. {
  1270. nextmap = "xeno4";
  1271. }
  1272. else
  1273. {
  1274. if ((mapname == "xeno4"))
  1275. {
  1276. nextmap = "xeno6";
  1277. }
  1278. else
  1279. {
  1280. if ((mapname == "xeno6"))
  1281. {
  1282. nextmap = "xeno7";
  1283. }
  1284. else
  1285. {
  1286. if ((mapname == "xeno7"))
  1287. {
  1288. nextmap = "xeno8";
  1289. }
  1290. else
  1291. {
  1292. if ((mapname == "xeno8"))
  1293. {
  1294. nextmap = "expctf1";
  1295. }
  1296. else
  1297. {
  1298. if ((mapname == "expctf1"))
  1299. {
  1300. nextmap = "expctf2";
  1301. }
  1302. else
  1303. {
  1304. if ((mapname == "expctf2"))
  1305. {
  1306. nextmap = "xeno1";
  1307. }
  1308. else
  1309. {
  1310. if ((mapname == "ctf1bsp0"))
  1311. {
  1312. nextmap = "ctf1bsp1";
  1313. }
  1314. else
  1315. {
  1316. if ((mapname == "ctf1bsp1"))
  1317. {
  1318. nextmap = "ctf1bsp2";
  1319. }
  1320. else
  1321. {
  1322. if ((mapname == "ctf1bsp2"))
  1323. {
  1324. nextmap = "ctf1bsp3";
  1325. }
  1326. else
  1327. {
  1328. if ((mapname == "ctf1bsp3"))
  1329. {
  1330. nextmap = "ctf1bsp4";
  1331. }
  1332. else
  1333. {
  1334. if ((mapname == "ctf1bsp4"))
  1335. {
  1336. nextmap = "ctf1bsp5";
  1337. }
  1338. else
  1339. {
  1340. if ((mapname == "ctf1bsp5"))
  1341. {
  1342. nextmap = "ctf1bsp6";
  1343. }
  1344. else
  1345. {
  1346. if ((mapname == "ctf1bsp6"))
  1347. {
  1348. nextmap = "ctf1bsp7";
  1349. }
  1350. else
  1351. {
  1352. if ((mapname == "ctf1bsp7"))
  1353. {
  1354. nextmap = "ctf1bsp8";
  1355. }
  1356. else
  1357. {
  1358. if ((mapname == "ctf1bsp8"))
  1359. {
  1360. nextmap = "ctf1bsp9";
  1361. }
  1362. else
  1363. {
  1364. if ((mapname == "ctf1bsp9"))
  1365. {
  1366. nextmap = "ctf1bspx";
  1367. }
  1368. else
  1369. {
  1370. if ((mapname == "ctf1bspx"))
  1371. {
  1372. nextmap = "ctf1bsp0";
  1373. }
  1374. }
  1375. }
  1376. }
  1377. }
  1378. }
  1379. }
  1380. }
  1381. }
  1382. }
  1383. }
  1384. }
  1385. }
  1386. }
  1387. }
  1388. }
  1389. }
  1390. }
  1391. }
  1392. }
  1393. }
  1394. }
  1395. }
  1396. }
  1397. }
  1398. }
  1399. }
  1400. }
  1401. }
  1402. }
  1403. }
  1404. }
  1405. }
  1406. }
  1407. }
  1408. }
  1409. }
  1410. }
  1411. }
  1412. }
  1413. }
  1414. }
  1415. }
  1416. }
  1417. }
  1418. }
  1419. }
  1420. }
  1421. }
  1422. }
  1423. }
  1424. }
  1425. }
  1426. }
  1427. }
  1428. }
  1429. }
  1430. }
  1431. }
  1432. }
  1433. }
  1434. }
  1435. }
  1436. }
  1437. }
  1438. }
  1439. }
  1440. }
  1441. }
  1442. }
  1443. }
  1444. }
  1445. }
  1446. }
  1447. }
  1448. }
  1449. }
  1450. }
  1451. }
  1452. }
  1453. }
  1454. }
  1455. }
  1456. }
  1457. }
  1458. }
  1459. }
  1460. }
  1461. }
  1462. }
  1463. o = spawn ();
  1464. o.map = nextmap;
  1465. o.think = execute_changelevel;
  1466. o.nextthink = (time + 0.1);
  1467. return;
  1468. };
  1469.  
  1470. void (float timer_f) DoTimerMessage =
  1471. {
  1472. local entity p;
  1473. local string st;
  1474.  
  1475. p = find (world, classname, "player");
  1476. while ((p != world))
  1477. {
  1478. sound (self, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NONE);
  1479. p = find (p, classname, "player");
  1480. }
  1481. if ((timer_f == 1))
  1482. {
  1483. bprint ("\n\n\n         ² ÍÉÎÕÔÅÓ òåíáéîéîç\n");
  1484. }
  1485. else
  1486. {
  1487. if ((timer_f == 2))
  1488. {
  1489. bprint ("\n\n\n         ± ÍÉÎÕÔÅ òåíáéîéîç\n");
  1490. }
  1491. else
  1492. {
  1493. if ((timer_f == 3))
  1494. {
  1495. bprint ("\n\n\n        ±° ÓÅÃÏÎÄÓ òåíáéîéîç\n");
  1496. }
  1497. else
  1498. {
  1499. return;
  1500. }
  1501. }
  1502. }
  1503. bprint ("           òåä: ");
  1504. st = ftos (teamscr1);
  1505. bprint (st);
  1506. bprint ("  âìõå: ");
  1507. st = ftos (teamscr2);
  1508. bprint (st);
  1509. bprint ("\n");
  1510. };
  1511.  
  1512. void () CheckRules =
  1513. {
  1514. local float timelimit;
  1515. local float fraglimit;
  1516. local entity o;
  1517.  
  1518. if ((gameover || pregameover)) return;
  1519.  
  1520.  
  1521.  
  1522. if (gamestart)
  1523. {
  1524. if ((((vote_leader != world) && voteexit_time) && (time > voteexit_time)))
  1525. {
  1526. pregameover = 1;
  1527. o = spawn ();
  1528. nextmap = vote_leader.map;
  1529. o.map = nextmap;
  1530. o.think = execute_changelevel;
  1531. o.nextthink = (time + 0.1);
  1532. return;
  1533. }
  1534. return;
  1535. }
  1536. timelimit = (cvar ("timelimit") * 60);
  1537. fraglimit = cvar ("fraglimit");
  1538. if ((timelimit > 120))
  1539. {
  1540. if (((time >= (timelimit - 120)) && (timer_flag == 0)))
  1541. {
  1542. timer_flag = 1;
  1543. DoTimerMessage (timer_flag);
  1544. return;
  1545. }
  1546. if (((time >= (timelimit - 60)) && (timer_flag == 1)))
  1547. {
  1548. timer_flag = 2;
  1549. DoTimerMessage (timer_flag);
  1550. return;
  1551. }
  1552. if (((time >= (timelimit - 10)) && (timer_flag == 2)))
  1553. {
  1554. timer_flag = 3;
  1555. DoTimerMessage (timer_flag);
  1556. return;
  1557. }
  1558. }
  1559. if ((temp1 & TEMP1_FRAGASCAPTURE))
  1560. {
  1561. if ((fraglimit && ((captures_red >= fraglimit) || (captures_blue >= fraglimit))))
  1562. {
  1563. pregameover = 1;
  1564. level_over_time = time;
  1565. TeamEndScore ();
  1566.  
  1567. NextLevel ();
  1568. return;
  1569. }
  1570. if ((timelimit && (time >= timelimit)))
  1571. {
  1572. pregameover = 1;
  1573. level_over_time = time;
  1574. TeamEndScore ();
  1575. NextLevel ();
  1576. return;
  1577. }
  1578. }
  1579. else
  1580. {
  1581. if (((timelimit && (time >= timelimit)) || (fraglimit && (self.frags >= fraglimit))))
  1582. {
  1583. pregameover = 1;
  1584. level_over_time = time;
  1585. TeamEndScore ();
  1586. NextLevel ();
  1587. return;
  1588. }
  1589. }
  1590. };
  1591.  
  1592. void () PlayerDeathThink =
  1593. {
  1594. local entity old_self;
  1595. local float forward;
  1596.  
  1597.  
  1598. if (self.flags & FL_ONGROUND)
  1599. {
  1600. forward = vlen (self.velocity);
  1601. forward = (forward - 20);
  1602. if ((forward <= 0))
  1603. self.velocity = VEC_ORIGIN;
  1604. else
  1605. self.velocity = (forward * normalize (self.velocity));
  1606. }
  1607.  
  1608.  
  1609. if ((self.model == "progs/flame2.mdl"))
  1610. {
  1611. if (((self.watertype == CONTENT_WATER) || (self.flags == FL_INWATER)))
  1612. {
  1613. sound (self, CHAN_AUTO, "player/slimbrn2.wav", TRUE, ATTN_NONE);
  1614. particle ((self.origin + '0 0 5'), VEC_ORIGIN, 110, 400);
  1615. DeathBubbles (2);
  1616. setmodel (self, "progs/zom_gib.mdl");
  1617. }
  1618. else
  1619. {
  1620. self.touch = torch_touch;
  1621. }
  1622. }
  1623.  
  1624.  
  1625.  
  1626.  
  1627. if ((self.deadflag == DEAD_DEAD))
  1628. {
  1629. if (((self.button2 || self.button1) || self.button0))
  1630. {
  1631. stuffcmd (self, "v_cshift 0 0 0 245\n");
  1632. return;
  1633. }
  1634. self.deadflag = DEAD_RESPAWNABLE;
  1635. return;
  1636. }
  1637.  
  1638. if (((!self.button2 && !self.button1) && !self.button0))
  1639. return;
  1640.  
  1641. self.button0 = 0;
  1642. self.button1 = 0;
  1643. self.button2 = 0;
  1644. respawn ();
  1645. };
  1646.  
  1647. void () PlayerJump =
  1648. {
  1649. local vector start;
  1650. local vector end;
  1651. if (self.movetype == MOVETYPE_NONE) return;
  1652.  
  1653. if (((self.classname == "bot") && (self.weapon != IT_HOOK)))
  1654. {
  1655. self.nextjump = (self.nextjump + 1);
  1656. if ((self.nextjump > 4))
  1657. return;
  1658.  
  1659. }
  1660. if ((self.flags & FL_WATERJUMP)) return;
  1661.  
  1662.  
  1663.  
  1664.  
  1665. if ((self.waterlevel >= 2))
  1666. {
  1667. if ((self.watertype == CONTENT_WATER))
  1668. {
  1669. self.velocity_z = 75;
  1670. }
  1671. if ((self.watertype == CONTENT_SLIME))
  1672. {
  1673. self.velocity_z = 50;
  1674. }
  1675. if ((self.watertype == CONTENT_LAVA))
  1676. {
  1677. self.velocity_z = 25;
  1678. }
  1679. else
  1680. {
  1681. self.velocity_z = 100;
  1682. }
  1683. if ((self.swim_flag < time))
  1684. {
  1685. self.swim_flag = (time + 1);
  1686. if ((random () < 0.5))
  1687. {
  1688. sound (self, CHAN_BODY, "misc/water1.wav", 1, ATTN_NORM);
  1689. }
  1690. else
  1691. {
  1692. sound (self, CHAN_BODY, "misc/water2.wav", 1, ATTN_NORM);
  1693. }
  1694. }
  1695. drip(self.origin,WATERCOLOR);
  1696. return;
  1697. }
  1698.  
  1699. if (!(self.flags & FL_ONGROUND)) return;
  1700. if (!(self.flags & FL_JUMPRELEASED)) return;// don't pogo stick
  1701.  
  1702.  
  1703. self.flags = (self.flags - (self.flags & FL_JUMPRELEASED));
  1704. self.flags = (self.flags - FL_ONGROUND);
  1705. self.button2 = 0;
  1706. if (((self.sex == 2) && (temp1 & TEMP1_PLAYER2SOUNDS)))
  1707. {
  1708. sound (self, CHAN_BODY, "player_f/plyrjmp8.wav", 1, ATTN_IDLE);
  1709. }
  1710. else
  1711. {
  1712. if (((self.sex == 3) && (temp1 & TEMP1_PLAYER3SOUNDS)))
  1713. {
  1714. sound (self, CHAN_BODY, "player3/plyrjmp8.wav", 1, ATTN_IDLE);
  1715. }
  1716. else
  1717. {
  1718. if (((self.sex == 4) && (temp1 & TEMP1_PLAYER4SOUNDS)))
  1719. {
  1720. sound (self, CHAN_BODY, "player4/plyrjmp8.wav", 1, ATTN_IDLE);
  1721. }
  1722. else
  1723. {
  1724. sound (self, CHAN_BODY, "player/plyrjmp8.wav", 1, ATTN_IDLE);
  1725. }
  1726. }
  1727. }
  1728. self.velocity_z = (self.velocity_z + 270);
  1729. };
  1730.  
  1731.  
  1732. .float dmgtime;
  1733.  
  1734.  
  1735.  
  1736. void () WaterMove =
  1737. {
  1738.  
  1739. if (self.items & IT_INVULNERABILITY)
  1740. {
  1741. self.air_finished = self.invincible_finished + 5;
  1742. return;
  1743. }
  1744.  
  1745. if ((self.movetype == MOVETYPE_NOCLIP))
  1746. return;
  1747.  
  1748. if ((self.health < 0))
  1749. {
  1750. return;
  1751. }
  1752. if ((time < self.watermove_time))
  1753. {
  1754. return;
  1755. }
  1756. self.watermove_time = (time + 0.3);
  1757. if ( self.waterlevel != 3 )
  1758. {
  1759. if ((self.air_finished < time))
  1760. {
  1761. if (((self.sex == 2) && (temp1 & TEMP1_PLAYER2SOUNDS)))
  1762. {
  1763. sound (self, CHAN_VOICE, "player_f/gasp2.wav", 1, ATTN_NORM);
  1764. }
  1765. else
  1766. {
  1767. if (((self.sex == 3) && (temp1 & TEMP1_PLAYER3SOUNDS)))
  1768. {
  1769. sound (self, CHAN_VOICE, "player3/gasp2.wav", 1, ATTN_NORM);
  1770. }
  1771. else
  1772. {
  1773. if (((self.sex == 4) && (temp1 & TEMP1_PLAYER4SOUNDS)))
  1774. {
  1775. sound (self, CHAN_VOICE, "player4/gasp2.wav", 1, ATTN_NORM);
  1776. }
  1777. else
  1778. {
  1779. sound (self, CHAN_VOICE, "player/gasp2.wav", 1, ATTN_NORM);
  1780. }
  1781. }
  1782. }
  1783. }
  1784. else
  1785. {
  1786. if ((self.air_finished < (time + TE_LIGHTNING3)))
  1787. {
  1788. if (((self.sex == 2) && (temp1 & TEMP1_PLAYER2SOUNDS)))
  1789. {
  1790. sound (self, CHAN_VOICE, "player_f/gasp1.wav", 1, ATTN_NORM);
  1791. }
  1792. else
  1793. {
  1794. if (((self.sex == 3) && (temp1 & TEMP1_PLAYER3SOUNDS)))
  1795. {
  1796. sound (self, CHAN_VOICE, "player3/gasp1.wav", 1, ATTN_NORM);
  1797. }
  1798. else
  1799. {
  1800. if (((self.sex == 4) && (temp1 & TEMP1_PLAYER4SOUNDS)))
  1801. {
  1802. sound (self, CHAN_VOICE, "player4/gasp1.wav", 1, ATTN_NORM);
  1803. }
  1804. else
  1805. {
  1806. sound (self, CHAN_VOICE, "player/gasp1.wav", 1, ATTN_NORM);
  1807. }
  1808. }
  1809. }
  1810. }
  1811. }
  1812.  
  1813. self.air_finished = (time + 12);
  1814. self.dmg = 2;
  1815. }
  1816. else
  1817. {
  1818. if ((self.air_finished < time))
  1819. {
  1820. if ((self.pain_finished < time))
  1821. {
  1822. self.dmg = (self.dmg + 2);
  1823. if ((self.dmg > 5))
  1824. {
  1825. self.dmg = 10;
  1826. }
  1827. if (((pointcontents (self.origin) != CONTENT_SLIME)) || ((pointcontents (self.origin) != CONTENT_LAVA)))
  1828. self.deathtype = "drowning";
  1829. T_Damage (self, world, world, self.dmg);
  1830. self.pain_finished = (time + 1);
  1831. }
  1832. }
  1833. }
  1834. if (!self.waterlevel)
  1835. {
  1836. if ((self.flags & FL_INWATER))
  1837. {
  1838.  
  1839. sound (self, CHAN_BODY, "misc/outwater.wav", 1, ATTN_NORM);
  1840. self.flags = (self.flags - FL_INWATER);
  1841. }
  1842. return;
  1843. }
  1844. if ((self.watertype == CONTENT_LAVA))
  1845. {
  1846. if ((self.dmgtime < time))
  1847. {
  1848. if ((self.radsuit_finished > time))
  1849. {
  1850. self.dmgtime = (time + 1);
  1851. }
  1852. else
  1853. {
  1854. self.dmgtime = (time + 0.2);
  1855. }
  1856. T_Damage (self, world, world, (10 * self.waterlevel));
  1857. }
  1858. }
  1859. else
  1860. {
  1861. if ((self.watertype == CONTENT_SLIME))
  1862. {
  1863. if (((self.dmgtime < time) && (self.radsuit_finished < time)))
  1864. {
  1865. self.dmgtime = (time + 1);
  1866. T_Damage (self, world, world, (4 * self.waterlevel));
  1867. }
  1868. }
  1869. }
  1870. if (!(self.flags & FL_INWATER))
  1871. {
  1872.  
  1873. if ((self.watertype == CONTENT_LAVA))
  1874. {
  1875. drip(self.origin,254);
  1876. if (((self.sex == 2) && (temp1 & TEMP1_PLAYER2SOUNDS)))
  1877. {
  1878. sound (self, CHAN_BODY, "player_f/inlava.wav", 1, ATTN_NORM);
  1879. }
  1880. else
  1881. {
  1882. if (((self.sex == 3) && (temp1 & TEMP1_PLAYER3SOUNDS)))
  1883. {
  1884. sound (self, CHAN_BODY, "player3/inlava.wav", 1, ATTN_NORM);
  1885. }
  1886. else
  1887. {
  1888. if (((self.sex == 4) && (temp1 & TEMP1_PLAYER4SOUNDS)))
  1889. {
  1890. sound (self, CHAN_BODY, "player4/inlava.wav", 1, ATTN_NORM);
  1891. }
  1892. else
  1893. {
  1894. sound (self, CHAN_BODY, "player/inlava.wav", 1, ATTN_NORM);
  1895. }
  1896. }
  1897. }
  1898. }
  1899. if ((self.watertype == CONTENT_WATER))
  1900. {
  1901. drip(self.origin,WATERCOLOR);
  1902. if (((self.sex == 2) && (temp1 & TEMP1_PLAYER2SOUNDS)))
  1903. {
  1904. sound (self, CHAN_BODY, "player_f/inh2o.wav", 1, ATTN_NORM);
  1905. }
  1906. else
  1907. {
  1908. if (((self.sex == 3) && (temp1 & TEMP1_PLAYER3SOUNDS)))
  1909. {
  1910. sound (self, CHAN_BODY, "player3/inh2o.wav", 1, ATTN_NORM);
  1911. }
  1912. else
  1913. {
  1914. if (((self.sex == 4) && (temp1 & TEMP1_PLAYER4SOUNDS)))
  1915. {
  1916. sound (self, CHAN_BODY, "player4/inh2o.wav", 1, ATTN_NORM);
  1917. }
  1918. else
  1919. {
  1920. sound (self, CHAN_BODY, "player/inh2o.wav", 1, ATTN_NORM);
  1921. }
  1922. }
  1923. }
  1924. }
  1925. if ((self.watertype == CONTENT_SLIME))
  1926. {
  1927. drip(self.origin,186);
  1928.  
  1929. if (((self.sex == 2) && (temp1 & TEMP1_PLAYER2SOUNDS)))
  1930. {
  1931. sound (self, CHAN_BODY, "player_f/slimbrn2.wav", 1, ATTN_NORM);
  1932. }
  1933. else
  1934. {
  1935. if (((self.sex == 3) && (temp1 & TEMP1_PLAYER3SOUNDS)))
  1936. {
  1937. sound (self, CHAN_BODY, "player3/slimbrn2.wav", 1, ATTN_NORM);
  1938. }
  1939. else
  1940. {
  1941. if (((self.sex == 4) && (temp1 & TEMP1_PLAYER4SOUNDS)))
  1942. {
  1943. sound (self, CHAN_BODY, "player4/slimbrn2.wav", 1, ATTN_NORM);
  1944. }
  1945. else
  1946. {
  1947. sound (self, CHAN_BODY, "player/slimbrn2.wav", 1, ATTN_NORM);
  1948. }
  1949. }
  1950. }
  1951. }
  1952. self.flags = (self.flags + FL_INWATER);
  1953. self.dmgtime = 0;
  1954. }
  1955. if (!(self.flags & FL_WATERJUMP))
  1956. self.velocity = (self.velocity - (((0.01 * self.waterlevel) * frametime) * self.velocity));
  1957.  
  1958. };
  1959.  
  1960. void () CheckWaterJump =
  1961. {
  1962. local vector start;
  1963. local vector end;
  1964.  
  1965. makevectors (self.angles);
  1966. start = self.origin;
  1967. start_z = (start_z + DO_VOID);
  1968. v_forward_z = 0;
  1969. normalize (v_forward);
  1970. end = (start + (v_forward * 24));
  1971. traceline (start, end, TRUE, self);
  1972.  
  1973.  
  1974. if ((trace_fraction < 1))
  1975. {
  1976. start_z = ((start_z + self.maxs_z) - DO_VOID);
  1977. end = (start + (v_forward * 24));
  1978. self.movedir = (trace_plane_normal * -50);
  1979. traceline (start, end, TRUE, self);
  1980. if ((trace_fraction == 1))
  1981. {
  1982. self.flags = (self.flags | FL_WATERJUMP);
  1983. self.velocity_z = 225;
  1984. //bprint ("|WATERJUMP|");
  1985. //bprint ("\n");
  1986. self.flags = (self.flags - (self.flags & FL_JUMPRELEASED));
  1987. self.teleport_time = (time + 2);
  1988. if ((self.deadflag != DEAD_DEAD))
  1989. drip(self.origin,WATERCOLOR);
  1990. return;
  1991. }
  1992. }
  1993.  
  1994. };
  1995.  
  1996. void () updatebreath =
  1997. {
  1998. local string cal;
  1999.  
  2000.  
  2001.  
  2002.  
  2003.  
  2004. if (self.velocity != '0 0 0')
  2005. if (time < self.sprint_finished)
  2006. {
  2007. if ((time > (self.sprint_finished - 15)))
  2008.         {
  2009.             cal = "     ‹‹‹‹‹‹‹‹‹‹‹‹ ";
  2010.         }
  2011.         if ((time > (self.sprint_finished - 14)))
  2012.         {
  2013.             cal = "     ‹‹‹‹‹‹‹‹‹‹‹  ";
  2014.         }
  2015.         if ((time > (self.sprint_finished - 13)))
  2016.         {
  2017.             cal = "     ‹‹‹‹‹‹‹‹‹‹   ";
  2018.         }
  2019.         if ((time > (self.sprint_finished - 12)))
  2020.         {
  2021.             cal = "     ‹‹‹‹‹‹‹‹‹    ";
  2022.         }
  2023.         if ((time > (self.sprint_finished - 11)))
  2024.         {
  2025.        
  2026.             cal = "     ‹‹‹‹‹‹‹‹     ";
  2027.         }
  2028.         if ((time > (self.sprint_finished - 10)))
  2029.         {
  2030.             cal = "     ‹‹‹‹‹‹‹      ";
  2031.         }
  2032.         if ((time > (self.sprint_finished - 9)))
  2033.         {
  2034.             cal = "     ‹‹‹‹‹‹       ";
  2035.         }
  2036.         if ((time > (self.sprint_finished - 8)))
  2037.         {
  2038.             cal = "     ‹‹‹‹‹        ";
  2039.         }
  2040.         if ((time > (self.sprint_finished - 6)))
  2041.         {
  2042.             cal = "     ‹‹‹‹         ";
  2043.         }
  2044.         if ((time > (self.sprint_finished - 4)))
  2045.         {
  2046.        
  2047.        
  2048.             cal = "     ‹‹‹          ";
  2049.         }
  2050.         if ((time > (self.sprint_finished - 3)))
  2051.         {
  2052.             cal = "     ‹‹           ";
  2053.         }
  2054.         if ((time > (self.sprint_finished - 1)))
  2055.         {
  2056. if (self.walkvalue < 161)
  2057. sound(self, CHAN_AUTO, "breath3.wav", 0.5, ATTN_IDLE);
  2058.  
  2059.             cal = "                  ";
  2060.         }
  2061.         if (((time == self.sprint_finished)) || ((pointcontents (self.origin) == CONTENT_LAVA)))
  2062.         {
  2063.        
  2064.             cal = "0";
  2065.             bprint ("cal: ");
  2066.             bprint (cal);
  2067.             bprint ("\n");
  2068.             if (!self.waterlevel & self.stamina < time)
  2069.             sound(self, CHAN_AUTO, "breath3f.wav", 0.5, ATTN_IDLE);
  2070.             self.walktime = -1;
  2071.             self.stamina = time;
  2072.         }
  2073.         if ((cal != "0"))
  2074.         {
  2075.             centerprintcat (self, "STAMINAü\n", cal);
  2076.         }
  2077.        
  2078.     }
  2079.  
  2080.  
  2081.  
  2082.  
  2083. /*
  2084. if (self.velocity != '0 0 0')
  2085. {
  2086. local float x;
  2087. bprint ("Walkvalue ");
  2088. bprint (ftos (self.walkvalue));
  2089. bprint (" :: ");
  2090. bprint ("Runvalue ");
  2091. bprint (ftos (self.runvalue));
  2092. bprint (" :: ");
  2093. x = self.runvalue - self.walkvalue;
  2094. bprint ("DIFFERENCE >> ");
  2095. bprint (ftos (x));
  2096. bprint ("\n");
  2097. }
  2098. */
  2099.  
  2100.  
  2101. };
  2102.  
  2103.  
  2104.  
  2105. void () PlayerPreThink =
  2106. {
  2107. local float mspeed;
  2108. local float aspeed;
  2109. local float r;
  2110. local string s;
  2111.  
  2112.  
  2113. if (clienttype(self) == CLIENTTYPE_BOT )
  2114. {
  2115. if (intermission_running && self.takedamage != DAMAGE_NO)
  2116. {
  2117. self.message = "Playerprethink:";
  2118. BotSayGoodGame ();
  2119. }
  2120. }
  2121.  
  2122. else
  2123. {
  2124. //bprint ("self.waterlevel ");
  2125. //bprint (ftos (self.waterlevel));
  2126. //bprint ("\n");
  2127. floaterPreThink ();
  2128.  
  2129. if (intermission_running)
  2130. {
  2131. IntermissionThink ();
  2132. return;
  2133. }
  2134.  
  2135.  
  2136.  
  2137. if (self.movetype == MOVETYPE_NONE && self.nextfootstep < time)
  2138. {
  2139. self.view_ofs = '0 0 22';
  2140. self.movetype = MOVETYPE_WALK;
  2141. sound(self, CHAN_DEV, "breath3.wav", 0.5, ATTN_IDLE);
  2142. }
  2143. if ((self.staydeadtime && (self.staydeadtime > time)))
  2144. {
  2145. self.jump_flag = 0;
  2146. if (random() < 0.1)
  2147. sound (self, 0, "soldier/idle.wav", 1, (rint(random())+ 1));
  2148. return;
  2149. }
  2150. if ((coop && TEAM_STRICT_COOP))
  2151. {
  2152. return;
  2153. }
  2154. if (((time > qtr_1) && (time < (qtr_1 + 3))))
  2155. {
  2156. centerprint (self, "1st Quarter has ended.");
  2157. }
  2158. if (((time > qtr_3) && (time < (qtr_3 + 3))))
  2159. {
  2160. centerprint (self, "3rd Quarter has ended.");
  2161. }
  2162. TeamCapturePlayerUpdate ();
  2163. if (self.CamState)
  2164. {
  2165. if ((self.CamState > 2))
  2166. {
  2167. CamPreThink ();
  2168. }
  2169. return;
  2170. }
  2171. if ((self.view_ofs == VEC_ORIGIN)) return;
  2172.  
  2173. if (self.aflag)
  2174. {
  2175. YCamChasePlayer ();
  2176. }
  2177. makevectors (self.v_angle);
  2178. CheckRules ();
  2179.  
  2180. WaterMove ();
  2181.  
  2182. SpawnFollowEntity ();
  2183. PrintCloseWaypoint ();
  2184.  
  2185. TeamCheckLock ();
  2186. if ((self.waterlevel == 2))
  2187. {
  2188. CheckWaterJump ();
  2189. }
  2190. if ((self.deadflag >= DEAD_DEAD))
  2191. {
  2192. PlayerDeathThink ();
  2193. return;
  2194. }
  2195. if (self.observer)
  2196. {
  2197.  
  2198. if ((self.CamState <= 2))
  2199. {
  2200. ObserverThink ();
  2201. }
  2202. return;
  2203. }
  2204. if ((self.deadflag == DEAD_DYING))
  2205. {
  2206. return;
  2207. }
  2208.  
  2209. if (self.button2)
  2210. PlayerJump ();
  2211. else
  2212. {
  2213. self.flags = (self.flags | FL_JUMPRELEASED);
  2214. }
  2215. if ((time < self.pausetime))
  2216. {
  2217. self.velocity = VEC_ORIGIN;
  2218. }
  2219. if (((((time > self.attack_finished) && (self.currentammo == 0)) && (self.weapon != IT_AXE)) && (self.weapon != IT_HOOK)))
  2220. {
  2221. self.weapon = W_BestWeapon ();
  2222. W_SetCurrentAmmo ();
  2223. }
  2224.  
  2225. }
  2226.  
  2227. };
  2228.  
  2229. void () CheckPowerups =
  2230. {
  2231. local float m;
  2232. local float v;
  2233.  
  2234. if (((self.health <= 0) || self.observer)) return;
  2235.  
  2236. if ((self.player_flag & ITEM_RUNE1_FLAG))
  2237. {
  2238. if ((self.attacked - 1.5) > time)
  2239. BlinkRune(32);
  2240. else self.items2 = 32;
  2241. }
  2242.  
  2243.  
  2244.  
  2245. if (self.player_flag & ITEM_RUNE2_FLAG)
  2246. {
  2247. if (time < self.attack_finished)
  2248. BlinkRune(64);
  2249. else self.items2 = 64;
  2250. }
  2251.  
  2252. if ((self.player_flag & ITEM_RUNE3_FLAG))
  2253. {
  2254. if (time < self.attack_finished)
  2255. BlinkRune(128);
  2256. else self.items2 = 128;
  2257. }
  2258.  
  2259.  
  2260.  
  2261.  
  2262. if ((self.player_flag & ITEM_RUNE4_FLAG))
  2263. {
  2264. if ((self.regen_time < time))
  2265.   {
  2266. BlinkRune(256);
  2267. if ((self.velocity != VEC_ORIGIN))
  2268. m = 2;
  2269. else
  2270. m = 5;
  2271. if ((self.classname == "bot"))
  2272. m = (m * 1.125);
  2273. if ((self.attack_finished > time))
  2274. m = (m * 0.5);
  2275. self.regen_time = time;
  2276. if ((self.health < 150))
  2277. {
  2278.  
  2279. self.health = (self.health + m);
  2280. if ((self.health > 150))
  2281. self.health = 150;
  2282. self.regen_time = (self.regen_time + 0.5);
  2283. RegenerationSound ();
  2284. }
  2285. if ((self.armortype < 0.6))
  2286. v = 100;
  2287. else
  2288. v = (self.armortype * 250);
  2289.  
  2290. if (((self.armorvalue < v) && (self.armortype != 0)))
  2291.  {
  2292. self.armorvalue = (self.armorvalue + m);
  2293. if (self.armorvalue >= v)
  2294. sound (self, CHAN_AUTO, "items/armor1.wav", 1, ATTN_STATIC);
  2295. else if (time > self.attack_finished)
  2296. sound (self, CHAN_AUTO, "items/itembk2.wav", 1, ATTN_STATIC);
  2297.  
  2298. if ((self.armorvalue > v))
  2299. self.armorvalue = v;
  2300. if ((v == 100))
  2301. self.regen_time = (self.regen_time + 0.35);
  2302. else
  2303.    {
  2304. self.regen_time = (self.regen_time + (v * 0.0055));
  2305.  
  2306. //RegenerationSound ();
  2307.  
  2308.    }
  2309.  }
  2310. }
  2311. else self.items2 = 256;
  2312.  
  2313.  
  2314.  
  2315. }
  2316. if (self.invisible_finished)
  2317. {
  2318.    if ((self.invisible_sound < time))
  2319.   {
  2320.   if (random () < 0.5)
  2321.    sound (self, CHAN_AUTO, "items/inv3.wav", 0.5, SUB_Db());
  2322.    else
  2323.     sound (self, CHAN_AUTO, "newring.wav", 0.5, SUB_Db());
  2324.     self.invisible_sound = (time + ((random () * 2) + 7));
  2325.    }
  2326. if ((self.invisible_finished < (time + 3)))
  2327. {
  2328. if ((self.invisible_time == 1))
  2329. {
  2330. if ((self.classname == "player"))
  2331. sprint (self, "Ring of Shadows magic is fading\n");
  2332. if ((self.classname == "player"))
  2333. stuffcmd (self, "bf\n");
  2334.  
  2335. sound (self, CHAN_AUTO, "items/inv2.wav", 1, SUB_Db());
  2336. self.invisible_time = (time + 1);
  2337. }
  2338. if ((self.invisible_time < time))
  2339. {
  2340. self.invisible_time = (time + 1);
  2341. if ((self.classname == "player"))
  2342. {
  2343. stuffcmd (self, "bf\n");
  2344. }
  2345. }
  2346. }
  2347. if ((self.invisible_finished < time))
  2348. {
  2349. self.items = (self.items - IT_INVISIBILITY);
  2350. self.invisible_finished = 0;
  2351. self.invisible_time = 0;
  2352. self.skin = self.oldskin;
  2353.  
  2354. }
  2355.  
  2356.  
  2357. }
  2358. else if ((temp1 & TEMP1_MULTI))
  2359. self.modelindex = self.modelindex_thisplayer;
  2360. else
  2361. set_player_main_index ();
  2362.  
  2363.  
  2364.  
  2365. if (self.invincible_finished)
  2366. {
  2367. if ((self.invincible_finished < (time + 3)))
  2368. {
  2369. if ((self.invincible_time == 1))
  2370. {
  2371. if ((self.classname == "player"))
  2372. {
  2373. sprint (self, "Protection is almost burned out\n");
  2374. }
  2375. if ((self.classname == "player"))
  2376. {
  2377. stuffcmd (self, "bf\n");
  2378. }
  2379. sound (self, CHAN_AUTO, "items/protect2.wav", 1, ATTN_NORM);
  2380. self.invincible_time = (time + 1);
  2381. }
  2382. if ((self.invincible_time < time))
  2383. {
  2384. self.invincible_time = (time + 1);
  2385. if ((self.classname == "player"))
  2386. {
  2387. stuffcmd (self, "bf\n");
  2388. }
  2389. }
  2390. }
  2391. if ((self.invincible_finished < time))
  2392. {
  2393. self.items = (self.items - IT_INVULNERABILITY);
  2394. self.invincible_time = 0;
  2395. self.invincible_finished = 0;
  2396. }
  2397. }
  2398. if (self.super_damage_finished)
  2399. {
  2400. if ((self.super_damage_finished < (time + 3)))
  2401. {
  2402. if ((self.super_time == 1))
  2403. {
  2404. if ((self.classname == "player"))
  2405. {
  2406. sprint (self, "Quad Damage is wearing off\n");
  2407. }
  2408. if ((self.classname == "player"))
  2409. {
  2410. stuffcmd (self, "bf\n");
  2411. }
  2412. sound (self, CHAN_AUTO, "items/damage2.wav", 1, ATTN_NORM);
  2413. self.super_time = (time + 1);
  2414. }
  2415. if ((self.super_time < time))
  2416. {
  2417. self.super_time = (time + 1);
  2418. if ((self.classname == "player"))
  2419. {
  2420. stuffcmd (self, "bf\n");
  2421. }
  2422. }
  2423. }
  2424. if ((self.super_damage_finished < time))
  2425. {
  2426. self.items = (self.items - IT_QUAD);
  2427. self.super_damage_finished = 0;
  2428. self.super_time = 0;
  2429. }
  2430. }
  2431. if (self.radsuit_finished)
  2432. {
  2433. self.air_finished = (time + 12);
  2434. if ((self.radsuit_finished < (time + 3)))
  2435. {
  2436. if ((self.rad_time == 1))
  2437. {
  2438. if ((self.classname == "player"))
  2439. {
  2440. sprint (self, "Air supply in Biosuit expiring\n");
  2441. }
  2442. if ((self.classname == "player"))
  2443. {
  2444. stuffcmd (self, "bf\n");
  2445. }
  2446. sound (self, CHAN_AUTO, "items/suit2.wav", 1, ATTN_IDLE);
  2447. self.rad_time = (time + 1);
  2448. }
  2449. if ((self.rad_time < time))
  2450. {
  2451. self.rad_time = (time + 1);
  2452. if ((self.classname == "player"))
  2453. {
  2454. stuffcmd (self, "bf\n");
  2455. }
  2456. }
  2457. }
  2458. if ((self.radsuit_finished < time))
  2459. {
  2460. self.items = (self.items - IT_SUIT);
  2461. self.rad_time = 0;
  2462. self.radsuit_finished = 0;
  2463. }
  2464. }
  2465. CheckDimLight ();
  2466. };
  2467. //FOOTSTEPS!!
  2468. void() playerfootstep =
  2469. {
  2470.  
  2471. local float amp;   
  2472.     if (self.deadflag || self.classname != "player")
  2473.         return;
  2474.     if (!(self.flags & FL_ONGROUND))
  2475.         return;
  2476.     if (time < self.nextfootstep || time < self.attack_finished)
  2477.         return;
  2478. local float s;
  2479. //local float walk;
  2480. //local float run;
  2481.  
  2482. if (!self.waterlevel && (checkbottom (self)) && self.velocity != '0 0 0')
  2483. {
  2484.  
  2485. if (vlen(self.velocity) < 300)
  2486. {
  2487. amp = 3;
  2488.  
  2489.     self.nextfootstep = time + 0.3;
  2490.     if (self.runtime > self.sprint_finished && self.walktime == -1)
  2491.     {
  2492.     self.sprint_finished = time + (self.runtime - self.sprint_finished) - 1;
  2493.     if (self.runtime - self.sprint_finished >= 15)
  2494.     {
  2495.     self.sprint_finished = 15;
  2496.    
  2497.     }
  2498.     }
  2499.     self.walkvalue = (vlen(self.velocity));
  2500.    
  2501.  
  2502.    
  2503.    
  2504.    
  2505. if (vlen(self.velocity) < 13 && self.velocity != '0 0 0')
  2506. {
  2507. if (vlen(self.velocity) < 5)
  2508. self.nextfootstep = time + 0.6;
  2509. else
  2510. self.nextfootstep = time + ((vlen(self.velocity) / 9.5));
  2511. s = -1;
  2512. }    
  2513.     }
  2514. if (vlen(self.velocity) > 300)
  2515. {
  2516. amp = 4;
  2517. if (self.runvalue == 0 && self.walktime != -1) // From standing still and didnt just finish sprinting
  2518. {
  2519. self.sprint_finished = time + 15;
  2520. self.runtime = self.sprint_finished + 15;
  2521. }
  2522. else if (self.walktime == -1)
  2523. {
  2524. if (!self.velocity)
  2525. {
  2526. self.sprint_finished = time +2;
  2527. if (self.sprint_finished > self.stamina + 15)
  2528. {
  2529. self.sprint_finished = self.stamina + 15;
  2530. self.walktime = 0;
  2531. }
  2532.  }
  2533.  else if (self.velocity)
  2534.  {
  2535.  self.sprint_finished = time +1;
  2536. if (self.sprint_finished > self.stamina + 15)
  2537. {
  2538. self.sprint_finished = self.stamina + 15;
  2539.  self.walktime = 0;
  2540.  }
  2541.  }
  2542.  
  2543.  }
  2544.  
  2545.  //else we are already running
  2546.  
  2547. self.nextfootstep = time + 0.15;
  2548. self.runvalue = (vlen(self.velocity));
  2549. updatebreath();
  2550.  
  2551. }
  2552. /*
  2553. .float stamina;
  2554. .float walkvalue;
  2555. .float runvalue;
  2556. .float sprint_finished;
  2557. .float walktime;
  2558. .float runtime;
  2559. */
  2560.     if (s != -1)
  2561.     {
  2562.     s = random() * 4;
  2563.     // ATTN_IDLE to make them short range
  2564.     if (s < 1) sound(self, CHAN_BODY, "boot1.wav", 0.5, amp);
  2565.     else if (s < 2) sound(self, CHAN_DEV, "boot2.wav", 0.5, amp);
  2566.     else if (s < 3) sound(self, CHAN_DEV, "boot3.wav", 0.5, amp);
  2567.     else            sound(self, CHAN_DEV, "boot4.wav", 0.5, amp);
  2568. }
  2569. else
  2570. sound(self, CHAN_AUTO, "slip.wav", 0.5, amp);  
  2571. }
  2572. else if (!self.waterlevel && (checkbottom (self)) && self.velocity == '0 0 0')
  2573. {
  2574. if (self.runvalue || self.walkvalue)
  2575. sound(self, CHAN_AUTO, "breath2f.wav", 1, ATTN_IDLE);
  2576. self.walkvalue = 0;
  2577. self.runvalue = 0;
  2578. //self.walktime = -1;
  2579. //self.runtime = -1;
  2580. }
  2581.  
  2582. };
  2583.  
  2584.  
  2585. void () PlayerPostThink =
  2586. {
  2587.  
  2588. local float mspeed;
  2589. local float aspeed;
  2590. local float r;
  2591. local string num;
  2592. local string n;
  2593. local string l;
  2594.  
  2595. if (clienttype(self) == CLIENTTYPE_BOT && !self.deadflag)
  2596. {
  2597.  
  2598. /*
  2599. bprint (self.netname);
  2600. bprint (" - ");
  2601. if (self.bot_action == BOT_MOVING)
  2602. bprint (" MOVING ");
  2603. if (self.bot_action == BOT_FIGHTING)
  2604. bprint (" FIGHTING ");
  2605. bprint (self.goalentity.classname);
  2606. bprint (" - ");
  2607. bprint  (ftos (self.yaw_speed));
  2608. bprint (" - ");
  2609. bprint  (ftos (self.angles_y));
  2610. bprint ("\n");
  2611. */
  2612.  
  2613.  
  2614.  
  2615. }
  2616. else
  2617. {
  2618. if (self.netname == "")
  2619. {
  2620. msg_entity = self;
  2621.  
  2622.  
  2623. stuffcmd (self,"echo !NETNAME\n");
  2624. WriteByte(MSG_ONE, -2);
  2625. WriteByte(MSG_ONE, 0);
  2626. }
  2627.  
  2628.  
  2629. if (time < self.cshift && self.cshift_num == -255)
  2630. stuffcmd (self, "v_cshift \n");
  2631.  
  2632.  
  2633.  
  2634. if ((time < (self.attack_finished + 4.5)))
  2635. {
  2636. if (self.crosshair)
  2637. {
  2638.  
  2639. stuffcmd (self, "crosshair "); 
  2640. stuffcmd (self, ftos(self.crosshairtype));
  2641. stuffcmd (self, "\n");
  2642. }
  2643. }
  2644. else if (self.crosshair)
  2645. {
  2646. stuffcmd (self, "crosshair 0\n");
  2647. }
  2648. if ((self.CamState > 2))
  2649. {
  2650. CamThink ();
  2651. return;
  2652. }
  2653. if ((self.CamState == 2))
  2654. {
  2655. InitCamClient ();
  2656. return;
  2657. }
  2658. if ((self.view_ofs == VEC_ORIGIN))
  2659. {
  2660. return;
  2661. }
  2662. if (self.deadflag)
  2663. {
  2664. return;
  2665. }
  2666. if (self.aflag)
  2667. {
  2668. YCamChasePlayer ();
  2669. }
  2670. if ((self.team > 0)) W_WeaponFrame ();
  2671.  
  2672. if ((((self.jump_flag < -300) && (self.flags & FL_ONGROUND)) && (self.health > 0)))
  2673. {
  2674. if ((self.watertype == CONTENT_WATER))
  2675. {
  2676. if (((self.sex == 2) && (temp1 & TEMP1_PLAYER2SOUNDS)))
  2677. {
  2678. sound (self, CHAN_BODY, "player_f/h2ojump.wav", 1, ATTN_NORM);
  2679. }
  2680. else
  2681. {
  2682. if (((self.sex == 3) && (temp1 & TEMP1_PLAYER3SOUNDS)))
  2683. {
  2684. sound (self, CHAN_BODY, "player3/h2ojump.wav", 1, ATTN_NORM);
  2685. }
  2686. else
  2687. {
  2688. if (((self.sex == 4) && (temp1 & TEMP1_PLAYER4SOUNDS)))
  2689. {
  2690. sound (self, CHAN_BODY, "player4/h2ojump.wav", 1, ATTN_NORM);
  2691. }
  2692. else
  2693. {
  2694. sound (self, CHAN_BODY, "player/h2ojump.wav", 1, ATTN_NORM);
  2695. }
  2696. }
  2697. }
  2698. }
  2699. else
  2700. {
  2701. if (((self.jump_flag < -650) && !(deathmatch & DM_NO_FALLING)))
  2702. {
  2703. local float d;
  2704. local float m
  2705. if (self.jump_flag < -650 && self.jump_flag > -700)
  2706. m = -0.01;
  2707. else if (self.jump_flag < -700 && self.jump_flag > -825)
  2708. m = -0.02;
  2709. else if (self.jump_flag < -825 && self.jump_flag > -900)
  2710. m = -0.035;
  2711. else if (self.jump_flag < -900)
  2712. m = -0.1;
  2713.  
  2714. d = floor(self.jump_flag * m);
  2715.  
  2716. self.deathtype = "falling";
  2717. T_Damage (self, world, world, d);
  2718. if (self.classname == "player")
  2719. {
  2720. self.punchangle = vectoangles(self.velocity) * m;
  2721. self.punchangle_z = d * -0.44;
  2722. sound (self, CHAN_BODY, "zombie/z_miss.wav", TRUE, ATTN_NORM);
  2723. self.view_ofs = '0 0 8';
  2724. self.frame = 60;
  2725. self.movetype = MOVETYPE_NONE;
  2726. self.nextthink = time + (m * -100);
  2727. self.nextfootstep = self.nextthink;
  2728. }
  2729.  
  2730.  
  2731. WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  2732. WriteByte (MSG_BROADCAST, TE_KNIGHTSPIKE);
  2733. WriteCoord (MSG_BROADCAST, self.origin_x);
  2734. WriteCoord (MSG_BROADCAST, self.origin_y);
  2735. WriteCoord (MSG_BROADCAST, self.origin_z);
  2736.  
  2737. if (((self.sex == 2) && (temp1 & TEMP1_PLAYER2SOUNDS)))
  2738. {
  2739. sound (self, CHAN_VOICE, "player_f/land2.wav", 1, ATTN_NORM);
  2740. }
  2741. else
  2742. {
  2743. if (((self.sex == 3) && (temp1 & TEMP1_PLAYER3SOUNDS)))
  2744. {
  2745. sound (self, CHAN_VOICE, "player3/land2.wav", 1, ATTN_NORM);
  2746. }
  2747. else
  2748. {
  2749. if (((self.sex == 4) && (temp1 & TEMP1_PLAYER4SOUNDS)))
  2750. {
  2751. sound (self, CHAN_VOICE, "player4/land2.wav", 1, ATTN_NORM);
  2752. }
  2753. else
  2754. {
  2755. sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
  2756. }
  2757. }
  2758. }
  2759. self.deathtype = "falling";
  2760. }
  2761. else
  2762. {
  2763. if (((self.sex == 2) && (temp1 & TEMP1_PLAYER2SOUNDS)))
  2764. {
  2765. sound (self, CHAN_VOICE, "player_f/land.wav", 1, ATTN_NORM);
  2766. }
  2767. else
  2768. {
  2769. if (((self.sex == 3) && (temp1 & TEMP1_PLAYER3SOUNDS)))
  2770. {
  2771. sound (self, CHAN_VOICE, "player3/land.wav", 1, ATTN_NORM);
  2772. }
  2773. else
  2774. {
  2775. if (((self.sex == 4) && (temp1 & TEMP1_PLAYER4SOUNDS)))
  2776. {
  2777. sound (self, CHAN_VOICE, "player4/land.wav", 1, ATTN_NORM);
  2778. }
  2779. else
  2780. {
  2781. sound (self, CHAN_VOICE, "player/land.wav", 1, ATTN_NORM);
  2782. }
  2783. }
  2784. }
  2785. }
  2786. }
  2787. self.jump_flag = 0;
  2788. }
  2789. if (!(self.flags & FL_ONGROUND))
  2790. {
  2791. self.jump_flag = self.velocity_z;
  2792. }
  2793. if ((deathmatch & DM_FIXED_FOV))
  2794. {
  2795. stuffcmd (self, "fov 90\n");
  2796. }
  2797. CheckPowerups ();
  2798.  
  2799. playerfootstep();
  2800.  
  2801. if ((time > teamScorePrintTime))
  2802. {
  2803. TeamCaptureCheckUpdate ();
  2804. PrintCTFScore ();
  2805. teamScorePrintTime = (time + 45);
  2806. }
  2807. if (((!self.observer && (self.velocity == VEC_ORIGIN)) && !self.button0))
  2808. {
  2809. makevectors (self.v_angle);
  2810. traceline ((self.origin + '0 0 16'), ((self.origin + '0 0 16') + (v_forward * TEAM_CAPTURE_CTFBOT_ADMIN)), FALSE, self);
  2811. if ((trace_ent.flags & FL_CLIENT || clienttype(trace_ent) == CLIENTTYPE_BOT))
  2812. {
  2813. if (!trace_ent.invisible_finished)
  2814. {
  2815. if ((trace_ent.waterlevel <= 2))
  2816. {
  2817. if ((trace_ent.team == self.team))
  2818. {
  2819. l = "TEAM-MATE‘……";
  2820. }
  2821. else
  2822. {
  2823. l = "……ÅÎÅÍÙ¡¡œœ ";
  2824. }
  2825. centerprint2 (self, l, trace_ent.netname);
  2826. }
  2827. }
  2828. }
  2829. }
  2830.  
  2831. }
  2832.  
  2833. };
  2834.  
  2835. void () ClientConnect =
  2836. {
  2837.  
  2838.  
  2839.  
  2840. /*
  2841. if (total_clients == fMaxClients )
  2842. {
  2843. local entity bot;
  2844. local float sp;
  2845. bot = find (world, classname, "bot");
  2846. sp = bot.fClientNo;
  2847. localcmd ("echo ");
  2848. localcmd (bot.netname);
  2849. botInvalidClientNo (sp);
  2850. localcmd (" invalid Clientno: ");
  2851. localcmd (ftos(sp));
  2852. localcmd ("Called...\n");
  2853. }
  2854. */
  2855. self.fClientNo = (self.colormap - 1);
  2856. botInvalidClientNo (self.fClientNo);
  2857.  
  2858.  
  2859. localcmd ("echo  ClientConnect() \n");
  2860. localcmd ("echo ");
  2861. localcmd (self.netname);
  2862. localcmd (" Assigned fClientNo: ");
  2863. localcmd (ftos(self.fClientNo));
  2864. localcmd ("\n\n");
  2865.  
  2866. clientSetUsed (self.fClientNo);
  2867.  
  2868. localcmd ("echo  ClientConnect() \n");
  2869. localcmd ("echo Total Active clients: ");
  2870. localcmd (ftos(total_clients));
  2871. localcmd ("\n\n");
  2872. if (clienttype(self) == CLIENTTYPE_REAL)
  2873. {
  2874. self.cshift = time + 126; // Fade to blk
  2875. //msg_entity = self;
  2876. //WriteByte (MSG_ONE, SVC_FINALE);
  2877. self.gtimer = 2;
  2878. self.crosshairtype =1;
  2879. self.crosshair = 1;
  2880. self.reserve = 2;
  2881. self.nextjump = 0;
  2882. self.timing = (time + 5);
  2883. self.repeat = 0;
  2884.  
  2885. LogMsg (self, "CONNECT");
  2886. sound (self, CHAN_BODY, "wizard/wsight.wav", 1, ATTN_NONE);
  2887. self.motd_count = 1;
  2888. stuffcmd (self, "chase_active 0\n");
  2889. stuffcmd (self, "rate 65536\n");
  2890. stuffcmd (self, "+speed\n");
  2891. localcmd ("status\n");
  2892. self.suicide_count = 0;
  2893. self.killed = 0;
  2894. self.frags = 0;
  2895. self.statstate = 0;
  2896. self.aflag = 0;
  2897. self.num_kills = 0;
  2898. self.num_deaths = 0;
  2899. self.num_suicides = 0;
  2900. self.num_captures = 0;
  2901. self.num_pickups = 0;
  2902. self.num_recovery = 0;
  2903. self.num_assists = 0;
  2904. self.num_bonus = 0;
  2905.  
  2906. /*
  2907. bot = find (world, classname, "bot");
  2908. while (bot)
  2909. {
  2910. msgUpdateNameToPlayer (self, bot.fClientNo, bot.netname);
  2911. msgUpdateColorsToPlayer (self, bot.fClientNo, bot.fShirt, bot.fPants);
  2912. msgUpdateFragsToPlayer (self, bot.fClientNo, bot.frags);
  2913. bot = find (bot, classname, "bot");
  2914. }
  2915. */
  2916. // lastteam and motdvount
  2917. if ((((parm10 < 0) && (teamplay > 0)) && (parm11 != -1)))
  2918. {
  2919. self.lastteam = -50;
  2920. self.team = -1;
  2921. if ((teamplay & TEAM_CAPTURE_SELECT_TEAM))
  2922. self.do_observer = 1;
  2923. else
  2924. {
  2925. if (!self.do_observer)
  2926. {
  2927. TeamCheckLock ();
  2928. self.player_flag = (self.player_flag | 32);
  2929. if ((teamplay & TEAM_CAPTURE_CUSTOM))
  2930. {
  2931. if ((self.lastteam == TEAM_COLOR1))
  2932. self.skin = 1;
  2933. else
  2934. self.skin = 3;
  2935. if ((random () < 0.5))
  2936. self.skin = (self.skin + 1);
  2937.  
  2938. self.player_flag = (self.player_flag - (self.player_flag & 65280));
  2939. self.player_flag = (self.player_flag | (self.skin * DM_INFINITE_AMMO));
  2940. }
  2941. }
  2942. }
  2943. }
  2944. /*
  2945. WriteByte(MSG_ALL, 8);
  2946. WriteByte(MSG_ALL, 1);
  2947. WriteString(MSG_ALL, self.netname);
  2948. WriteByte(MSG_ALL, 8);
  2949. WriteByte(MSG_ALL, 2);
  2950. WriteString(MSG_ALL, " entered the game\n");
  2951. */
  2952. bprint (self.netname);
  2953.  
  2954. bprint (" entered the game\n");
  2955.  
  2956.  
  2957. if (intermission_running)
  2958. {
  2959. preMOTD ();
  2960. ExitIntermission ();
  2961.  
  2962. }
  2963. }
  2964. if (clienttype(self) == CLIENTTYPE_BOT)
  2965. sound (world, CHAN_BODY, "doors/baseuse.wav", 1, ATTN_NORM);
  2966.  
  2967. };
  2968.  
  2969. void () ClientDisconnect =
  2970. {
  2971. if (gameover)
  2972. return;
  2973.  
  2974. if (self.aflag)
  2975. {
  2976. YCam ();
  2977. }
  2978. if ((self.classname == "player"))
  2979. {
  2980. set_suicide_frame ();
  2981. clientSetFree (self.fClientNo);
  2982. stuffcmd (self, "v_cshift 0 0 0 \n");
  2983. }
  2984.  
  2985. bprint (self.netname);
  2986. bprint (" left the game with ");
  2987. bprint (ftos (self.frags));
  2988. bprint (" frags\n");
  2989. self.health = 0;
  2990. if (((self.sex == 2) && (temp1 & TEMP1_PLAYER2SOUNDS)))
  2991. {
  2992. sound (self, CHAN_BODY, "player_f/tornoff2.wav", 1, ATTN_NONE);
  2993. }
  2994. else
  2995. {
  2996. if (((self.sex == 3) && (temp1 & TEMP1_PLAYER3SOUNDS)))
  2997. {
  2998. sound (self, CHAN_BODY, "player3/tornoff2.wav", 1, ATTN_NONE);
  2999. }
  3000. else
  3001. {
  3002. if (((self.sex == 4) && (temp1 & TEMP1_PLAYER4SOUNDS)))
  3003. {
  3004. sound (self, CHAN_BODY, "player4/tornoff2.wav", 1, ATTN_NONE);
  3005. }
  3006. else
  3007. {
  3008. sound (self, CHAN_BODY, "player/tornoff2.wav", 1, ATTN_NONE);
  3009. }
  3010. }
  3011. }
  3012. DropRune ();
  3013. TeamCaptureDropFlagOfPlayer (self);
  3014. self.reserve = 0;
  3015. self.lastteam = -50;
  3016. self.team = -50;
  3017. self.frags = 0;
  3018. self.effects = 0;
  3019. self.statstate = 0;
  3020. CamPlayerDisconnect ();
  3021. if ((self.classname == "bot" && self.fClientNo != -1))
  3022. {
  3023.  
  3024. self.nextthink = -1;
  3025. msgUpdateNameToAll (self.fClientNo, string_null);
  3026. msgUpdateColorsToAll (self.fClientNo, 0, 0);
  3027. msgUpdateFragsToAll (self.fClientNo, 0);
  3028. self.fClientNo = -1;
  3029. //self.flags = self.flags - FL_CLIENT;
  3030. }
  3031.  
  3032. LogMsg (self, "DISCONNECT");
  3033. /*
  3034. if (((temp1 & TEMP1_AUTO_EVEN_TEAMS) && (self.CamState == 0)))
  3035. {
  3036. BotKeepTeamsEven ();
  3037. }
  3038. */
  3039. };
  3040.  
  3041. void (entity targ, entity attacker) ClientObituary =
  3042. {
  3043. local entity head;
  3044. local float flag_radius;
  3045. local float flag_carrier_radius;
  3046. local string st;
  3047. local float rnum;
  3048. local string deathstring;
  3049. local string deathstring2;
  3050. local string what;
  3051. local string s;
  3052. local string rn;
  3053.  
  3054. if (intermission_running)
  3055. {
  3056. return;
  3057. }
  3058. rnum = random ();
  3059. if (((targ.classname == "player") || (targ.classname == "bot")))
  3060. {
  3061. if ((targ.player_flag & ITEM_ENEMY_FLAG))
  3062. {
  3063. head = find (world, classname, "player");
  3064. while ((head != world))
  3065. {
  3066. if ((head.team != targ.team))
  3067. {
  3068. head.last_hurt_carrier = -10;
  3069. }
  3070. head = FindNextPlayerOrBot (head);
  3071. }
  3072. }
  3073. if ((((attacker.classname == "player") && (targ.health < -40)) || (attacker.health < 0)))
  3074. {
  3075. if ((attacker.health < 0))
  3076. {
  3077. centerprint (attacker, "Whoops....\n");
  3078. }
  3079. else
  3080. {
  3081. centerprint (attacker, "DECIMATION!");
  3082. }
  3083. }
  3084. if ((attacker.classname == "mine"))
  3085. {
  3086. if ((targ == attacker.owner))
  3087. {
  3088. bprint (attacker.owner.netname);
  3089. if (attacker.owner.sex == 2)
  3090. bprint (" detonates herself.\n ");
  3091. else
  3092. bprint (" detonates himself.\n ");
  3093. UpdateClientFrags (attacker.owner, -1);
  3094. return;
  3095. }
  3096. bprint (targ.netname);
  3097. bprint (" Gets too close to ");
  3098. bprint (attacker.owner.netname);
  3099. bprint ("'s Proximity mine.\n");
  3100. if ((targ.team == attacker.owner.team))
  3101. {
  3102. return;
  3103. }
  3104. UpdateClientFrags (attacker.owner, 1);
  3105. targ.num_deaths = (targ.num_deaths + 1);
  3106. return;
  3107. }
  3108. if ((attacker.classname == "teledeath"))
  3109. {
  3110. bprint (targ.netname);
  3111. bprint (" was telefragged by ");
  3112. bprint (attacker.owner.netname);
  3113. bprint ("\n");
  3114. if ((targ.team != attacker.owner.team))
  3115. {
  3116. UpdateClientFrags (attacker.owner, 1);
  3117. }
  3118. LogPlayerDMDeath (targ, attacker.owner, "telefrag");
  3119. targ.num_deaths = (targ.num_deaths + 1);
  3120. attacker.owner.num_kills = (attacker.owner.num_kills + 1);
  3121. return;
  3122. }
  3123. if ((attacker.classname == "teledeath2"))
  3124. {
  3125. bprint ("Satan's power deflects ");
  3126. bprint (targ.netname);
  3127. bprint ("'s telefrag\n");
  3128. UpdateClientFrags (targ, -1);
  3129. LogPlayerDeath (targ, "telefrag");
  3130. targ.num_deaths = (targ.num_deaths + 1);
  3131. attacker.owner.num_kills = (attacker.owner.num_kills + 1);
  3132. return;
  3133. }
  3134. if (((attacker.classname == "player") || (attacker.classname == "bot")))
  3135. {
  3136. if ((targ == attacker))
  3137. {
  3138. UpdateClientFrags (attacker, -1);
  3139. bprint (targ.netname);
  3140. if (((targ.weapon == TEAM_STATIC_TEAMS) && (targ.waterlevel > 1)))
  3141. {
  3142. targ.deathtype = "discharge";
  3143. bprint (" discharges into the water.\n");
  3144. LogPlayerDeath (targ, "discharge");
  3145. if (targ.classname == "player")
  3146. {
  3147. targ.punchangle = targ.velocity - targ.angles;
  3148. targ.staydeadtime = ((time + 3) + (random () * 9));
  3149. ThrowGib ("progs/v_light.mdl", (self.health * -2.5));
  3150.  
  3151. }
  3152. return;
  3153. }
  3154. if ((targ.weapon == IT_GRENADE_LAUNCHER))
  3155. {
  3156. bprint (" tries to put the pin back in\n");
  3157. LogPlayerDeath (targ, "grenade");
  3158. }
  3159. else
  3160. {
  3161. if ((targ.team != targ.lastteam))
  3162. {
  3163. if ((teamplay & TEAM_STATIC_TEAMS))
  3164. {
  3165. bprint (" tried to change teams\n");
  3166. }
  3167. else
  3168. {
  3169. bprint (" changed teams\n");
  3170. }
  3171. LogPlayerDeath (targ, "teamchange");
  3172. }
  3173. else
  3174. {
  3175. bprint (" becomes bored with life\n");
  3176. LogPlayerDeath (targ, "rocket");
  3177. }
  3178. }
  3179. targ.num_deaths = (targ.num_deaths + 1);
  3180. targ.num_suicides = (targ.num_suicides + 1);
  3181. return;
  3182. }
  3183. else
  3184. {
  3185. if (((targ.team > 0) && (targ.team == attacker.team)))
  3186. {
  3187. if ((rnum < 0.25))
  3188. {
  3189. deathstring = " mows down a teammate\n";
  3190. }
  3191. else
  3192. {
  3193. if ((rnum < 0.5))
  3194. {
  3195. deathstring = " checks his glasses\n";
  3196. }
  3197. else
  3198. {
  3199. if ((rnum < 0.75))
  3200. {
  3201. deathstring = " gets a frag for the other team\n";
  3202. }
  3203. else
  3204. {
  3205. deathstring = " loses another friend\n";
  3206. }
  3207. }
  3208. }
  3209. bprint (attacker.netname);
  3210. bprint (deathstring);
  3211. UpdateClientFrags (attacker, -1);
  3212. targ.num_deaths = (targ.num_deaths + 1);
  3213. return;
  3214. }
  3215. else
  3216. {
  3217. if (!TeamFragPenalty (targ, attacker))
  3218. {
  3219. UpdateClientFrags (attacker, 1);
  3220. if (((targ.player_flag & ITEM_ENEMY_FLAG) && (targ.team != attacker.team)))
  3221. {
  3222. attacker.last_fragged_carrier = time;
  3223. if ((TEAM_CAPTURE_FRAG_CARRIER_BONUS > 0))
  3224. {
  3225. if (((targ.flag_since + TEAM_CAPTURE_CARRIER_FLAG_SINCE_TIMEOUT) > time))
  3226. {
  3227. if ((attacker.classname == "player"))
  3228. {
  3229. sprint (attacker, "Flag carrier killed, no bonus\n");
  3230. }
  3231. }
  3232. else
  3233. {
  3234. UpdateClientFrags (attacker, TEAM_CAPTURE_FRAG_CARRIER_BONUS);
  3235. if ((attacker.classname == "player"))
  3236. {
  3237. sprint (attacker, "Flag carrier killed: ");
  3238. }
  3239. s = ftos (TEAM_CAPTURE_FRAG_CARRIER_BONUS);
  3240. if ((attacker.classname == "player"))
  3241. {
  3242. sprint (attacker, s);
  3243. }
  3244. if ((attacker.classname == "player"))
  3245. {
  3246. sprint (attacker, " bonus frags\n");
  3247. }
  3248. attacker.num_bonus = (attacker.num_bonus + 1);
  3249. }
  3250. }
  3251. }
  3252. flag_radius = 0;
  3253. flag_carrier_radius = 0;
  3254. s = GetTeamName (attacker.team);
  3255. if ((((targ.last_hurt_carrier + TEAM_CAPTURE_CARRIER_DANGER_PROTECT_TIMEOUT) > time) && !(attacker.player_flag & ITEM_ENEMY_FLAG)))
  3256. {
  3257. UpdateClientFrags (attacker, TEAM_CAPTURE_CARRIER_DANGER_PROTECT_BONUS);
  3258. flag_carrier_radius = 1;
  3259. bprint (attacker.netname);
  3260. bprint (" defends ");
  3261. bprint (s);
  3262. bprint ("'s flag carrier against an agressive enemy\n");
  3263. attacker.num_bonus = (attacker.num_bonus + 1);
  3264. }
  3265. head = findradius (attacker.origin, TEAM_CAPTURE_ATTACKER_PROTECT_RADIUS);
  3266. while (head)
  3267. {
  3268. if ((head.classname == "player"))
  3269. {
  3270. if (((((head.team == attacker.team) && (head.player_flag & ITEM_ENEMY_FLAG)) && (head != attacker)) && !flag_carrier_radius))
  3271. {
  3272. UpdateClientFrags (attacker, TEAM_CAPTURE_CARRIER_PROTECT_BONUS);
  3273. flag_carrier_radius = 1;
  3274. bprint (attacker.netname);
  3275. bprint (" defends ");
  3276. bprint (s);
  3277. bprint ("'s flag carrier\n");
  3278. attacker.num_bonus = (attacker.num_bonus + 1);
  3279. }
  3280. }
  3281. if (((head.classname == "item_flag_team1") || (head.classname == "item_flag_team2")))
  3282. {
  3283. if ((((attacker.team == TEAM_COLOR1) && (head.classname == "item_flag_team1")) || ((attacker.team == TEAM_COLOR2) && (head.classname == "item_flag_team2"))))
  3284. {
  3285. UpdateClientFrags (attacker, TEAM_CAPTURE_FLAG_DEFENSE_BONUS);
  3286. flag_radius = 1;
  3287. bprint (attacker.netname);
  3288. bprint (" defends the ");
  3289. bprint (s);
  3290. bprint (" flag\n");
  3291. sound (self, CHAN_AUTO, "misc/basekey.wav", 1, ATTN_IDLE);
  3292. attacker.num_bonus = (attacker.num_bonus + 1);
  3293. }
  3294. }
  3295. head = head.chain;
  3296. }
  3297. head = findradius (targ.origin, TEAM_CAPTURE_TARGET_PROTECT_RADIUS);
  3298. while (head)
  3299. {
  3300. if ((head.classname == "player"))
  3301. {
  3302. if (((((head.team == attacker.team) && (head.player_flag & ITEM_ENEMY_FLAG)) && (head != attacker)) && !flag_carrier_radius))
  3303. {
  3304. UpdateClientFrags (attacker, TEAM_CAPTURE_CARRIER_PROTECT_BONUS);
  3305. flag_carrier_radius = 1;
  3306. bprint (attacker.netname);
  3307. bprint (" defends ");
  3308. bprint (s);
  3309. bprint ("'s flag carrier\n");
  3310. attacker.num_bonus = (attacker.num_bonus + 1);
  3311. }
  3312. }
  3313. if (((((attacker.team == TEAM_COLOR1) && (head.classname == "item_flag_team1")) || ((attacker.team == TEAM_COLOR2) && (head.classname == "item_flag_team2"))) && !flag_radius))
  3314. {
  3315. UpdateClientFrags (attacker, TEAM_CAPTURE_FLAG_DEFENSE_BONUS);
  3316. flag_radius = 1;
  3317. bprint (attacker.netname);
  3318. bprint (" defends the ");
  3319. bprint (s);
  3320. bprint (" flag\n");
  3321. attacker.num_bonus = (attacker.num_bonus + 1);
  3322. }
  3323. head = head.chain;
  3324. }
  3325. }
  3326. TeamDeathPenalty (targ, attacker);
  3327. rn = targ.deathtype;
  3328.  
  3329. if (((rn == "blaze") || (rn == "burnt")))
  3330. {
  3331. if (rn == "blaze")
  3332. {
  3333. deathstring = " was Torched by ";
  3334. deathstring2 = "'s Blaze Gun\n";
  3335. }
  3336. if (rn == "burnt")
  3337. {
  3338. deathstring = " Was Roasted with ";
  3339. deathstring2 = "'s Blaze Gun\n";
  3340. }
  3341. what = "lightning";
  3342. }
  3343.  
  3344.  
  3345. if (((rn == "lightning") || (rn == "discharge")))
  3346. {
  3347. if ((attacker.items & IT_QUAD))
  3348. {
  3349. deathstring = " was touched by ";
  3350. deathstring2 = "'s Quad lightning\n";
  3351. }
  3352. else
  3353. {
  3354. deathstring = " accepts ";
  3355. if ((rn == "discharge"))
  3356. {
  3357. deathstring2 = "'s discharge\n";
  3358. }
  3359. else
  3360. {
  3361. deathstring2 = "'s shaft\n";
  3362. }
  3363. }
  3364. what = "lightning";
  3365. }
  3366. if ((rn == "ax"))
  3367. {
  3368. deathstring = " was ax-murdered by ";
  3369. deathstring2 = "\n";
  3370. what = "axe";
  3371. }
  3372. if ((rn == "grapple"))
  3373. {
  3374. if ((random () < 0.5))
  3375. {
  3376. deathstring = " was disembowled by ";
  3377. }
  3378. else
  3379. {
  3380. deathstring = " was hooked by ";
  3381. }
  3382. deathstring2 = "\n";
  3383. what = "hook";
  3384. }
  3385. if ((rn == "shotgun"))
  3386. {
  3387. deathstring = " chewed on ";
  3388. deathstring2 = "'s boomstick\n";
  3389. what = "shotgun";
  3390. }
  3391. if ((rn == "sshotgun"))
  3392. {
  3393. deathstring = " ate 2 loads of ";
  3394. if ((targ.health < -40))
  3395. {
  3396. deathstring = " ate a box of ";
  3397. }
  3398. deathstring2 = "'s buckshot\n";
  3399. what = "supershotgun";
  3400. }
  3401. if ((rn == "spike"))
  3402. {
  3403. deathstring = " was nailed by ";
  3404. deathstring2 = "\n";
  3405. what = "nailgun";
  3406. }
  3407. if ((rn == "sspike"))
  3408. {
  3409. deathstring = " was punctured by ";
  3410. deathstring2 = "\n";
  3411. what = "supernailgun";
  3412. }
  3413. if ((rn == "grenade"))
  3414. {
  3415. deathstring = " eats ";
  3416. deathstring2 = "'s pineapple\n";
  3417. if ((targ.health < -40))
  3418. {
  3419. deathstring = " was gibbed by ";
  3420. deathstring2 = "'s grenade\n";
  3421. }
  3422. what = "grenade";
  3423. }
  3424. if ((rn == "rocket"))
  3425. {
  3426. if ((attacker.items & IT_QUAD))
  3427. {
  3428. deathstring = " was destroyed by ";
  3429. deathstring2 = "'s Quad rocket\n";
  3430. }
  3431. else
  3432. {
  3433. deathstring = " rides ";
  3434. deathstring2 = "'s rocket\n";
  3435. if ((targ.health < -40))
  3436. {
  3437. deathstring = " inhales ";
  3438. deathstring2 = "'s rocket\n";
  3439. }
  3440. }
  3441. what = "rocket";
  3442. }
  3443. bprint (targ.netname);
  3444. if (((targ.classname == "bot") && !bots_have_normal_names))
  3445. {
  3446. st = ftos (targ.bot_skill);
  3447. bprint (" [skill ");
  3448. bprint (st);
  3449. bprint ("]");
  3450. }
  3451. bprint (deathstring);
  3452. bprint (attacker.netname);
  3453. if (((attacker.classname == "bot") && !bots_have_normal_names))
  3454. {
  3455. st = ftos (attacker.bot_skill);
  3456. bprint (" [skill ");
  3457. bprint (st);
  3458. bprint ("]");
  3459. }
  3460. bprint (deathstring2);
  3461. LogPlayerDMDeath (targ, attacker, what);
  3462. targ.num_deaths = (targ.num_deaths + 1);
  3463. attacker.num_kills = (attacker.num_kills + 1);
  3464. if ((((targ.classname == "player") || (targ.classname == "bot")) && (attacker.classname == "bot")))
  3465. {
  3466. attacker.last_kill_time = time;
  3467. attacker.last_kill_ent = targ;
  3468. }
  3469. if (((targ.classname == "bot") && (attacker.classname == "player")))
  3470. {
  3471. targ.last_die_time = time;
  3472. targ.last_die_ent = attacker;
  3473. }
  3474. }
  3475. }
  3476. return;
  3477. }
  3478. else
  3479. {
  3480. UpdateClientFrags (targ, -1);
  3481. targ.num_deaths = (targ.num_deaths + 1);
  3482. bprint (targ.netname);
  3483. if ((attacker.flags & FL_MONSTER))
  3484. {
  3485. return;
  3486. }
  3487. if ((attacker.classname == "electro"))
  3488. {
  3489. if ((self.weapon == IT_HOOK))
  3490. {
  3491. bprint (" Provided a path to Ground.\n");
  3492. }
  3493. else
  3494. {
  3495. bprint (" Got fried in an Electrical field..\n");
  3496. }
  3497. LogPlayerDeath (targ, "melted");
  3498. return;
  3499. }
  3500. if ((attacker.classname == "light_torch_small_walltorch"))
  3501. {
  3502. if (targ.sex == 2)
  3503. bprint (" ignited herself\n ");
  3504. else
  3505. bprint (" ignited himself\n ");
  3506. LogPlayerDeath (targ, "melted");
  3507. return;
  3508. }
  3509. if ((attacker.classname == "explo_box"))
  3510. {
  3511. bprint (" blew up\n");
  3512. LogPlayerDeath (targ, "explosion");
  3513. return;
  3514. }
  3515. if (((attacker.solid == SOLID_BSP) && (attacker != world)))
  3516. {
  3517. bprint (" was squished\n");
  3518. LogPlayerDeath (targ, "squished");
  3519. return;
  3520. }
  3521. if (((attacker.classname == "trap_shooter") || (attacker.classname == "trap_spikeshooter")))
  3522. {
  3523. if ((attacker.spawnflags & 2))
  3524. {
  3525. bprint (" got zapped\n");
  3526. }
  3527. else
  3528. {
  3529. bprint (" was spiked\n");
  3530. }
  3531. LogPlayerDeath (targ, "spiked");
  3532. return;
  3533. }
  3534. if ((attacker.classname == "fireball"))
  3535. {
  3536. bprint (" ate a lavaball\n");
  3537. LogPlayerDeath (targ, "fireball");
  3538. return;
  3539. }
  3540. if ((attacker.classname == "trigger_changelevel"))
  3541. {
  3542. bprint (" tried to leave\n");
  3543. LogPlayerDeath (targ, "noexit");
  3544. return;
  3545. }
  3546. rnum = targ.watertype;
  3547. if ((rnum == CONTENT_WATER))
  3548. {
  3549. if ((random () < 0.5))
  3550. {
  3551. bprint (" sleeps with the fishes\n");
  3552. }
  3553. else
  3554. {
  3555. bprint (" sucks it down\n");
  3556. }
  3557. LogPlayerDeath (targ, "drowned");
  3558. return;
  3559. }
  3560. else
  3561. {
  3562. if ((rnum == CONTENT_SLIME))
  3563. {
  3564. if ((random () < 0.5))
  3565. {
  3566. bprint (" Suffocated on his own vomit\n");
  3567. }
  3568. else
  3569. {
  3570. bprint (" can't exist on slime alone\n");
  3571. }
  3572. LogPlayerDeath (targ, "slimed");
  3573. return;
  3574. }
  3575. else
  3576. {
  3577. if ((rnum == CONTENT_LAVA))
  3578. {
  3579. if ((targ.health < -15))
  3580. {
  3581. bprint (" burst into flames\n");
  3582. LogPlayerDeath (targ, "melted");
  3583. return;
  3584. }
  3585. if ((random () < 0.5))
  3586. {
  3587. bprint (" turned into hot slag\n");
  3588. }
  3589. else
  3590. {
  3591. bprint (" visits the Volcano God\n");
  3592. }
  3593. LogPlayerDeath (targ, "melted");
  3594. return;
  3595. }
  3596. }
  3597. }
  3598. if ((targ.deathtype == "falling"))
  3599. {
  3600. targ.deathtype = "";
  3601. bprint (" fell and couldnt get up\n");
  3602. LogPlayerDeath (targ, "falling");
  3603. return;
  3604. }
  3605. LogPlayerDeath (targ, " died");
  3606. bprint (" died\n");
  3607. }
  3608. }
  3609. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement