Advertisement
Guest User

Untitled

a guest
Nov 18th, 2016
235
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. "use strict";
  2.  
  3. // Funktionen um string array in hash array um zu wandeln.
  4. mp.hashify = hashes =>
  5. {
  6. var dst = [];
  7. hashes.forEach(hash => { dst.push(mp.joaat(hash)); });
  8. return dst;
  9. };
  10.  
  11. var game =
  12. {
  13. spawns: [new mp.Vector3(2140.15454, 4783.173, 40.4812241), new mp.Vector3(2133.27148, 4777.55, 40.4814262),
  14. new mp.Vector3(2019.19739, 4763.39746, 40.62057), new mp.Vector3(2027.80859, 4749.584, 40.7290535)],
  15.  
  16. models: mp.hashify(["mp_m_weed_01", "mp_m_forgery_01", "mp_f_weed_01", "mp_f_chbar_01", "ig_johnnyklebitz",
  17. "player_two", "ig_nervousron", "ig_wade", "ig_floyd", "ig_chef"]),
  18.  
  19. weapons: mp.hashify(["WEAPON_PISTOL", "WEAPON_ASSAULTRIFLE","WEAPON_SAWNOFFSHOTGUN","WEAPON_COMPACTRIFLE"])
  20. };
  21.  
  22. mp.environment.weather = 'HALLOWEEN';
  23. mp.environment.time.hour = 23;
  24.  
  25. // Todesursachen, Hash in eine Zeichenfolge zu konvertieren
  26. var g_reasons = {};
  27.  
  28. function InitReasons(arr)
  29. {
  30. arr.forEach(reason => { g_reasons[mp.joaat(reason)] = reason.substr(7); });
  31. }
  32.  
  33. InitReasons(["WEAPON_PISTOL", "WEAPON_ASSAULTRIFLE","WEAPON_SAWNOFFSHOTGUN","WEAPON_COMPACTRIFLE"]);
  34.  
  35. // Ein neues Event hinzufügen
  36. mp.events.add(
  37. {
  38. "playerJoin" : player =>
  39. {
  40. // Dem Spieler ein Zufallsmodel zuweisen.
  41. player.model = game.models[Math.floor(Math.random() * game.models.length)]
  42.  
  43. // Erlässt alle Waffen, die in den Array game.weapons angegeben sind.
  44. game.weapons.forEach(weapon => { player.giveWeapon(weapon, 10000); });
  45.  
  46. // Spawn in einer der Punkte die in game.spawns erwähnte wird.
  47. player.spawn(game.spawns[Math.floor(Math.random() * game.spawns.length)]);
  48.  
  49. player.kills = 0;
  50. },
  51.  
  52. "playerDeath" : (player, reason, killer) =>
  53. {
  54. if(killer != null)
  55. {
  56. killer.kills++;
  57.  
  58. // Wir finden die Todesursache herraus. Wer und Warum.
  59. var str = g_reasons[reason];
  60.  
  61. if(str != undefined)
  62. {
  63. str = player.name + "(" + player.kills + ")" + " [" + str + "] " + killer.name + "(" + killer.kills + ")";
  64. mp.players.forEach(_player => { _player.outputChatBox(str); });
  65. }
  66. }
  67.  
  68. player.spawn(game.spawns[Math.floor(Math.random() * game.spawns.length)]);
  69. },
  70.  
  71. "playerQuit" : (player, reason, kickReason) =>
  72. {
  73. const str = player.name + " quit";
  74. mp.players.forEach(_player => { _player.outputChatBox(str); });
  75. },
  76.  
  77. "playerChat": (player, text) =>
  78. {
  79. // Wir können HTML-Tags im Chat verwenden, da es auf HTML (CEF) basis durchgeführt wird,
  80. // Verwenden Sie das Isolationstag, um die Zahl der Morde fest zu halten.
  81. const str = player.name + "<b>(" + player.kills + ")</b>: " + text;
  82.  
  83. // Senden Sie die Todesnachricht an alle Spieler.
  84. mp.players.forEach(_player => { _player.outputChatBox(str); });
  85. },
  86.  
  87. "playerCommand": (player, cmd) =>
  88. {
  89. if(cmd == "pos")
  90. {
  91. var pos = player.position;
  92. player.outputChatBox("X: <b>" + pos.x + "</b>, Y: <b>" + pos.y + "</b>, Z: <b>" + pos.z + "</b>");
  93. }
  94. else if(cmd.search("veh") != -1)
  95. {
  96. var pos = player.position;
  97. pos.x += 2.0;
  98.  
  99. // Array zum Einstellen verschiedener Werte in zukunft.
  100. // Ein Auto für einen Spieler spawnen.
  101. createdVehs.push(new mp.Vehicle(mp.joaat(cmd.substr(4)), pos));
  102. }
  103. else if(cmd.search("setweather") != -1)
  104. {
  105. mp.environment.weather = cmd.substr(11);
  106. }
  107. else if(cmd.search("settime") != -1)
  108. {
  109. mp.environment.time.hour = parseInt(cmd.substr(8));
  110. }
  111. }
  112. });
Advertisement
RAW Paste Data Copied
Advertisement