Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "use strict";
- // Funktionen um string array in hash array um zu wandeln.
- mp.hashify = hashes =>
- {
- var dst = [];
- hashes.forEach(hash => { dst.push(mp.joaat(hash)); });
- return dst;
- };
- var game =
- {
- spawns: [new mp.Vector3(2140.15454, 4783.173, 40.4812241), new mp.Vector3(2133.27148, 4777.55, 40.4814262),
- new mp.Vector3(2019.19739, 4763.39746, 40.62057), new mp.Vector3(2027.80859, 4749.584, 40.7290535)],
- models: mp.hashify(["mp_m_weed_01", "mp_m_forgery_01", "mp_f_weed_01", "mp_f_chbar_01", "ig_johnnyklebitz",
- "player_two", "ig_nervousron", "ig_wade", "ig_floyd", "ig_chef"]),
- weapons: mp.hashify(["WEAPON_PISTOL", "WEAPON_ASSAULTRIFLE","WEAPON_SAWNOFFSHOTGUN","WEAPON_COMPACTRIFLE"])
- };
- mp.environment.weather = 'HALLOWEEN';
- mp.environment.time.hour = 23;
- // Todesursachen, Hash in eine Zeichenfolge zu konvertieren
- var g_reasons = {};
- function InitReasons(arr)
- {
- arr.forEach(reason => { g_reasons[mp.joaat(reason)] = reason.substr(7); });
- }
- InitReasons(["WEAPON_PISTOL", "WEAPON_ASSAULTRIFLE","WEAPON_SAWNOFFSHOTGUN","WEAPON_COMPACTRIFLE"]);
- // Ein neues Event hinzufügen
- mp.events.add(
- {
- "playerJoin" : player =>
- {
- // Dem Spieler ein Zufallsmodel zuweisen.
- player.model = game.models[Math.floor(Math.random() * game.models.length)]
- // Erlässt alle Waffen, die in den Array game.weapons angegeben sind.
- game.weapons.forEach(weapon => { player.giveWeapon(weapon, 10000); });
- // Spawn in einer der Punkte die in game.spawns erwähnte wird.
- player.spawn(game.spawns[Math.floor(Math.random() * game.spawns.length)]);
- player.kills = 0;
- },
- "playerDeath" : (player, reason, killer) =>
- {
- if(killer != null)
- {
- killer.kills++;
- // Wir finden die Todesursache herraus. Wer und Warum.
- var str = g_reasons[reason];
- if(str != undefined)
- {
- str = player.name + "(" + player.kills + ")" + " [" + str + "] " + killer.name + "(" + killer.kills + ")";
- mp.players.forEach(_player => { _player.outputChatBox(str); });
- }
- }
- player.spawn(game.spawns[Math.floor(Math.random() * game.spawns.length)]);
- },
- "playerQuit" : (player, reason, kickReason) =>
- {
- const str = player.name + " quit";
- mp.players.forEach(_player => { _player.outputChatBox(str); });
- },
- "playerChat": (player, text) =>
- {
- // Wir können HTML-Tags im Chat verwenden, da es auf HTML (CEF) basis durchgeführt wird,
- // Verwenden Sie das Isolationstag, um die Zahl der Morde fest zu halten.
- const str = player.name + "<b>(" + player.kills + ")</b>: " + text;
- // Senden Sie die Todesnachricht an alle Spieler.
- mp.players.forEach(_player => { _player.outputChatBox(str); });
- },
- "playerCommand": (player, cmd) =>
- {
- if(cmd == "pos")
- {
- var pos = player.position;
- player.outputChatBox("X: <b>" + pos.x + "</b>, Y: <b>" + pos.y + "</b>, Z: <b>" + pos.z + "</b>");
- }
- else if(cmd.search("veh") != -1)
- {
- var pos = player.position;
- pos.x += 2.0;
- // Array zum Einstellen verschiedener Werte in zukunft.
- // Ein Auto für einen Spieler spawnen.
- createdVehs.push(new mp.Vehicle(mp.joaat(cmd.substr(4)), pos));
- }
- else if(cmd.search("setweather") != -1)
- {
- mp.environment.weather = cmd.substr(11);
- }
- else if(cmd.search("settime") != -1)
- {
- mp.environment.time.hour = parseInt(cmd.substr(8));
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement