Changed whole project structure (split client and server into separat projects)

This commit is contained in:
hydrant
2019-02-25 22:12:05 +01:00
parent d2181c4987
commit 33abb3d04f
185 changed files with 282 additions and 596 deletions

View File

@@ -0,0 +1,60 @@
const NativeUI = require('nativeui');
const Menu = NativeUI.Menu;
const UIMenuItem = NativeUI.UIMenuItem;
const UIMenuListItem = NativeUI.UIMenuListItem;
const UIMenuCheckboxItem = NativeUI.UIMenuCheckboxItem;
const UIMenuSliderItem = NativeUI.UIMenuSliderItem;
const BadgeStyle = NativeUI.BadgeStyle;
const Point = NativeUI.Point;
const ItemsCollection = NativeUI.ItemsCollection;
const Color = NativeUI.Color;
const ListItem = NativeUI.ListItem;
const moneyFormat = require("moneyformat");
var shopMenu;
mp.events.add('ShopVehicle_OpenMenu', (businessName, price) => {
var veh = mp.players.local.vehicle;
if (!veh) return;
mp.gui.chat.show(false);
shopMenu = new Menu("Fahrzeugkauf", "Kaufe ein neues Auto", new Point(50, 50));
var carItem = new UIMenuItem("Fahrzeugname");
carItem.SetRightLabel(mp.game.ui.getLabelText(mp.game.vehicle.getDisplayNameFromVehicleModel(veh.model)));
shopMenu.AddItem(carItem);
var shopItem = new UIMenuItem("Autohaus");
shopItem.SetRightLabel(businessName);
shopMenu.AddItem(shopItem);
var priceItem = new UIMenuItem("Preis");
priceItem.SetRightLabel("~g~$~s~ "+ moneyFormat(price));
shopMenu.AddItem(priceItem);
var saveItem = new UIMenuItem("Kaufen");
saveItem.BackColor = new Color(0, 100, 0);
saveItem.HighlightedBackColor = new Color(0, 150, 0);
shopMenu.AddItem(saveItem);
var cancelItem = new UIMenuItem("Abbrechen");
cancelItem.BackColor = new Color(213, 0, 0);
cancelItem.HighlightedBackColor = new Color(229, 57, 53);
shopMenu.AddItem(cancelItem);
shopMenu.ItemSelect.on((item, index) => {
if (item === cancelItem) {
shopMenu.Close();
} else if (item === saveItem) {
mp.events.callRemote("VehShop_BuyVehicle");
shopMenu.Close();
}
});
shopMenu.MenuClose.on(() => {
mp.gui.chat.show(true);
mp.players.local.taskLeaveVehicle(veh.handle, 0);
});
shopMenu.Open();
});

View File

@@ -0,0 +1,143 @@
var keyBound = false;
var closeMenu = false;
var businessName;
var businessMoney;
var mainMenu;
var bankMenu;
const NativeUI = require("nativeui");
const Menu = NativeUI.Menu;
const UIMenuItem = NativeUI.UIMenuItem;
const UIMenuListItem = NativeUI.UIMenuListItem;
const UIMenuCheckboxItem = NativeUI.UIMenuCheckboxItem;
const UIMenuSliderItem = NativeUI.UIMenuSliderItem;
const BadgeStyle = NativeUI.BadgeStyle;
const Point = NativeUI.Point;
const ItemsCollection = NativeUI.ItemsCollection;
const Color = NativeUI.Color;
const ListItem = NativeUI.ListItem;
const InputHelper = require("inputhelper");
mp.events.add('business_showHelp', (bizName, bizMoney) => {
mp.game.ui.setTextComponentFormat('STRING');
mp.game.ui.addTextComponentSubstringPlayerName('Drücke ~INPUT_CONTEXT~, um dein Business zu verwalten');
mp.game.ui.displayHelpTextFromStringLabel(0, true, true, -1);
businessName = bizName;
businessMoney = bizMoney;
mp.keys.bind(0x45, false, keyPressHandler);
keyBound = true;
});
mp.events.add('business_removeHelp', (unbind) => {
mp.game.ui.clearHelp(true);
mp.gui.chat.show(true);
if (keyBound && unbind) {
if (typeof mainMenu !== "undefined") mainMenu.Close();
if (typeof bankMenu !== "undefined") {
closeMenu = true;
bankMenu.Close();
}
mp.keys.unbind(0x45, false, keyPressHandler);
keyBound = false;
}
});
mp.events.add('business_updateMoney', (newMoney) => {
businessMoney = newMoney;
});
function keyPressHandler() {
mp.events.call('business_removeHelp', false);
mp.gui.chat.show(false);
if (typeof mainMenu !== "undefined" && mainMenu.Visible) {
return;
}
if (typeof bankMenu !== "undefined" && bankMenu.Visible) {
return;
}
mainMenu = new Menu("Businessverwaltung", businessName, new Point(50, 50));
var bankAccountItem = new UIMenuItem("Businesskasse", "Verwalte die Businesskasse");
bankAccountItem.SetRightLabel("~g~~h~" + businessMoney);
mainMenu.AddItem(bankAccountItem);
//var partnerItem = new UIMenuItem("Inteilhaber", "Verwalte den Inteilhaber");
//partnerItem.SetRightLabel("Niemand");
//mainMenu.AddItem(partnerItem);
mainMenu.Open();
mainMenu.ItemSelect.on((item, index) => {
if (item === bankAccountItem) {
// manage bank account
bankMenu = new Menu("Bankkonto", businessName, new Point(50, 50));
var infoItem = new UIMenuItem("Aktueller Kontostand");
infoItem.SetRightLabel("~g~~h~" + businessMoney);
bankMenu.AddItem(infoItem);
var depositItem = new UIMenuItem("Einzahlen", "Zahle Geld auf die Businesskasse ein");
bankMenu.AddItem(depositItem);
var withdrawItem = new UIMenuItem("Auszahlen", "Zahle Geld von der Businesskasse aus");
bankMenu.AddItem(withdrawItem);
bankMenu.ItemSelect.on((item, index) => {
if (item === depositItem) {
var depositInput = new InputHelper("Wie viel Geld möchtest du auf deine Businesskasse einzahlen?");
depositInput.show();
depositInput.getValue((data) => {
var amount = parseInt(data);
if (isNaN(amount)) {
mp.game.graphics.notify('~r~Du musst eine Nummer eingeben!');
return;
}
mp.events.callRemote('Business_DepositMoney', amount);
});
} else if (item === withdrawItem) {
var withdrawInput = new InputHelper("Wie viel Geld möchtest du von deiner Businesskasse abheben?");
withdrawInput.show();
withdrawInput.getValue((data) => {
var amount = parseInt(data);
if (isNaN(amount)) {
mp.game.graphics.notify('~r~Du musst eine Nummer eingeben!');
return;
}
mp.events.callRemote('Business_WithdrawMoney', amount);
});
}
});
bankMenu.MenuClose.on(() => {
if (closeMenu) {
closeMenu = false;
return;
}
mainMenu.Visible = true;
});
bankMenu.Visible = true;
mainMenu.Visible = false;
} else if (item === partnerItem) {
// manage partner
}
});
mainMenu.MenuClose.on(() => {
mp.events.call('business_removeHelp', false);
});
}

View File

@@ -0,0 +1,136 @@
const fathers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 42, 43, 44];
const mothers = [21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 45];
const fatherNames = ["Benjamin", "Daniel", "Joshua", "Noah", "Andrew", "Juan", "Alex", "Isaac", "Evan", "Ethan", "Vincent", "Angel", "Diego", "Adrian", "Gabriel", "Michael", "Santiago", "Kevin", "Louis", "Samuel", "Anthony", "Claude", "Niko", "John"];
const motherNames = ["Hannah", "Aubrey", "Jasmine", "Gisele", "Amelia", "Isabella", "Zoe", "Ava", "Camila", "Violet", "Sophia", "Evelyn", "Nicole", "Ashley", "Gracie", "Brianna", "Natalie", "Olivia", "Elizabeth", "Charlotte", "Emma", "Misty"];
const featureNames = ["Nose Width", "Nose Bottom Height", "Nose Tip Length", "Nose Bridge Depth", "Nose Tip Height", "Nose Broken", "Brow Height", "Brow Depth", "Cheekbone Height", "Cheekbone Width", "Cheek Depth", "Eye Size", "Lip Thickness", "Jaw Width", "Jaw Shape", "Chin Height", "Chin Depth", "Chin Width", "Chin Indent", "Neck Width"];
const appearanceNames = ["Blemishes", "Facial Hair", "Eyebrows", "Ageing", "Makeup", "Blush", "Complexion", "Sun Damage", "Lipstick", "Moles & Freckles", "Chest Hair"];
const appearanceItemNames = [
// blemishes
["None", "Measles", "Pimples", "Spots", "Break Out", "Blackheads", "Build Up", "Pustules", "Zits", "Full Acne", "Acne", "Cheek Rash", "Face Rash", "Picker", "Puberty", "Eyesore", "Chin Rash", "Two Face", "T Zone", "Greasy", "Marked", "Acne Scarring", "Full Acne Scarring", "Cold Sores", "Impetigo"],
// facial hair
["None", "Light Stubble", "Balbo", "Circle Beard", "Goatee", "Chin", "Chin Fuzz", "Pencil Chin Strap", "Scruffy", "Musketeer", "Mustache", "Trimmed Beard", "Stubble", "Thin Circle Beard", "Horseshoe", "Pencil and 'Chops", "Chin Strap Beard", "Balbo and Sideburns", "Mutton Chops", "Scruffy Beard", "Curly", "Curly & Deep Stranger", "Handlebar", "Faustic", "Otto & Patch", "Otto & Full Stranger", "Light Franz", "The Hampstead", "The Ambrose", "Lincoln Curtain"],
// eyebrows
["None", "Balanced", "Fashion", "Cleopatra", "Quizzical", "Femme", "Seductive", "Pinched", "Chola", "Triomphe", "Carefree", "Curvaceous", "Rodent", "Double Tram", "Thin", "Penciled", "Mother Plucker", "Straight and Narrow", "Natural", "Fuzzy", "Unkempt", "Caterpillar", "Regular", "Mediterranean", "Groomed", "Bushels", "Feathered", "Prickly", "Monobrow", "Winged", "Triple Tram", "Arched Tram", "Cutouts", "Fade Away", "Solo Tram"],
// ageing
["None", "Crow's Feet", "First Signs", "Middle Aged", "Worry Lines", "Depression", "Distinguished", "Aged", "Weathered", "Wrinkled", "Sagging", "Tough Life", "Vintage", "Retired", "Junkie", "Geriatric"],
// makeup
["None", "Smoky Black", "Bronze", "Soft Gray", "Retro Glam", "Natural Look", "Cat Eyes", "Chola", "Vamp", "Vinewood Glamour", "Bubblegum", "Aqua Dream", "Pin Up", "Purple Passion", "Smoky Cat Eye", "Smoldering Ruby", "Pop Princess"],
// blush
["None", "Full", "Angled", "Round", "Horizontal", "High", "Sweetheart", "Eighties"],
// complexion
["None", "Rosy Cheeks", "Stubble Rash", "Hot Flush", "Sunburn", "Bruised", "Alchoholic", "Patchy", "Totem", "Blood Vessels", "Damaged", "Pale", "Ghostly"],
// sun damage
["None", "Uneven", "Sandpaper", "Patchy", "Rough", "Leathery", "Textured", "Coarse", "Rugged", "Creased", "Cracked", "Gritty"],
// lipstick
["None", "Color Matte", "Color Gloss", "Lined Matte", "Lined Gloss", "Heavy Lined Matte", "Heavy Lined Gloss", "Lined Nude Matte", "Liner Nude Gloss", "Smudged", "Geisha"],
// freckles
["None", "Cherub", "All Over", "Irregular", "Dot Dash", "Over the Bridge", "Baby Doll", "Pixie", "Sun Kissed", "Beauty Marks", "Line Up", "Modelesque", "Occasional", "Speckled", "Rain Drops", "Double Dip", "One Sided", "Pairs", "Growth"],
// chest hair
["None", "Natural", "The Strip", "The Tree", "Hairy", "Grisly", "Ape", "Groomed Ape", "Bikini", "Lightning Bolt", "Reverse Lightning", "Love Heart", "Chestache", "Happy Face", "Skull", "Snail Trail", "Slug and Nips", "Hairy Arms"]
];
const hairList = [
// male
[
{ID: 0, Name: "Close Shave", Collection: "mpbeach_overlays", Overlay: "FM_Hair_Fuzz"},
{ID: 1, Name: "Buzzcut", Collection: "multiplayer_overlays", Overlay: "NG_M_Hair_001"},
{ID: 2, Name: "Faux Hawk", Collection: "multiplayer_overlays", Overlay: "NG_M_Hair_002"},
{ID: 3, Name: "Hipster", Collection: "multiplayer_overlays", Overlay: "NG_M_Hair_003"},
{ID: 4, Name: "Side Parting", Collection: "multiplayer_overlays", Overlay: "NG_M_Hair_004"},
{ID: 5, Name: "Shorter Cut", Collection: "multiplayer_overlays", Overlay: "NG_M_Hair_005"},
{ID: 6, Name: "Biker", Collection: "multiplayer_overlays", Overlay: "NG_M_Hair_006"},
{ID: 7, Name: "Ponytail", Collection: "multiplayer_overlays", Overlay: "NG_M_Hair_007"},
{ID: 8, Name: "Cornrows", Collection: "multiplayer_overlays", Overlay: "NG_M_Hair_008"},
{ID: 9, Name: "Slicked", Collection: "multiplayer_overlays", Overlay: "NG_M_Hair_009"},
{ID: 10, Name: "Short Brushed", Collection: "multiplayer_overlays", Overlay: "NG_M_Hair_013"},
{ID: 11, Name: "Spikey", Collection: "multiplayer_overlays", Overlay: "NG_M_Hair_002"},
{ID: 12, Name: "Caesar", Collection: "multiplayer_overlays", Overlay: "NG_M_Hair_011"},
{ID: 13, Name: "Chopped", Collection: "multiplayer_overlays", Overlay: "NG_M_Hair_012"},
{ID: 14, Name: "Dreads", Collection: "multiplayer_overlays", Overlay: "NG_M_Hair_014"},
{ID: 15, Name: "Long Hair", Collection: "multiplayer_overlays", Overlay: "NG_M_Hair_015"},
{ID: 16, Name: "Shaggy Curls", Collection: "multiplayer_overlays", Overlay: "NGBea_M_Hair_000"},
{ID: 17, Name: "Surfer Dude", Collection: "multiplayer_overlays", Overlay: "NGBea_M_Hair_001"},
{ID: 18, Name: "Short Side Part", Collection: "multiplayer_overlays", Overlay: "NGBus_M_Hair_000"},
{ID: 19, Name: "High Slicked Sides", Collection: "multiplayer_overlays", Overlay: "NGBus_M_Hair_001"},
{ID: 20, Name: "Long Slicked", Collection: "multiplayer_overlays", Overlay: "NGHip_M_Hair_000"},
{ID: 21, Name: "Hipster Youth", Collection: "multiplayer_overlays", Overlay: "NGHip_M_Hair_001"},
{ID: 22, Name: "Mullet", Collection: "multiplayer_overlays", Overlay: "NGInd_M_Hair_000"},
{ID: 24, Name: "Classic Cornrows", Collection: "mplowrider_overlays", Overlay: "LR_M_Hair_000"},
{ID: 25, Name: "Palm Cornrows", Collection: "mplowrider_overlays", Overlay: "LR_M_Hair_001"},
{ID: 26, Name: "Lightning Cornrows", Collection: "mplowrider_overlays", Overlay: "LR_M_Hair_002"},
{ID: 27, Name: "Whipped Cornrows", Collection: "mplowrider_overlays", Overlay: "LR_M_Hair_003"},
{ID: 28, Name: "Zig Zag Cornrows", Collection: "mplowrider2_overlays", Overlay: "LR_M_Hair_004"},
{ID: 29, Name: "Snail Cornrows", Collection: "mplowrider2_overlays", Overlay: "LR_M_Hair_005"},
{ID: 30, Name: "Hightop", Collection: "mplowrider2_overlays", Overlay: "LR_M_Hair_006"},
{ID: 31, Name: "Loose Swept Back", Collection: "mpbiker_overlays", Overlay: "MP_Biker_Hair_000_M"},
{ID: 32, Name: "Undercut Swept Back", Collection: "mpbiker_overlays", Overlay: "MP_Biker_Hair_001_M"},
{ID: 33, Name: "Undercut Swept Side", Collection: "mpbiker_overlays", Overlay: "MP_Biker_Hair_002_M"},
{ID: 34, Name: "Spiked Mohawk", Collection: "mpbiker_overlays", Overlay: "MP_Biker_Hair_003_M"},
{ID: 35, Name: "Mod", Collection: "mpbiker_overlays", Overlay: "MP_Biker_Hair_004_M"},
{ID: 36, Name: "Layered Mod", Collection: "mpbiker_overlays", Overlay: "MP_Biker_Hair_005_M"},
{ID: 72, Name: "Flattop", Collection: "mpgunrunning_overlays", Overlay: "MP_Gunrunning_Hair_M_000_M"},
{ID: 73, Name: "Military Buzzcut", Collection: "mpgunrunning_overlays", Overlay: "MP_Gunrunning_Hair_M_001_M"}
],
// female
[
{ID: 0, Name: "Close Shave", Collection: "mpbeach_overlays", Overlay: "FM_Hair_Fuzz"},
{ID: 1, Name: "Short", Collection: "multiplayer_overlays", Overlay: "NG_F_Hair_001"},
{ID: 2, Name: "Layered Bob", Collection: "multiplayer_overlays", Overlay: "NG_F_Hair_002"},
{ID: 3, Name: "Pigtails", Collection: "multiplayer_overlays", Overlay: "NG_F_Hair_003"},
{ID: 4, Name: "Ponytail", Collection: "multiplayer_overlays", Overlay: "NG_F_Hair_004"},
{ID: 5, Name: "Braided Mohawk", Collection: "multiplayer_overlays", Overlay: "NG_F_Hair_005"},
{ID: 6, Name: "Braids", Collection: "multiplayer_overlays", Overlay: "NG_F_Hair_006"},
{ID: 7, Name: "Bob", Collection: "multiplayer_overlays", Overlay: "NG_F_Hair_007"},
{ID: 8, Name: "Faux Hawk", Collection: "multiplayer_overlays", Overlay: "NG_F_Hair_008"},
{ID: 9, Name: "French Twist", Collection: "multiplayer_overlays", Overlay: "NG_F_Hair_009"},
{ID: 10, Name: "Long Bob", Collection: "multiplayer_overlays", Overlay: "NG_F_Hair_010"},
{ID: 11, Name: "Loose Tied", Collection: "multiplayer_overlays", Overlay: "NG_F_Hair_011"},
{ID: 12, Name: "Pixie", Collection: "multiplayer_overlays", Overlay: "NG_F_Hair_012"},
{ID: 13, Name: "Shaved Bangs", Collection: "multiplayer_overlays", Overlay: "NG_F_Hair_013"},
{ID: 14, Name: "Top Knot", Collection: "multiplayer_overlays", Overlay: "NG_M_Hair_014"},
{ID: 15, Name: "Wavy Bob", Collection: "multiplayer_overlays", Overlay: "NG_M_Hair_015"},
{ID: 16, Name: "Messy Bun", Collection: "multiplayer_overlays", Overlay: "NGBea_F_Hair_000"},
{ID: 17, Name: "Pin Up Girl", Collection: "multiplayer_overlays", Overlay: "NGBea_F_Hair_001"},
{ID: 18, Name: "Tight Bun", Collection: "multiplayer_overlays", Overlay: "NG_F_Hair_007"},
{ID: 19, Name: "Twisted Bob", Collection: "multiplayer_overlays", Overlay: "NGBus_F_Hair_000"},
{ID: 20, Name: "Flapper Bob", Collection: "multiplayer_overlays", Overlay: "NGBus_F_Hair_001"},
{ID: 21, Name: "Big Bangs", Collection: "multiplayer_overlays", Overlay: "NGBea_F_Hair_001"},
{ID: 22, Name: "Braided Top Knot", Collection: "multiplayer_overlays", Overlay: "NGHip_F_Hair_000"},
{ID: 23, Name: "Mullet", Collection: "multiplayer_overlays", Overlay: "NGInd_F_Hair_000"},
{ID: 25, Name: "Pinched Cornrows", Collection: "mplowrider_overlays", Overlay: "LR_F_Hair_000"},
{ID: 26, Name: "Leaf Cornrows", Collection: "mplowrider_overlays", Overlay: "LR_F_Hair_001"},
{ID: 27, Name: "Zig Zag Cornrows", Collection: "mplowrider_overlays", Overlay: "LR_F_Hair_002"},
{ID: 28, Name: "Pigtail Bangs", Collection: "mplowrider2_overlays", Overlay: "LR_F_Hair_003"},
{ID: 29, Name: "Wave Braids", Collection: "mplowrider2_overlays", Overlay: "LR_F_Hair_003"},
{ID: 30, Name: "Coil Braids", Collection: "mplowrider2_overlays", Overlay: "LR_F_Hair_004"},
{ID: 31, Name: "Rolled Quiff", Collection: "mplowrider2_overlays", Overlay: "LR_F_Hair_006"},
{ID: 32, Name: "Loose Swept Back", Collection: "mpbiker_overlays", Overlay: "MP_Biker_Hair_000_F"},
{ID: 33, Name: "Undercut Swept Back", Collection: "mpbiker_overlays", Overlay: "MP_Biker_Hair_001_F"},
{ID: 34, Name: "Undercut Swept Side", Collection: "mpbiker_overlays", Overlay: "MP_Biker_Hair_002_F"},
{ID: 35, Name: "Spiked Mohawk", Collection: "mpbiker_overlays", Overlay: "MP_Biker_Hair_003_F"},
{ID: 36, Name: "Bandana and Braid", Collection: "multiplayer_overlays", Overlay: "NG_F_Hair_003"},
{ID: 37, Name: "Layered Mod", Collection: "mpbiker_overlays", Overlay: "MP_Biker_Hair_006_F"},
{ID: 38, Name: "Skinbyrd", Collection: "mpbiker_overlays", Overlay: "MP_Biker_Hair_004_F"},
{ID: 76, Name: "Neat Bun", Collection: "mpgunrunning_overlays", Overlay: "MP_Gunrunning_Hair_F_000_F"},
{ID: 77, Name: "Short Bob", Collection: "mpgunrunning_overlays", Overlay: "MP_Gunrunning_Hair_F_001_F"}
]
];
const eyeColors = ["Green", "Emerald", "Light Blue", "Ocean Blue", "Light Brown", "Dark Brown", "Hazel", "Dark Gray", "Light Gray", "Pink", "Yellow", "Purple", "Blackout", "Shades of Gray", "Tequila Sunrise", "Atomic", "Warp", "ECola", "Space Ranger", "Ying Yang", "Bullseye", "Lizard", "Dragon", "Extra Terrestrial", "Goat", "Smiley", "Possessed", "Demon", "Infected", "Alien", "Undead", "Zombie"];
exports = {
fathers: fathers,
mothers: mothers,
fatherNames: fatherNames,
motherNames: motherNames,
featureNames: featureNames,
appearanceNames: appearanceNames,
appearanceItemNames: appearanceItemNames,
hairList: hairList,
eyeColors: eyeColors,
maxHairColor: 64,
maxEyeColor: 32,
maxBlushColor: 27,
maxLipstickColor: 32
};

View File

@@ -0,0 +1,564 @@
// shitcode will be better in the future
// , \u00dc, \u00fc
// , \u00c4, \u00e4
// , \u00d6, \u00f6
// \u00df
var creatorHairMenu;
const NativeUI = require("nativeui");
const Data = require("CharCreator/data");
const Menu = NativeUI.Menu;
const UIMenuItem = NativeUI.UIMenuItem;
const UIMenuListItem = NativeUI.UIMenuListItem;
const UIMenuCheckboxItem = NativeUI.UIMenuCheckboxItem;
const BadgeStyle = NativeUI.BadgeStyle;
const Point = NativeUI.Point;
const ItemsCollection = NativeUI.ItemsCollection;
const Color = NativeUI.Color;
const creatorCoords = {
camera: new mp.Vector3(402.8664, -997.5515, -98.5),
cameraLookAt: new mp.Vector3(402.8664, -996.4108, -98.5)
};
const localPlayer = mp.players.local;
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function colorForOverlayIdx(index) {
let color;
switch (index) {
case 1:
color = beardColorItem.Index;
break;
case 2:
color = eyebrowColorItem.Index;
break;
case 5:
color = blushColorItem.Index;
break;
case 8:
color = lipstickColorItem.Index;
break;
case 10:
color = chestHairColorItem.Index;
break;
default:
color = 0;
}
return color;
}
function updateParents() {
localPlayer.setHeadBlendData(
// shape
Data.mothers[motherItem.Index],
Data.fathers[fatherItem.Index],
0,
// skin
Data.mothers[motherItem.Index],
Data.fathers[fatherItem.Index],
0,
// mixes
similarityItem.Index * 0.01,
skinSimilarityItem.Index * 0.01,
0.0,
false
);
}
function updateFaceFeature(index) {
localPlayer.setFaceFeature(index, parseFloat(featureItems[index].SelectedValue));
}
function updateAppearance(index) {
let overlayID = (appearanceItems[index].Index == 0) ? 255 : appearanceItems[index].Index - 1;
localPlayer.setHeadOverlay(index, overlayID, appearanceOpacityItems[index].Index * 0.01, colorForOverlayIdx(index), 0);
}
function updateHairAndColors() {
localPlayer.setComponentVariation(2, Data.hairList[currentGender][hairItem.Index].ID, 0, 2);
localPlayer.setHairColor(hairColorItem.Index, hairHighlightItem.Index);
localPlayer.setEyeColor(eyeColorItem.Index);
localPlayer.setHeadOverlayColor(1, 1, beardColorItem.Index, 0);
localPlayer.setHeadOverlayColor(2, 1, eyebrowColorItem.Index, 0);
localPlayer.setHeadOverlayColor(5, 2, blushColorItem.Index, 0);
localPlayer.setHeadOverlayColor(8, 2, lipstickColorItem.Index, 0);
localPlayer.setHeadOverlayColor(10, 1, chestHairColorItem.Index, 0);
}
function applyCreatorOutfit() {
if (currentGender == 0) {
localPlayer.setDefaultComponentVariation();
localPlayer.setComponentVariation(3, 15, 0, 2);
localPlayer.setComponentVariation(4, 21, 0, 2);
localPlayer.setComponentVariation(6, 34, 0, 2);
localPlayer.setComponentVariation(8, 15, 0, 2);
localPlayer.setComponentVariation(11, 15, 0, 2);
} else {
localPlayer.setDefaultComponentVariation();
localPlayer.setComponentVariation(3, 15, 0, 2);
localPlayer.setComponentVariation(4, 10, 0, 2);
localPlayer.setComponentVariation(6, 35, 0, 2);
localPlayer.setComponentVariation(8, 15, 0, 2);
localPlayer.setComponentVariation(11, 15, 0, 2);
}
}
function fillHairMenu() {
hairItem = new UIMenuListItem("Haar", "Deine Haare", new ItemsCollection(Data.hairList[currentGender].map(h => h.Name)));
creatorHairMenu.AddItem(hairItem);
hairColorItem = new UIMenuListItem("Haarfarbe", "Deine Haarfarbe", new ItemsCollection(hairColors));
creatorHairMenu.AddItem(hairColorItem);
hairHighlightItem = new UIMenuListItem("Haarstr\u00e4hnen", "Farbe deiner Haarstr\u00e4hnen", new ItemsCollection(hairColors));
creatorHairMenu.AddItem(hairHighlightItem);
eyebrowColorItem = new UIMenuListItem("Augenbrauen Farbe", "Farbe deiner Augenbrauen", new ItemsCollection(hairColors));
creatorHairMenu.AddItem(eyebrowColorItem);
beardColorItem = new UIMenuListItem("Farbe der Gesichtsbehaarung", "Farbe deiner Gesichtsbehaarung", new ItemsCollection(hairColors));
creatorHairMenu.AddItem(beardColorItem);
eyeColorItem = new UIMenuListItem("Augenfarbe", "Farbe deiner Augen", new ItemsCollection(Data.eyeColors));
creatorHairMenu.AddItem(eyeColorItem);
blushColorItem = new UIMenuListItem("Rouge", "Farbe des Rouges.", new ItemsCollection(blushColors));
creatorHairMenu.AddItem(blushColorItem);
lipstickColorItem = new UIMenuListItem("Lippenstift Farbe", "Farbe deines Lippenstifts.", new ItemsCollection(lipstickColors));
creatorHairMenu.AddItem(lipstickColorItem);
chestHairColorItem = new UIMenuListItem("Farbe der Brustbehaarung", "Farbe deiner Brustbehaarung", new ItemsCollection(hairColors));
creatorHairMenu.AddItem(chestHairColorItem);
creatorHairMenu.AddItem(new UIMenuItem("Zuf\u00e4llig", "~r~Zuf\u00e4lliges Haar & Farben"));
creatorHairMenu.AddItem(new UIMenuItem("Zur\u00fccksetzen", "~r~Zur\u00fccksetzen von Haar & Farben"));
}
function resetParentsMenu(refresh = false) {
fatherItem.Index = 0;
motherItem.Index = 0;
similarityItem.Index = (currentGender == 0) ? 100 : 0;
skinSimilarityItem.Index = (currentGender == 0) ? 100 : 0;
updateParents();
if (refresh) creatorParentsMenu.RefreshIndex();
}
function resetFeaturesMenu(refresh = false) {
for (let i = 0; i < Data.featureNames.length; i++) {
featureItems[i].Index = 100;
updateFaceFeature(i);
}
if (refresh) creatorFeaturesMenu.RefreshIndex();
}
function resetAppearanceMenu(refresh = false) {
for (let i = 0; i < Data.appearanceNames.length; i++) {
appearanceItems[i].Index = 0;
appearanceOpacityItems[i].Index = 100;
updateAppearance(i);
}
if (refresh) creatorAppearanceMenu.RefreshIndex();
}
function resetHairAndColorsMenu(refresh = false) {
hairItem.Index = 0;
hairColorItem.Index = 0;
hairHighlightItem.Index = 0;
eyebrowColorItem.Index = 0;
beardColorItem.Index = 0;
eyeColorItem.Index = 0;
blushColorItem.Index = 0;
lipstickColorItem.Index = 0;
chestHairColorItem.Index = 0;
updateHairAndColors();
if (refresh) creatorHairMenu.RefreshIndex();
}
let currentGender = 0;
let creatorMenus = [];
let creatorCamera;
// color arrays
let hairColors = [];
for (let i = 0; i < Data.maxHairColor; i++) hairColors.push(i.toString());
let blushColors = [];
for (let i = 0; i < Data.maxBlushColor; i++) blushColors.push(i.toString());
let lipstickColors = [];
for (let i = 0; i < Data.maxLipstickColor; i++) lipstickColors.push(i.toString());
// CREATOR MAIN
let creatorMainMenu = new Menu("Charaktererstellung", "", new Point(50, 50));
let genderItem = new UIMenuListItem("Geschlecht", "~r~Dies setzt deine Einstellungen zur\u00fcck.", new ItemsCollection(["M\u00e4nnlich", "Weiblich"]));
creatorMainMenu.AddItem(genderItem);
creatorMainMenu.AddItem(new UIMenuItem("Eltern", "Eltern des Charakters."));
creatorMainMenu.AddItem(new UIMenuItem("Gesichtsz\u00fcge", "Gesichtsz\u00fcge des Charakters."));
creatorMainMenu.AddItem(new UIMenuItem("Aussehen", "Aussehen des Charakters."));
creatorMainMenu.AddItem(new UIMenuItem("Haar & Farben", "Haare & Farben deines Charakters."));
let angles = [];
for (let i = -180.0; i <= 180.0; i += 5.0) angles.push(i.toFixed(1));
let angleItem = new UIMenuListItem("Drehung", "", new ItemsCollection(angles));
creatorMainMenu.AddItem(angleItem);
let saveItem = new UIMenuItem("Erstellen", "Erstellt deinen Charakter.");
saveItem.BackColor = new Color(13, 71, 161);
saveItem.HighlightedBackColor = new Color(25, 118, 210);
creatorMainMenu.AddItem(saveItem);
//let cancelItem = new UIMenuItem("Abbrechen", "Setzt alle \u00c4nderungen zur\u00fcck.");
//cancelItem.BackColor = new Color(213, 0, 0);
//cancelItem.HighlightedBackColor = new Color(229, 57, 53);
//creatorMainMenu.AddItem(cancelItem);
creatorMainMenu.ListChange.on((item, listIndex) => {
if (item == genderItem) {
currentGender = listIndex;
mp.events.callRemote("creator_GenderChange", listIndex);
setTimeout(() => {
localPlayer.clearTasksImmediately();
applyCreatorOutfit();
angleItem.Index = 0;
resetParentsMenu(true);
resetFeaturesMenu(true);
resetAppearanceMenu(true);
creatorHairMenu.Clear();
fillHairMenu();
creatorHairMenu.RefreshIndex();
}, 200);
} else if (item == angleItem) {
localPlayer.setHeading(parseFloat(angleItem.SelectedValue));
localPlayer.clearTasksImmediately();
}
});
creatorMainMenu.ItemSelect.on((item, index) => {
switch (index) {
case 1:
creatorMainMenu.Visible = false;
creatorParentsMenu.Visible = true;
break;
case 2:
creatorMainMenu.Visible = false;
creatorFeaturesMenu.Visible = true;
break;
case 3:
creatorMainMenu.Visible = false;
creatorAppearanceMenu.Visible = true;
break;
case 4:
creatorMainMenu.Visible = false;
creatorHairMenu.Visible = true;
break;
case 6:
let parentData = {
Father: Data.fathers[fatherItem.Index],
Mother: Data.mothers[motherItem.Index],
Similarity: similarityItem.Index * 0.01,
SkinSimilarity: skinSimilarityItem.Index * 0.01
};
let featureData = [];
for (let i = 0; i < featureItems.length; i++) featureData.push(parseFloat(featureItems[i].SelectedValue));
let appearanceData = [];
for (let i = 0; i < appearanceItems.length; i++) appearanceData.push({Value: ((appearanceItems[i].Index == 0) ? 255 : appearanceItems[i].Index - 1), Opacity: appearanceOpacityItems[i].Index * 0.01});
let hairAndColors = [
Data.hairList[currentGender][hairItem.Index].ID,
hairColorItem.Index,
hairHighlightItem.Index,
eyebrowColorItem.Index,
beardColorItem.Index,
eyeColorItem.Index,
blushColorItem.Index,
lipstickColorItem.Index,
chestHairColorItem.Index
];
for (let i = 0; i < creatorMenus.length; i++) creatorMenus[i].Visible = false;
mp.gui.chat.show(true);
mp.game.ui.displayRadar(true);
mp.game.ui.displayHud(true);
localPlayer.freezePosition(false);
localPlayer.setDefaultComponentVariation();
localPlayer.setComponentVariation(2, Data.hairList[currentGender][hairItem.Index].ID, 0, 2);
mp.game.cam.renderScriptCams(false, false, 0, true, false);
mp.events.callRemote("creatorSave", currentGender, JSON.stringify(parentData), JSON.stringify(featureData), JSON.stringify(appearanceData), JSON.stringify(hairAndColors));
break;
case 7:
mp.events.callRemote("creator_Leave");
break;
}
});
creatorMainMenu.MenuClose.on(() => {
mp.events.callRemote("creator_Leave");
});
creatorMainMenu.Visible = false;
creatorMenus.push(creatorMainMenu);
// CREATOR MAIN END
// CREATOR PARENTS
let similarities = [];
for (let i = 0; i <= 100; i++) similarities.push(i + "%");
let creatorParentsMenu = new Menu("Eltern", "", new Point(50, 50));
let fatherItem = new UIMenuListItem("Vater", "Dem Charakter sein Vadda.", new ItemsCollection(Data.fatherNames));
let motherItem = new UIMenuListItem("Mutter", "Dem Charakter seine Mudda.", new ItemsCollection(Data.motherNames));
let similarityItem = new UIMenuListItem("\u00c4hnlichkeit", "\u00c4hnlichkeit zu den Eltern.\n(niedriger = feminin, h\u00f6her = maskulin)", new ItemsCollection(similarities));
let skinSimilarityItem = new UIMenuListItem("Hautfarbe", "Hautfarben \u00c4hnlichkeit zu den Eltern.\n(niedriger = Mutter, h\u00f6her = Vater)", new ItemsCollection(similarities));
creatorParentsMenu.AddItem(fatherItem);
creatorParentsMenu.AddItem(motherItem);
creatorParentsMenu.AddItem(similarityItem);
creatorParentsMenu.AddItem(skinSimilarityItem);
creatorParentsMenu.AddItem(new UIMenuItem("Zuf\u00e4llig", "~r~Zuf\u00e4llige Eltern."));
creatorParentsMenu.AddItem(new UIMenuItem("Zur\u00fccksetzen", "~r~Setzt die Eltern zur\u00fcck. :'("));
creatorParentsMenu.ItemSelect.on((item, index) => {
switch (item.Text) {
case "Zuf\u00e4llig":
fatherItem.Index = getRandomInt(0, Data.fathers.length - 1);
motherItem.Index = getRandomInt(0, Data.mothers.length - 1);
similarityItem.Index = getRandomInt(0, 100);
skinSimilarityItem.Index = getRandomInt(0, 100);
updateParents();
break;
case "Zur\u00fccksetzen":
resetParentsMenu();
break;
}
});
creatorParentsMenu.ListChange.on((item, listIndex) => {
updateParents();
});
creatorParentsMenu.ParentMenu = creatorMainMenu;
creatorParentsMenu.Visible = false;
creatorMenus.push(creatorParentsMenu);
// CREATOR PARENTS END
// CREATOR FEATURES
let featureItems = [];
let features = [];
for (let i = -1.0; i <= 1.01; i += 0.01) features.push(i.toFixed(2));
let creatorFeaturesMenu = new Menu("Gesichtsz\u00fcge", "", new Point(50, 50));
for (let i = 0; i < Data.featureNames.length; i++) {
let tempFeatureItem = new UIMenuListItem(Data.featureNames[i], "", new ItemsCollection(features));
tempFeatureItem.Index = 100;
featureItems.push(tempFeatureItem);
creatorFeaturesMenu.AddItem(tempFeatureItem);
}
creatorFeaturesMenu.AddItem(new UIMenuItem("Zuf\u00e4llig", "~r~Zuf\u00e4llige Gesichtsz\u00fcge."));
creatorFeaturesMenu.AddItem(new UIMenuItem("Zur\u00fccksetzen", "~r~Setzt Gesichtsz\u00fcge zur\u00fcck."));
creatorFeaturesMenu.ItemSelect.on((item, index) => {
switch (item.Text) {
case "Zuf\u00e4llig":
for (let i = 0; i < Data.featureNames.length; i++) {
featureItems[i].Index = getRandomInt(0, 200);
updateFaceFeature(i);
}
break;
case "Zur\u00fccksetzen":
resetFeaturesMenu();
break;
}
});
creatorFeaturesMenu.ListChange.on((item, listIndex) => {
updateFaceFeature(featureItems.indexOf(item));
});
creatorFeaturesMenu.ParentMenu = creatorMainMenu;
creatorFeaturesMenu.Visible = false;
creatorMenus.push(creatorFeaturesMenu);
// CREATOR FEATURES END
// CREATOR APPEARANCE
let appearanceItems = [];
let appearanceOpacityItems = [];
let opacities = [];
for (let i = 0; i <= 100; i++) opacities.push(i + "%");
let creatorAppearanceMenu = new Menu("Aussehen", "", new Point(50, 50));
for (let i = 0; i < Data.appearanceNames.length; i++) {
let items = [];
for (let j = 0, max = mp.game.ped.getNumHeadOverlayValues(i); j <= max; j++) items.push((Data.appearanceItemNames[i][j] === undefined) ? j.toString() : Data.appearanceItemNames[i][j]);
let tempAppearanceItem = new UIMenuListItem(Data.appearanceNames[i], "", new ItemsCollection(items));
appearanceItems.push(tempAppearanceItem);
creatorAppearanceMenu.AddItem(tempAppearanceItem);
let tempAppearanceOpacityItem = new UIMenuListItem(Data.appearanceNames[i] + " Transparenz", "", new ItemsCollection(opacities));
tempAppearanceOpacityItem.Index = 100;
appearanceOpacityItems.push(tempAppearanceOpacityItem);
creatorAppearanceMenu.AddItem(tempAppearanceOpacityItem);
}
creatorAppearanceMenu.AddItem(new UIMenuItem("Zuf\u00e4llig", "~r~Zuf\u00e4lliges Aussehen."));
creatorAppearanceMenu.AddItem(new UIMenuItem("Zur\u00fccksetzen", "~r~Setzt das Aussehen zur\u00fcck."));
creatorAppearanceMenu.ItemSelect.on((item, index) => {
switch (item.Text) {
case "Zuf\u00e4llig":
for (let i = 0; i < Data.appearanceNames.length; i++) {
appearanceItems[i].Index = getRandomInt(0, mp.game.ped.getNumHeadOverlayValues(i) - 1);
appearanceOpacityItems[i].Index = getRandomInt(0, 100);
updateAppearance(i);
}
break;
case "Zur\u00fccksetzen":
resetAppearanceMenu();
break;
}
});
creatorAppearanceMenu.ListChange.on((item, listIndex) => {
let idx = (creatorAppearanceMenu.CurrentSelection % 2 == 0) ? (creatorAppearanceMenu.CurrentSelection / 2) : Math.floor(creatorAppearanceMenu.CurrentSelection / 2);
updateAppearance(idx);
});
creatorAppearanceMenu.ParentMenu = creatorMainMenu;
creatorAppearanceMenu.Visible = false;
creatorMenus.push(creatorAppearanceMenu);
// CREATOR APPEARANCE END
// CREATOR HAIR & COLORS
let hairItem;
let hairColorItem;
let hairHighlightItem;
let eyebrowColorItem;
let beardColorItem;
let eyeColorItem;
let blushColorItem;
let lipstickColorItem;
let chestHairColorItem;
creatorHairMenu = new Menu("Haar & Farben", "", new Point(50, 50));
fillHairMenu();
creatorHairMenu.ItemSelect.on((item, index) => {
switch (item.Text) {
case "Zuf\u00e4llig":
hairItem.Index = getRandomInt(0, Data.hairList[currentGender].length - 1);
hairColorItem.Index = getRandomInt(0, Data.maxHairColor);
hairHighlightItem.Index = getRandomInt(0, Data.maxHairColor);
eyebrowColorItem.Index = getRandomInt(0, Data.maxHairColor);
beardColorItem.Index = getRandomInt(0, Data.maxHairColor);
eyeColorItem.Index = getRandomInt(0, Data.maxEyeColor);
blushColorItem.Index = getRandomInt(0, Data.maxBlushColor);
lipstickColorItem.Index = getRandomInt(0, Data.maxLipstickColor);
chestHairColorItem.Index = getRandomInt(0, Data.maxHairColor);
updateHairAndColors();
break;
case "Zur\u00fccksetzen":
resetHairAndColorsMenu();
break;
}
});
creatorHairMenu.ListChange.on((item, listIndex) => {
if (item == hairItem) {
let hairStyle = Data.hairList[currentGender][listIndex];
localPlayer.setComponentVariation(2, hairStyle.ID, 0, 2);
} else {
switch (creatorHairMenu.CurrentSelection) {
case 1: // hair color
localPlayer.setHairColor(listIndex, hairHighlightItem.Index);
break;
case 2: // hair highlight color
localPlayer.setHairColor(hairColorItem.Index, listIndex);
break;
case 3: // eyebrow color
localPlayer.setHeadOverlayColor(2, 1, listIndex, 0);
break;
case 4: // facial hair color
localPlayer.setHeadOverlayColor(1, 1, listIndex, 0);
break;
case 5: // eye color
localPlayer.setEyeColor(listIndex);
break;
case 6: // blush color
localPlayer.setHeadOverlayColor(5, 2, listIndex, 0);
break;
case 7: // lipstick color
localPlayer.setHeadOverlayColor(8, 2, listIndex, 0);
break;
case 8: // chest hair color
localPlayer.setHeadOverlayColor(10, 1, listIndex, 0);
break;
}
}
});
creatorHairMenu.ParentMenu = creatorMainMenu;
creatorHairMenu.Visible = false;
creatorMenus.push(creatorHairMenu);
// CREATOR HAIR & COLORS END
// EVENTS
mp.events.add("toggleCreator", (active, charData) => {
if (creatorCamera === undefined) {
creatorCamera = mp.cameras.new("creatorCamera", creatorCoords.camera, new mp.Vector3(0, 0, 0), 45);
creatorCamera.pointAtCoord(creatorCoords.cameraLookAt);
creatorCamera.setActive(true);
creatorMainMenu.Visible = true;
mp.gui.chat.show(false);
mp.game.ui.displayRadar(false);
mp.game.ui.displayHud(false);
localPlayer.clearTasksImmediately();
localPlayer.freezePosition(true);
mp.game.cam.renderScriptCams(true, false, 0, true, false);
}
});
mp.events.add("sendToServer", (characterData) => {
mp.events.callRemote("creatorSave", characterData);
});

View File

@@ -0,0 +1,5 @@
mp.events.add('changeDoorState', (doorHash, x, y, z, locked, p5, p6, p7) => {
locked === 1 ? locked = true : locked = false;
mp.game.object.doorControl(doorHash, x, y, z, locked, p5, p6, p7);
});

View File

@@ -0,0 +1,40 @@
/**
* @overview Life of German Reallife - Faction Manager Main (main.js)
* @author hydrant
* @copyright (c) 2008 - 2018 Life of German
*/
var manageFactionRanksBrowser = null;
var rankData = null;
mp.events.add('manageFactionRanks', (ranks) => {
if (manageFactionRanksBrowser !== null) return;
manageFactionRanksBrowser = mp.browsers.new('package://assets/html/factionmanagement/ranks/index.html');
mp.gui.chat.activate(false);
rankData = JSON.parse(ranks);
});
mp.events.add('onManageFactionRanksLoaded', () => {
if (manageFactionRanksBrowser !== null) {
manageFactionRanksBrowser.execute(`loadData(` + JSON.stringify(rankData.Ranks) + `)`);
mp.gui.cursor.show(true, true);
}
});
mp.events.add('saveFactionRankData', function (data) {
if (manageFactionRanksBrowser !== null) {
manageFactionRanksBrowser.destroy();
mp.gui.cursor.show(false, false);
mp.gui.chat.activate(true);
var obj = new Object();
obj.FactionId = rankData.FactionId;
obj.Ranks = JSON.parse(data);
mp.events.callRemote('OnFactionRanksEdit', JSON.stringify(obj));
manageFactionRanksBrowser = null;
}
});

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,102 @@
/**
* @overview Life of German Reallife - Gui Infobox infobox.js
* @author VegaZ
* @copyright (c) 2008 - 2018 Life of German
*/
var playerName;
var playerId;
var playerMoney;
var dutyMedics = 0;
var isDeath = false;
var deathTime;
var respawnTime;
var deathSeconds;
var fade;
mp.game.gameplay.setFadeOutAfterDeath(false);
mp.events.add("startDeathTimer", (isAdmin) => {
if (isDeath === false) {
isDeath = true;
if (isAdmin) {
mp.gui.chat.activate(true);
}
else {
mp.gui.chat.activate(false);
}
mp.game.audio.playSoundFrontend(-1, "Bed", "WastedSounds", true);
deathDate = new Date();
respawnTime = Math.floor(deathDate.getTime() / 1000 + 120);
fade = 255 - 120;
mp.game.graphics.requestStreamedTextureDict("Mptattoos", true);
}
});
mp.events.add("onPlayerRevived", () => {
isDeath = false;
mp.gui.chat.activate(true);
mp.game.gameplay.setFadeOutAfterDeath(false);
mp.game.graphics.setStreamedTextureDictAsNoLongerNeeded("Mptattoos");
});
mp.events.add("respawnDeathPlayer", () => {
isDeath = false;
mp.gui.chat.activate(true);
mp.game.gameplay.setFadeOutAfterDeath(false);
mp.events.callRemote('RespawnPlayerAtHospital');
mp.game.graphics.setStreamedTextureDictAsNoLongerNeeded("Mptattoos");
});
mp.events.add("updateDutyMedics", (count) => {
dutyMedics = count;
});
mp.events.add("render", () => {
currentDate = new Date();
if (isDeath === true) {
var medicString;
if (dutyMedics > 0) {
medicString = "Derzeit ";
if (dutyMedics === 1) {
medicString += "ist ~g~" + dutyMedics + " Medic";
} else {
medicString = "sind ~g~" + dutyMedics + " Medics";
}
medicString += " ~s~im Dienst ~c~und versuchen dich wiederzubeleben...";
} else {
medicString = "Derzeit sind ~r~keine Medics ~s~im Dienst.";
}
deathSeconds = respawnTime - Math.floor(currentDate.getTime() / 1000);
var alpha = fade + Math.floor(currentDate.getTime() / 1000 - deathDate.getTime() / 1000);
if (deathSeconds >= 0) {
mp.game.graphics.set2dLayer(2);
mp.game.graphics.drawSprite("Mptattoos", "clearout", 0.625, 0.52, 0.1, 0.1, 0, 255, 255, 255, 236);
mp.game.graphics.drawText("Respawn in: ~y~" + deathSeconds, [0.5, 0.5],
{
font: 7,
color: [255, 255, 255, 255],
scale: [0.8, 0.8],
outline: true
});
mp.game.graphics.drawText(medicString, [0.5, 0.975],
{
font: 4,
color: [255, 255, 255, 255],
scale: [0.4, 0.4],
outline: true
});
mp.game.graphics.set2dLayer(1);
mp.game.graphics.drawRect(0.5, 0.5, 1, 1, 0, 0, 0, alpha);
} else {
mp.events.call("respawnDeathPlayer");
}
}
});

View File

@@ -0,0 +1,208 @@
/**
* @overview Life of German Reallife - Gui Infobox infobox.js
* @author VegaZ
* @copyright (c) 2008 - 2018 Life of German
*/
var currentdate;
var dateString;
var timeString;
var draw = false;
var editMode = false;
let posX = 0.92;
let posY = 0.45;
let width = 0.1;
let height = 0.2;
let colorR = 0;
let colorG = 0;
let colorB = 0;
let colorA = 72;
var day;
var month;
var year;
var hour;
var minute;
var second;
var nDay;
var nMonth;
var nHour;
var nMinute;
var nSecond;
var playerName;
var playerId;
var playerMoney;
mp.events.add("draw", (pName, pId) => {
playerName = pName;
playerId = pId;
draw = true;
});
mp.events.add("toggleEditMode", (toggle) => {
editMode = toggle;
});
mp.events.add("toggleUi", (show) => {
if (show === false) {
draw = false;
mp.game.ui.displayRadar(false);
mp.game.ui.displayHud(false);
mp.gui.chat.show(false);
globalData.HideGui = true;
} else {
draw = true;
mp.game.ui.displayRadar(true);
mp.game.ui.displayHud(true);
mp.gui.chat.show(true);
globalData.HideGui = false;
}
});
//function currencyFormatDE(num) {
// return ('$' + num.toFixed(2).replace('.', ',').replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1.'));
//}
const moneyFormat = require("moneyformat");
mp.events.add("updateMoney", (money) => {
playerMoney = moneyFormat(money);
});
mp.events.add("render", () => {
if (draw === true) {
currentdate = new Date();
day = currentdate.getDate();
month = currentdate.getMonth();
year = currentdate.getFullYear();
hour = currentdate.getHours();
minute = currentdate.getMinutes();
second = currentdate.getSeconds();
if (day < 10) {
nDay = "0" + day;
} else nDay = day;
if (hour < 10) {
nHour = "0" + hour;
} else nHour = hour;
if (minute < 10) {
nMinute = "0" + minute;
} else nMinute = minute;
if (second < 10) {
nSecond = "0" + second;
} else nSecond = second;
switch (month) {
case 0:
nMonth = "Jan.";
break;
case 1:
nMonth = "Feb.";
break;
case 2:
nMonth = "Mär.";
break;
case 3:
nMonth = "Apr.";
break;
case 4:
nMonth = "Mai";
break;
case 5:
nMonth = "Jun.";
break;
case 6:
nMonth = "Jul.";
break;
case 7:
nMonth = "Aug.";
break;
case 8:
nMonth = "Sep.";
break;
case 9:
nMonth = "Okt.";
break;
case 10:
nMonth = "Nov.";
break;
case 11:
nMonth = "Dez.";
break;
}
dateString = nDay + ". " + nMonth + " " + year;
timeString = nHour + ":" + nMinute + ":" + nSecond + " Uhr";
mp.game.graphics.requestStreamedTextureDict("digitaloverlay", true);
//static
mp.game.graphics.drawSprite("digitaloverlay", "static1", posX, posY, width, height, 0, 0, 255, 0, 88);
//mp.game.graphics.drawRect(posX, posY, width, height, colorR, colorG, colorB, colorA);
mp.game.graphics.drawText(playerName + " (" + playerId + ")", [0.92, 0.351],
{
font: 4,
color: [255, 255, 255, 255],
scale: [0.5, 0.5],
outline: true
})
mp.game.graphics.drawText(dateString + "\n" + timeString, [0.938, 0.381],
{
font: 4,
color: [255, 255, 255, 255],
scale: [0.5, 0.5],
outline: true
})
mp.game.graphics.drawText("~g~$~s~" + playerMoney, [0.938, 0.441],
{
font: 4,
color: [255, 255, 255, 255],
scale: [0.5, 0.5],
outline: true
})
mp.game.graphics.drawText("~r~Datum: ", [0.89, 0.381],
{
font: 4,
color: [255, 255, 255, 255],
scale: [0.5, 0.5],
outline: true
})
mp.game.graphics.drawText("~r~Uhrzeit: ", [0.891, 0.411],
{
font: 4,
color: [255, 255, 255, 255],
scale: [0.5, 0.5],
outline: true
})
mp.game.graphics.drawText("~y~Bank: ", [0.887, 0.441],
{
font: 4,
color: [255, 255, 255, 255],
scale: [0.5, 0.5],
outline: true
})
}
if (editMode === true) {
mp.game.graphics.drawText("~r~EDIT-MODE AKTIV", [0.5, 0],
{
font: 4,
color: [255, 255, 255, 255],
scale: [0.7, 0.7],
outline: true
})
}
});

View File

@@ -0,0 +1,31 @@
var keyBound = false;
var interiorId = -1;
var enterExit = undefined;
mp.events.add('InteriorManager_ClearHelpText', () => {
mp.game.ui.clearHelp(true);
enterExit = undefined;
if (keyBound) {
mp.keys.unbind(0x45, false, keyPressHandler);
keyBound = false;
}
});
mp.events.add('InteriorManager_ShowHelpText', (interior, intId, entEx) => {
mp.game.ui.setTextComponentFormat('STRING');
mp.game.ui.addTextComponentSubstringPlayerName('Drücke ~INPUT_CONTEXT~, um ~b~' + interior + ' ~s~zu ' + (entEx === 0 ? 'betreten' : 'verlassen'));
mp.game.ui.displayHelpTextFromStringLabel(0, true, true, -1);
interiorId = intId;
enterExit = entEx;
mp.keys.bind(0x45, false, keyPressHandler);
keyBound = true;
});
function keyPressHandler() {
if (globalData.InChat) return;
mp.events.callRemote('InteriorManager_UseTeleport', interiorId, enterExit);
}

View File

@@ -0,0 +1,57 @@
const maxDistance = 25 * 25;
const width = 0.03;
const height = 0.0065;
const border = 0.001;
const color = [255, 255, 255, 255];
mp.nametags.enabled = false;
mp.events.add('render', (nametags) => {
const graphics = mp.game.graphics;
const screenRes = graphics.getScreenResolution(0, 0);
nametags.forEach(nametag => {
let [player, x, y, distance] = nametag;
if (distance <= maxDistance) {
let scale = distance / maxDistance;
if (scale < 0.6) scale = 0.6;
var health = player.getHealth();
health = health < 100 ? 0 : (health - 100) / 100;
var armour = player.getArmour() / 100;
y -= scale * (0.005 * (screenRes.y / 1080));
mp.game.graphics.drawText(player.name + " (" + player.remoteId + ")", [x, y],
{
font: 4,
color: [255, 255, 255, 255],
scale: [0.4, 0.4],
outline: true
});
if (mp.game.player.isFreeAimingAtEntity(player.handle)) {
let y2 = y + 0.042;
if (armour > 0) {
graphics.drawRect(x, y2, width + border * 2, 0.0085, 0, 0, 0, 200);
graphics.drawRect(x, y2, width, height, 150, 150, 150, 255);
graphics.drawRect(x - width / 2 * (1 - health), y2, width * health, height, 255, 255, 255, 200);
x2 = x + width / 2 + border / 2;
graphics.drawRect(x, y2 + height, width + border * 2, height + border * 2, 0, 0, 0, 200);
graphics.drawRect(x, y2 + height, width, height, 41, 66, 78, 255);
graphics.drawRect(x - width / 2 * (1 - armour), y2 + height, width * armour, height, 48, 108, 135, 200);
}
else {
graphics.drawRect(x, y2, width + border * 2, height + border * 2, 0, 0, 0, 200);
graphics.drawRect(x, y2, width, height, 150, 150, 150, 255);
graphics.drawRect(x - width / 2 * (1 - health), y2, width * health, height, 255, 255, 255, 200);
}
}
}
});
});

View File

@@ -0,0 +1,40 @@
<!--
* @overview Life of German Reallife - Client Gui playerlist.html
* @author VegaZ
* @copyright (c) 2008 - 2018 Life of German
*-->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="style.css" />
<script src="playerlist.js"></script>
</head>
<body>
<div class="playerlist">
<div id="testDiv"></div>
<table>
<thead>
<tr>
<th><center>ID</center></th>
<th>Name</th>
<th><center>Ping</center></th>
</tr>
</thead>
<tbody id="playerData"></tbody>
</table>
</div>
<script src="jquery-3.3.1.min.js"></script>
<script>
$(document).ready(function () {
//var table;
for (var player in pList) {
$("#playerData").append("<tr><td>" + player.Id + "</td><td>" + player.Name + "</td><td>" + player.Ping + "</td></tr>");
//table =+ tableRow;
}
//document.getElementById("testDiv").innerHTML = table;
});
</script>
</body>
</html>

View File

@@ -0,0 +1,35 @@
/**
* @overview Life of German Reallife - Gui Playerlist playerlist.js
* @author VegaZ
* @copyright (c) 2008 - 2018 Life of German
*/
var playerlistBrowser
var pList;
mp.events.add("showPlayerlist", () => {
if (!playerlistBrowser) {
playerlistBrowser = mp.browsers.new('package://Gui/playerlist.html');
mp.gui.chat.activate(false);
mp.gui.cursor.show(true, true);
}
});
mp.events.add("fetchPlayerList", (playersJson) => {
pList = JSON.parse(playersJson);
pList.forEach((player) => {
mp.gui.chat.push(player.Id + ", " + player.Name + ", " + player.Ping);
});
});
//function getTable() {
// var table = "";
// pList.forEach((player) => {
// var tableRow = "<tr><td>" + player.Id + "</td><td>" + player.Name + "</td><td>" + player.Ping + "</td>";
// table = table + tableRow;
// })
// return document.write(table);
//}

View File

@@ -0,0 +1,8 @@
$(document).ready(function () {
mp.trig
for (var player in pList) {
$("#playerData").append("<tr><td>" + player.Id + "</td><td>" + player.Name + "</td><td>" + player.Ping + "</td></tr>");
}
});

View File

@@ -0,0 +1,38 @@
/**
* @overview Life of German Reallife - Save CSS style.css
* @author Orangebox, hydrant, VegaZ
* @copyright (c) 2008 - 2018 Life of German
*/
.playerlist {
background-color: rgba(61, 68, 87, 0.50);
position: absolute;
top: 50%;
left: 50%;
margin-right: -50%;
transform: translate(-50%, -50%);
min-width: 60%;
text-align: center;
}
body {
font-family: "Roboto", sans-serif;
-webkit-font-smoothing: antialiased;
overflow: hidden;
}
td {
align-content: stretch;
padding-left: 10px;
padding-right: 10px;
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2), 0 0 0 0 rgba(0, 0, 0, 0.24);
border-top: 2px double gray;
border-bottom: 2px double gray;
border-width: 0.5px;
width: auto;
}
table {
margin: auto;
align-self:center;
width: 100%;
}

View File

@@ -0,0 +1,103 @@
let menuBrowser = null;
const NativeUI = require('nativeui');
const Menu = NativeUI.Menu;
const UIMenuItem = NativeUI.UIMenuItem;
const UIMenuListItem = NativeUI.UIMenuListItem;
const UIMenuCheckboxItem = NativeUI.UIMenuCheckboxItem;
const UIMenuSliderItem = NativeUI.UIMenuSliderItem;
const BadgeStyle = NativeUI.BadgeStyle;
const Point = NativeUI.Point;
const ItemsCollection = NativeUI.ItemsCollection;
const Color = NativeUI.Color;
const ListItem = NativeUI.ListItem;
mp.events.add('ToggleVehicleMenu', () => {
if (menuBrowser !== null) {
menuBrowser.destroy();
menuBrowser = null;
mp.gui.chat.show(true);
mp.gui.cursor.show(false, false);
mp.game.graphics.stopScreenEffect("FocusIn");
mp.game.graphics.startScreenEffect("FocusOut", 0, false);
return;
}
mp.game.graphics.stopScreenEffect("FocusOut");
mp.game.graphics.startScreenEffect("FocusIn", 0, false);
menuBrowser = mp.browsers.new("package://assets/html/vehiclemenu/index.html");
mp.gui.chat.show(false);
mp.gui.cursor.show(true, true);
});
mp.events.add('doAction', (action) => {
mp.events.call('ToggleVehicleMenu');
switch (action) {
case 8: // Motor
mp.events.callRemote("VehicleMenu_ToggleEngine");
break;
case 5: // Auf -/ Abschließen
mp.events.callRemote("VehicleMenu_LockCar");
break;
case 3: // Türen
showDoorsMenu();
break;
}
});
function showDoorsMenu() {
mp.gui.chat.show(false);
var doorMenu = new Menu("Türen", "Türen verwalten", new Point(50, 50));
doorMenu.AddItem(new UIMenuListItem("Tür", "Welche Tür darf's sein?", new ItemsCollection([
" Fahrertür",
" Beifahrertür",
"Hinten links",
"Hinten rechts",
"Motorhaube",
"Kofferraum"
])));
doorMenu.AddItem(new UIMenuItem("Alle öffnen", "Öffnet alle Türen"));
doorMenu.AddItem(new UIMenuItem("Alle schließen", "Schließt alle Türen"));
doorMenu.ItemSelect.on((item, index) => {
if (index === 0) {
var doorId = -1;
switch (item.SelectedItem.DisplayText) {
case " Fahrertür":
doorId = 0;
break;
case " Beifahrertür":
doorId = 1;
break;
case "Hinten links":
doorId = 2;
break;
case "Hinten rechts":
doorId = 3;
break;
case "Motorhaube":
doorId = 4;
break;
case "Kofferraum":
doorId = 5;
break;
}
if (doorId !== -1) {
mp.events.callRemote("VehicleMenu_ToggleSingleDoor", doorId);
}
} else if (index === 1) {
mp.events.callRemote("VehicleMenu_OpenAllDoors");
} else if (index === 2) {
mp.events.callRemote("VehicleMenu_CloseAllDoors");
}
});
doorMenu.MenuClose.on(() => {
mp.gui.chat.show(true);
});
doorMenu.Open();
}

View File

@@ -0,0 +1,243 @@
var screenRes = mp.game.graphics.getScreenResolution(0, 0);
var player = mp.players.local;
var tasks;
var initTasks;
var newTasks;
var sorting = 0;
var activeTask = false;
var activeCheckpoint;
var taskStart;
var taskFinish;
var taskRange;
var ambulanceImagePos;
var rangeLeft;
var sortText = "Nach Uhrzeit"
const NativeUI = require("nativeui");
const Menu = NativeUI.Menu;
const UIMenuItem = NativeUI.UIMenuItem;
const UIMenuListItem = NativeUI.UIMenuListItem;
const UIMenuCheckboxItem = NativeUI.UIMenuCheckboxItem;
const BadgeStyle = NativeUI.BadgeStyle;
const Point = NativeUI.Point;
const ItemsCollection = NativeUI.ItemsCollection;
const Color = NativeUI.Color;
var factionInteractionMenu;
var reviveTaskMenu;
mp.events.add("updateFactionBlips", (type, taskList) => {
});
mp.events.add("showFactionInteraction", (userFactionId, userFactionName, isFactionLeader, reviveTaskCount, healTaskCount, fireTaskCount) => {
mp.gui.chat.activate(false);
globalData.Interaction = true;
var rP = ((reviveTaskCount === "0") ? "~r~" : "~g~");
var hP = ((healTaskCount === "0") ? "~r~" : "~g~");
var fP = ((fireTaskCount === "0") ? "~r~" : "~g~");
factionInteractionMenu = new Menu("Fraktionsinteraktion", userFactionName, new Point(0, screenRes.y / 2));
if (isFactionLeader) {
let leaderMenu = new UIMenuItem("Leadermen\u00fc", "Verwaltung der Fraktion");
leaderMenu.SetRightBadge(BadgeStyle.Star);
factionInteractionMenu.AddItem(leaderMenu);
}
let reviveTaskMenu;
let healTaskMenu;
let fireTaskMenu;
switch (userFactionId) {
case 2:
reviveTaskMenu = new UIMenuItem("Reviveauftr\u00e4ge");
reviveTaskMenu.SetRightLabel(rP + reviveTaskCount)
factionInteractionMenu.AddItem(reviveTaskMenu);
healTaskMenu = new UIMenuItem("Healauftr\u00e4ge");
healTaskMenu.SetRightLabel(hP + healTaskCount)
factionInteractionMenu.AddItem(healTaskMenu);
fireTaskMenu = new UIMenuItem("Feuerauftr\u00e4ge");
fireTaskMenu.SetRightLabel(fP + fireTaskCount)
factionInteractionMenu.AddItem(fireTaskMenu);
break;
}
let cancelItem = new UIMenuItem("Schlie\u00dfen", "Schlie\u00dft die Fraktionsinteraktion");
cancelItem.BackColor = new Color(213, 0, 0);
cancelItem.HighlightedBackColor = new Color(229, 57, 53);
factionInteractionMenu.AddItem(cancelItem);
factionInteractionMenu.Visible = true;
factionInteractionMenu.ItemSelect.on((item) => {
switch (item) {
case cancelItem:
factionInteractionMenu.Visible = false;
mp.gui.chat.activate(true);
globalData.Interaction = false;
break;
case reviveTaskMenu:
mp.events.callRemote("loadMedicTasks", 0)
factionInteractionMenu.Visible = false;
mp.gui.chat.activate(true);
globalData.Interaction = false;
break;
}
});
factionInteractionMenu.MenuClose.on(() => {
mp.gui.chat.activate(true);
globalData.Interaction = false;
});
});
mp.events.add("showMedicTasks", (type, taskList) => {
tasks = JSON.parse(taskList);
if (sorting === 0) {
initTasks = tasks;
}
mp.gui.chat.activate(false);
globalData.Interaction = true;
switch (type) {
case 0:
reviveTaskMenu = new Menu("Revives", "Sortierung: ~g~" + sortText + " ~y~[NUM 5]", new Point(0, screenRes.y / 2));
let aTask;
for (var i = 0; i < tasks.length; i++) {
if (tasks[i].MedicName === "none") {
aTask = new UIMenuItem("~g~" + tasks[i].Victim);
} else {
aTask = new UIMenuItem("~r~" + tasks[i].Victim);
}
aTask.SetRightLabel(mp.game.gameplay.getDistanceBetweenCoords(player.position.x, player.position.y, player.position.z, tasks[i].Position.x, tasks[i].Position.y, tasks[i].Position.z, true).toFixed(2).toString() + " ~g~m");
reviveTaskMenu.AddItem(aTask);
}
let backItem = new UIMenuItem("Zur\u00fcck", "Zur\u00fcck zur Fraktionsinteraktion");
backItem.BackColor = new Color(213, 0, 0);
backItem.HighlightedBackColor = new Color(229, 57, 53);
reviveTaskMenu.AddItem(backItem);
reviveTaskMenu.ItemSelect.on((item, index) => {
if (item === backItem) {
reviveTaskMenu.Visible = false;
factionInteractionMenu.Visible = true;
} else {
if (tasks[index].MedicName === "none") {
mp.game.graphics.requestStreamedTextureDict("medicimages", true);
mp.events.callRemote("updateMedicTask", 0, index, player.name);
mp.game.ui.setNewWaypoint(tasks[index].Position.x, tasks[index].Position.y);
activeCheckpoint = mp.markers.new(1, new mp.Vector3(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 2), 3.0, {
color: [255, 0, 0, 150],
visible: true,
dimension: 0
});
reviveTaskMenu.Visible = false;
mp.gui.chat.activate(true);
globalData.Interaction = false;
ambulanceImagePos = 0.325
taskStart = player.position;
taskFinish = tasks[index].Position;
taskRange = mp.game.gameplay.getDistanceBetweenCoords(player.position.x, player.position.y, player.position.z, tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z, true);
activeTask = true;
}
}
});
reviveTaskMenu.MenuClose.on(() => {
reviveTaskMenu.Visible = false;
factionInteractionMenu.Visible = true;
});
break;
case 1:
break;
case 2:
break;
}
});
mp.events.add("sortFactionTasks", () => {
newTasks = tasks;
if (sorting < 4) {
sorting++;
} else {
sorting = 0;
}
switch (sorting) {
case 0: //Standartsortierung
reviveTaskMenu.Close();
factionInteractionMenu.Close();
mp.events.call("showMedicTasks", 0, JSON.stringify(initTasks));
sortText = "Nach Uhrzeit";
break;
case 1: //Sortierung nach Metern (aufsteigend)
for (var d = 0; d < newTasks.length; d++) {
for (var e = 0; e < newTasks.length - 1; e++) {
if (getDistance1(e) > getDistance2(e + 1)) {
var tempTask = newTasks[e];
newTasks[e] = newTasks[e + 1];
newTasks[e + 1] = tempTask;
mp.gui.chat.push("SWITCH");
}
}
}
sortText = "Entfernung aufsteigend";
reviveTaskMenu.Close();
factionInteractionMenu.Close();
mp.events.call("showMedicTasks", 0, JSON.stringify(newTasks));
break;
//case 2: //Sortierung nach Metern (absteigend)
// mp.gui.chat.push("Sorting 2");
// sortText = "Entfernung absteigend";
// break;
//case 3: //Sortierung nach Zeit (aufsteigend)
// mp.gui.chat.push("Sorting 3");
// sortText = "Restzeit aufsteigend";
// break;
//case 4: //Sortierung nach Zeit (absteigend)
// mp.gui.chat.push("Sorting 4");
// sortText = "Restzeit absteigend";
// break;
}
});
function getDistance1(index) {
return mp.game.gameplay.getDistanceBetweenCoords(player.position.x, player.position.y, player.position.z, newTasks[index].Position.x, newTasks[index].Position.y, newTasks[index].Position.z, true).toFixed(2);
}
function getDistance2(index) {
return mp.game.gameplay.getDistanceBetweenCoords(player.position.x, player.position.y, player.position.z, newTasks[index].Position.x, newTasks[index].Position.y, newTasks[index].Position.z, true).toFixed(2);
}
mp.events.add('render', () => {
if (activeTask) {
rangeLeft = mp.game.gameplay.getDistanceBetweenCoords(player.position.x, player.position.y, player.position.z, taskFinish.x, taskFinish.y, taskFinish.z, true).toFixed(2);
if (rangeLeft > 1.9) {
ambulanceImagePos = 0.655 - (mp.game.gameplay.getDistanceBetweenCoords(player.position.x, player.position.y, player.position.z, taskFinish.x, taskFinish.y, taskFinish.z, true) / taskRange * 0.35);
mp.game.graphics.drawRect(0.5, 0.945, 0.35, 0.025, 150, 0, 0, 200);
mp.game.graphics.drawText(rangeLeft.toString() + "m", [0.5, 0.93], {
font: 0,
color: [255, 255, 255, 255],
scale: [0.35, 0.35],
outline: true,
centre: true
});
mp.game.graphics.drawSprite("medicimages", "finish", 0.655, 0.898, 0.04, 0.07, 0, 255, 255, 255, 255);
if (player.isInAnyVehicle(false)) {
mp.game.graphics.drawSprite("medicimages", "ambulance", ambulanceImagePos + 0.01, 0.915, 0.04, 0.07, 0, 255, 255, 255, 255);
} else {
mp.game.graphics.drawSprite("medicimages", "running", ambulanceImagePos + 0.02, 0.915, 0.02, 0.035, 0, 255, 0, 0, 255);
}
} else {
activeTask = false;
activeCheckpoint.destroy();
}
}
});

View File

@@ -0,0 +1,271 @@
var nearbyPlayers = [];
let screenRes = mp.game.graphics.getScreenResolution(0, 0);
var tradeRequest;
var tradeRequester;
var timerBarSize = 0.5;
var tradeTimeLeft;
var tradeSelection = "none";
var tradeSelectHover = "none";
var acceptColor = 100;
var declineColor = 100;
const { x: screenX, y: screenY } = mp.game.graphics.getScreenActiveResolution(0, 0);
let rxC = 0.5;
let ryC = 0.4;
let rWidth = 0.4;
let sX = (screenX * 0.1 / 1000);
let sY = (screenY * 0.1 / 1000);
let eX = sX - 0.1;
let eY = sY - 0.1;
let sizeMul = 0.08;
let yMul = 1.8;
var receivedTradePrize;
var receivedTradeItems = [[]];
var receivedTradeGrid = [];
receivedTradeGrid[0] = [0.3375, 0.5]
receivedTradeGrid[1] = [0.4195, 0.5]
receivedTradeGrid[2] = [0.5015, 0.5]
receivedTradeGrid[3] = [0.5835, 0.5]
receivedTradeGrid[4] = [0.6655, 0.5]
const NativeUI = require("nativeui");
const Menu = NativeUI.Menu;
const UIMenuItem = NativeUI.UIMenuItem;
const UIMenuListItem = NativeUI.UIMenuListItem;
const UIMenuCheckboxItem = NativeUI.UIMenuCheckboxItem;
const BadgeStyle = NativeUI.BadgeStyle;
const Point = NativeUI.Point;
const ItemsCollection = NativeUI.ItemsCollection;
const Color = NativeUI.Color;
mp.events.add("showPlayerInteraction", (nearPlayerArr) => {
mp.gui.chat.activate(false);
nearbyPlayers = JSON.parse(nearPlayerArr);
globalData.Interaction = true;
let playerInteractionMenu = new Menu("Spielerinteraktion", "", new Point(0, screenRes.y / 2));
let playerSelect = new UIMenuListItem("Mit", "~y~W\u00e4hle den Spieler aus.", new ItemsCollection(nearbyPlayers));
playerInteractionMenu.AddItem(playerSelect);
playerInteractionMenu.AddItem(new UIMenuItem("Handeln", "Sende dem Spieler eine Handlungsanfrage"));
let cancelItem = new UIMenuItem("Schlie\u00dfen", "Schlie\u00dft die Spielerinteraktion");
cancelItem.BackColor = new Color(213, 0, 0);
cancelItem.HighlightedBackColor = new Color(229, 57, 53);
playerInteractionMenu.AddItem(cancelItem);
playerInteractionMenu.Visible = true;
playerInteractionMenu.ItemSelect.on((item) => {
if (item.Text === "Handeln") {
mp.events.callRemote("openTradeInventory", playerSelect.SelectedValue);
playerInteractionMenu.Visible = false;
mp.gui.chat.activate(true);
globalData.Interaction = false;
} else if (item.Text === "Schlie\u00dfen") {
playerInteractionMenu.Visible = false;
mp.gui.chat.activate(true);
globalData.Interaction = false;
}
});
playerInteractionMenu.MenuClose.on(() => {
mp.gui.chat.activate(true);
globalData.Interaction = false;
});
});
mp.events.add("showTradeRequest", (tradeRequesterName, tradeItemsArr, tradePrizeSent) => {
receivedTradeItems = tradeItemsArr;
receivedTradePrize = tradePrizeSent;
mp.gui.cursor.show(true, true);
tradeRequester = tradeRequesterName;
tradeRequest = true;
tradeTime = new Date().getTime();
tradeTimeEnd = tradeTime + 30000;
});
mp.events.add("render", () => {
if (tradeRequest) {
var pos = mp.gui.cursor.position;
var actualTime = new Date().getTime();
tradeTimeLeft = (tradeTimeEnd - actualTime) / 1000;
mp.game.graphics.set2dLayer(1);
mp.game.graphics.drawRect(0.5, 0.5, 0.5, 0.3, 255, 255, 255, 200);
mp.game.graphics.drawText("Handelsanfrage von ~y~" + tradeRequester + " ~s~ für ~g~" + receivedTradePrize + "$", [0.5, 0.5 - 0.13], {
font: 7,
color: [112, 128, 144, 254],
scale: [0.7, 0.7],
outline: true,
});
mp.game.graphics.set2dLayer(2);
for (var slots = 0; slots < receivedTradeGrid.length; slots++) {
mp.game.graphics.drawRect(receivedTradeGrid[slots][0], receivedTradeGrid[slots][1], sizeMul, sizeMul * yMul, 112, 128, 144, 254);
mp.game.graphics.drawText(tempSlot2 = slots + 1, [receivedTradeGrid[slots][0] - (sizeMul / 2) + 0.006, receivedTradeGrid[slots][1] - (sizeMul / 2 * yMul)], {
font: 7,
color: [69, 255, 0, 254],
scale: [0.3, 0.3],
outline: true,
});
}
mp.game.graphics.set2dLayer(3);
//SPRITES + ITEMANZAHL
if (receivedTradeItems.length !== 0) {
for (var currentItem = 0; currentItem < receivedTradeItems.length; currentItem++) {
if (receivedTradeItems[currentItem][4] !== "-1") {
mp.game.graphics.drawSprite("itemimages", receivedTradeItems[currentItem][0].toLowerCase(), receivedTradeGrid[parseInt(receivedTradeItems[currentItem][4] - 1)][0], receivedTradeGrid[parseInt(receivedTradeItems[currentItem][4] - 1)][1], rWidth / 8, rWidth / 5, 0, 255, 255, 255, 255);
mp.game.graphics.drawText("(~y~" + receivedTradeItems[currentItem][3] + "~s~)", [receivedTradeGrid[parseInt(receivedTradeItems[currentItem][4] - 1)][0] + (sizeMul / 2) - 0.008, receivedTradeGrid[parseInt(receivedTradeItems[currentItem][4] - 1)][1] + 0.05], {
font: 0,
color: [255, 255, 255, 255],
scale: [0.25, 0.25],
outline: true,
});
}
}
}
mp.game.graphics.set2dLayer(4);
isMouseOverButton(pos[0], pos[1]);
mp.game.graphics.drawRect(0.5 - 0.07, 0.5 + 0.1, 0.06, 0.04, 100, acceptColor, 100, 250);
mp.game.graphics.drawRect(0.5 + 0.07, 0.5 + 0.1, 0.06, 0.04, declineColor, 100, 100, 250);
mp.game.graphics.set2dLayer(5);
mp.game.graphics.drawText("~g~Annehmen", [0.5 - 0.07, 0.5 + 0.08], {
font: 4,
color: [112, 128, 144, 254],
scale: [0.6, 0.6],
outline: true,
});
mp.game.graphics.drawText("~r~Ablehnen", [0.5 + 0.07, 0.5 + 0.08], {
font: 4,
color: [112, 128, 144, 254],
scale: [0.6, 0.6],
outline: true,
});
mp.game.graphics.set2dLayer(6);
if (isMouseOverTradeItem(pos[0], pos[1])) {
mp.game.graphics.drawRect(pos[0] / screenX, pos[1] / screenY + 0.055, 0.14, 0.08, 0, 0, 0, 220);
var hoverItemP = [receivedTradeItems[hoverItem][0], receivedTradeItems[hoverItem][1], receivedTradeItems[hoverItem][2], receivedTradeItems[hoverItem][3]];
//NAME
mp.game.graphics.drawText("~g~" + hoverItemP[0], [pos[0] / screenX, pos[1] / screenY + 0.02], {
font: 4,
color: [255, 255, 255, 255],
scale: [0.4, 0.4],
outline: true,
});
//BESCHREIBUNG
mp.game.graphics.drawText(hoverItemP[1], [pos[0] / screenX, pos[1] / screenY + 0.04], {
font: 4,
color: [255, 255, 255, 255],
scale: [0.35, 0.35],
outline: true,
});
//EINZELGEWICHT
mp.game.graphics.drawText("~y~" + hoverItemP[2] + "g~s~ * " + hoverItemP[3] + "~s~ = ~y~" + hoverItemP[2] * hoverItemP[3] + "g", [pos[0] / screenX, pos[1] / screenY + 0.06], {
font: 4,
color: [255, 255, 255, 255],
scale: [0.35, 0.35],
outline: true,
});
}
mp.game.graphics.set2dLayer(7);
timerBarSize = tradeTimeLeft / 30 * 0.5;
if (tradeTimeLeft > 0) {
mp.game.graphics.drawText(tradeTimeLeft.toFixed(0), [0.5, 0.5 + 0.1312], {
font: 7,
color: [255, 255, 255, 255],
scale: [0.35, 0.35],
outline: true,
});
mp.game.graphics.drawRect(0.5, 0.5 + 0.1412, timerBarSize, 0.018, 255, 0, 0, 250);
} else {
tradeSelection = "timeup";
mp.events.callRemote('tradeDecision', tradeSelection, JSON.stringify(receivedTradeItems), tradeRequester);
tradeRequest = false;
mp.gui.cursor.show(false, false);
}
}
});
function isMouseOverButton(cX, cY) {
if (tradeRequest) {
var x = cX / screenX;
var y = cY / screenY;
if (x > 0.5 - 0.07 - 0.03 && x < 0.5 - 0.07 + 0.03 && y > 0.5 + 0.1 - 0.02 && y < 0.5 + 0.1 + 0.02) {
acceptColor = 255;
tradeSelectHover = "accept";
return true;
} else if (x > 0.5 + 0.07 - 0.03 && x < 0.5 + 0.07 + 0.03 && y > 0.5 + 0.1 - 0.02 && y < 0.5 + 0.1 + 0.02) {
declineColor = 255;
tradeSelectHover = "decline";
return true;
} else {
acceptColor = 100;
declineColor = 100;
return false;
}
}
}
function isMouseOverTradeItem(cX, cY) {
if (tradeRequest) {
var x = cX / screenX;
var y = cY / screenY;
var a;
var b;
var c;
for (var s = 0; s < 5; s++) {
a = receivedTradeGrid[s][0] - x;
b = receivedTradeGrid[s][1] - y;
c = Math.sqrt(a * a + b * b);
var invSlot = (s + 1);
if (c < sizeMul / 2) {
for (i = 0; i < receivedTradeItems.length; i++) {
if (parseInt(receivedTradeItems[i][4]) === invSlot) {
hoverItem = i;
return true;
}
}
}
}
}
}
mp.events.add('click', (x, y, upOrDown, leftOrRight, relativeX, relativeY, worldPosition, hitEntity) => {
var cX = x / screenX;
var cY = y / screenY;
if (tradeRequest) {
//LINKE MAUSTASTE
//RUNTER
if (upOrDown === "down" && leftOrRight === "left") {
if (isMouseOverButton(x, y)) {
if (tradeSelectHover === "accept") {
tradeSelection = "accept";
} else if (tradeSelectHover === "decline") {
tradeSelection = "decline";
}
mp.events.callRemote('tradeDecision', tradeSelection, JSON.stringify(receivedTradeItems), tradeRequester);
tradeRequest = false;
mp.gui.cursor.show(false, false);
}
}
}
});

View File

@@ -0,0 +1,86 @@
/**
* @overview Life of German Reallife - Login Main main.js
* @author VegaZ, hydrant
* @copyright (c) 2008 - 2018 Life of German
*/
var loginBrowser;
var loginCam = mp.cameras.new('login', new mp.Vector3(-1883.736, -781.4911, 78.27616), new mp.Vector3(3.185999, 0, -79.59519), 40);
mp.events.callRemote('IsPlayerBanned');
mp.events.add('loginInformationToServer', (password) => {
mp.events.callRemote('OnPlayerLogin', password);
});
mp.events.add('registerInformationToServer', (password) => {
mp.events.callRemote('OnPlayerRegister', password);
});
mp.events.add('registerSuccess', () => {
if (loginBrowser)
{
loginBrowser.destroy();
}
mp.gui.cursor.show(false, false);
mp.gui.chat.activate(true);
loginCam.setActive(false);
mp.game.cam.renderScriptCams(false, false, 0, true, false);
mp.game.ui.displayRadar(true);
mp.game.ui.displayHud(true);
});
mp.events.add('loginSuccess', () => {
mp.gui.chat.push("Erfolgreich eingeloggt!");
if (loginBrowser)
{
loginBrowser.destroy();
loginBrowser = undefined;
}
mp.gui.cursor.show(false, false);
mp.gui.chat.activate(true);
loginCam.setActive(false);
mp.game.cam.renderScriptCams(false, false, 0, true, false);
mp.game.ui.displayRadar(true);
mp.game.ui.displayHud(true);
});
mp.events.add('loginFail', (reason) => {
showCefError(reason);
});
mp.events.add('loginDeny', (reason) => {
mp.gui.cursor.show(false, false);
mp.gui.chat.activate(true);
showCefError(reason.toString());
});
mp.events.add('registerFail', (reason) => {
showCefError(reason);
});
mp.events.add('showLogin', () => {
loginBrowser = mp.browsers.new('package://assets/html/login/index.html');
mp.gui.chat.activate(false);
mp.gui.cursor.show(true, true);
mp.game.ui.displayHud(false);
mp.game.ui.displayRadar(false);
loginCam.setActive(true);
mp.game.cam.renderScriptCams(true, false, 0, true, false);
});
mp.events.add('disableLogin', () => {
if (loginBrowser) {
loginBrowser.destroy();
}
mp.gui.cursor.show(false, false);
mp.gui.chat.activate(true);
});
function showCefError(error) {
loginBrowser.execute(`showError('${error}')`);
}

View File

@@ -0,0 +1,108 @@
/**
* @overview Life of German Reallife - Player DutyClothes dutyclothes.js
* @author VegaZ
* @copyright (c) 2008 - 2018 Life of German
*/
const NativeUI = require("nativeui");
const Menu = NativeUI.Menu;
const UIMenuItem = NativeUI.UIMenuItem;
const UIMenuListItem = NativeUI.UIMenuListItem;
const UIMenuCheckboxItem = NativeUI.UIMenuCheckboxItem;
const BadgeStyle = NativeUI.BadgeStyle;
const Point = NativeUI.Point;
const ItemsCollection = NativeUI.ItemsCollection;
const Color = NativeUI.Color;
var hats;
var tops;
var legs;
var shoes;
var hat = -1;
var top;
var leg;
var shoe;
let screenRes = mp.game.graphics.getScreenResolution(0, 0);
var dutyMenu;
let saveItem = new UIMenuItem("Speichern", "Speichert deine Dienstkleidung");
saveItem.BackColor = new Color(13, 71, 161);
saveItem.HighlightedBackColor = new Color(25, 118, 210);
let cancelItem = new UIMenuItem("Abbrechen", "");
cancelItem.BackColor = new Color(213, 0, 0);
cancelItem.HighlightedBackColor = new Color(229, 57, 53);
//Cloth Menu
mp.events.add('showDutyClothMenu', (hatsArr, topsArr, legsArr, shoesArr) => {
mp.gui.chat.activate(false);
hats = hatsArr;
tops = topsArr;
legs = legsArr;
shoes = shoesArr;
dutyMenu = new Menu("Dienstkleidung", "Stelle deine Dienstkleidung zusammen", new Point(0, screenRes.y/2));
dutyMenu.AddItem(new UIMenuListItem("Hut", "", new ItemsCollection(hats)));
dutyMenu.AddItem(new UIMenuListItem("Top", "", new ItemsCollection(tops)));
dutyMenu.AddItem(new UIMenuListItem("Hose", "", new ItemsCollection(legs)));
dutyMenu.AddItem(new UIMenuListItem("Schuhe", "", new ItemsCollection(shoes)));
dutyMenu.AddItem(saveItem);
dutyMenu.AddItem(cancelItem);
dutyMenu.Visible = true;
dutyMenu.ListChange.on((item, index) => {
switch (item.Text) {
case "Hut":
if (item.SelectedItem.DisplayText === "Keinen") {
hat = -1;
mp.events.callRemote("updateDutyProp", 0, -1);
} else {
hat = parseInt(item.SelectedItem.DisplayText);
mp.events.callRemote("updateDutyProp", 0, hat);
}
break;
case "Top":
top = parseInt(item.SelectedItem.DisplayText);
mp.events.callRemote("updateDutyCloth", 11, top);
break;
case "Hose":
leg = parseInt(item.SelectedItem.DisplayText);
mp.events.callRemote("updateDutyCloth", 4, leg);
break;
case "Schuhe":
shoe = parseInt(item.SelectedItem.DisplayText);
mp.events.callRemote("updateDutyCloth", 6, shoe);
break;
}
});
dutyMenu.ItemSelect.on((item) => {
if (item.Text === "Speichern") {
var slotType = [1, 0, 0, 0];
var slotId = [0, 11, 4, 6];
var clothId = [hat, top, leg, shoe];
mp.events.callRemote("saveCharacterCloth", JSON.stringify(slotType), JSON.stringify(slotId), JSON.stringify(clothId));
dutyMenu.Visible = false;
mp.gui.chat.activate(true);
} else if (item.Text === "Abbrechen") {
dutyMenu.Visible = false;
mp.gui.chat.activate(true);
mp.events.callRemote("defaultCharacterCloth");
}
});
dutyMenu.MenuClose.on(() => {
dutyMenu.Visible = false;
mp.gui.chat.activate(true);
mp.events.callRemote("defaultCharacterCloth");
});
});

View File

@@ -0,0 +1,132 @@
const controlsIds = {
F5: 327,
W: 32, // 232
S: 33, // 31, 219, 233, 268, 269
A: 34, // 234
D: 35, // 30, 218, 235, 266, 267
Space: 321,
LCtrl: 326,
};
global.fly = {
flying: false, f: 2.0, w: 2.0, h: 2.0, point_distance: 1000,
};
global.gameplayCam = mp.cameras.new('gameplay');
mp.game.graphics.notify('~r~Fly script loaded!');
mp.game.graphics.notify('~r~F5~w~ - enable/disable\n~r~F5+Space~w~ - disable without warping to ground\n~r~W/A/S/D/Space/LCtrl~w~ - move');
mp.game.graphics.notify('~r~/savecam~w~ - save Camera position.');
let direction = null;
let coords = null;
function pointingAt(distance) {
const farAway = new mp.Vector3((direction.x * distance) + (coords.x), (direction.y * distance) + (coords.y), (direction.z * distance) + (coords.z));
const result = mp.raycasting.testPointToPoint(coords, farAway, [1, 16]);
if (result === undefined) {
return 'undefined';
}
return result;
}
mp.events.add('render', () => {
const controls = mp.game.controls;
const fly = global.fly;
direction = global.gameplayCam.getDirection();
coords = global.gameplayCam.getCoord();
coords.x = coords.x.toFixed(2);
coords.y = coords.y.toFixed(2);
coords.z = coords.z.toFixed(2);
direction.x = direction.x.toFixed(2);
direction.y = direction.y.toFixed(2);
direction.z = direction.z.toFixed(2);
mp.game.graphics.drawText(`Coords: ${JSON.stringify(coords)}`, [0.5, 0.005], {
font: 0,
color: [255, 255, 255, 185],
scale: [0.3, 0.3],
outline: true
});
mp.game.graphics.drawText(`pointAtCoord: ${JSON.stringify(pointingAt(fly.point_distance).position)}`, [0.5, 0.025], {
font: 0,
color: [255, 255, 255, 185],
scale: [0.3, 0.3],
outline: true
});
if (controls.isControlJustPressed(0, controlsIds.F5)) {
fly.flying = !fly.flying;
const player = mp.players.local;
player.setInvincible(fly.flying);
player.freezePosition(fly.flying);
player.setAlpha(fly.flying ? 0 : 255);
if (!fly.flying && !controls.isControlPressed(0, controlsIds.Space)) {
const position = mp.players.local.position;
position.z = mp.game.gameplay.getGroundZFor3dCoord(position.x, position.y, position.z, 0.0, false);
mp.players.local.setCoordsNoOffset(position.x, position.y, position.z, false, false, false);
}
mp.game.graphics.notify(fly.flying ? 'Fly: ~g~Enabled' : 'Fly: ~r~Disabled');
} else if (fly.flying) {
let updated = false;
const position = mp.players.local.position;
if (controls.isControlPressed(0, controlsIds.W)) {
if (fly.f < 8.0) { fly.f *= 1.025; }
position.x += direction.x * fly.f;
position.y += direction.y * fly.f;
position.z += direction.z * fly.f;
updated = true;
} else if (controls.isControlPressed(0, controlsIds.S)) {
if (fly.f < 8.0) { fly.f *= 1.025; }
position.x -= direction.x * fly.f;
position.y -= direction.y * fly.f;
position.z -= direction.z * fly.f;
updated = true;
} else {
fly.f = 2.0;
}
if (controls.isControlPressed(0, controlsIds.A)) {
if (fly.l < 8.0) { fly.l *= 1.025; }
position.x += (-direction.y) * fly.l;
position.y += direction.x * fly.l;
updated = true;
} else if (controls.isControlPressed(0, controlsIds.D)) {
if (fly.l < 8.0) { fly.l *= 1.05; }
position.x -= (-direction.y) * fly.l;
position.y -= direction.x * fly.l;
updated = true;
} else {
fly.l = 2.0;
}
if (controls.isControlPressed(0, controlsIds.Space)) {
if (fly.h < 8.0) { fly.h *= 1.025; }
position.z += fly.h;
updated = true;
} else if (controls.isControlPressed(0, controlsIds.LCtrl)) {
if (fly.h < 8.0) { fly.h *= 1.05; }
position.z -= fly.h;
updated = true;
} else {
fly.h = 2.0;
}
if (updated) {
mp.players.local.setCoordsNoOffset(position.x, position.y, position.z, false, false, false);
}
}
});

View File

@@ -0,0 +1,138 @@
/**
* @overview Life of German Reallife - Player Keys keys.js
* @author VegaZ
* @copyright (c) 2008 - 2018 Life of German
*/
//https://docs.microsoft.com/de-de/windows/desktop/inputdev/virtual-key-codes
var showInventory = false;
var showGui = true;
var showInv = false;
const player = mp.players.local;
//ENTER
mp.keys.bind(0x0D, false, function () {
if (globalData.InChat) {
globalData.InChat = false;
}
});
//LEFT ARROW (Interaktion mit anderen Spielern)
mp.keys.bind(0x25, false, function () {
if (!globalData.InChat && !showInv && !globalData.Interaction) {
mp.events.callRemote("keyPress:LEFT_ARROW");
}
});
//UP ARROW (Interaktion mit anderen Spielern)
mp.keys.bind(0x26, false, function () {
if (!globalData.InChat && !showInv && !globalData.Interaction) {
mp.events.callRemote("keyPress:UP_ARROW");
}
});
//RIGHT ARROW (Interaktion mit anderen Spielern)
mp.keys.bind(0x27, false, function () {
if (!globalData.InChat && !showInv && !globalData.Interaction) {
mp.events.callRemote("keyPress:RIGHT_ARROW");
}
});
//DOWN ARROW (Interaktion mit anderen Spielern)
mp.keys.bind(0x28, false, function () {
if (!globalData.InChat && !showInv && !globalData.Interaction) {
mp.events.callRemote("keyPress:DOWN_ARROW");
}
});
//F7 //Unshowalles
mp.keys.bind(0x76, false, function () {
if (showGui === true) {
showGui = false;
mp.events.call("toggleUi", false);
} else {
showGui = true;
mp.events.call("toggleUi", true);
}
});
//NUM2 //Save Blips in Edit Mode
mp.keys.bind(0x62, false, function () {
if (!globalData.InChat) {
mp.events.callRemote("keyPress:NUM2");
}
});
//NUM5 //Fraktionsinteraktion (Tasks sortieren)
mp.keys.bind(0x65, false, function () {
if (!globalData.InChat) {
mp.events.call("sortFactionTasks");
}
});
//E
mp.keys.bind(0x45, false, function () {
if (!globalData.InChat) {
mp.events.callRemote("keyPress:E");
}
});
//I //Inventar
mp.keys.bind(0x49, false, function () {
if (!globalData.InChat) {
if (showInv === false) {
showInv = true;
} else {
showInv = false;
}
mp.events.callRemote("keyPress:I");
}
});
//J //Spielerliste
mp.keys.bind(0x4A, false, function () {
if (!globalData.InChat) {
mp.events.callRemote("keyPress:J");
//mp.events.call("showPlayerlist");
}
});
//K //Dienstkleidung
mp.keys.bind(0x4B, false, function () {
if (!globalData.InChat) {
mp.events.callRemote("keyPress:K");
}
});
//L //Türen auf / zuschließen
mp.keys.bind(0x4C, false, function () {
if (!globalData.InChat) {
mp.events.callRemote("keyPress:L");
}
});
//N //Motor Starten
mp.keys.bind(0x4E, false, function () {
if (!globalData.InChat) {
if (!player.vehicle) return;
if (player.vehicle.getSpeed() > 5) return;
mp.events.callRemote("keyPress:N");
}
});
//T
mp.keys.bind(0x54, false, function () {
if (!globalData.InChat) {
globalData.InChat = true;
}
});
//X //Anschnallen
mp.keys.bind(0x58, false, function () {
if (!globalData.InChat) {
mp.events.callRemote("keyPress:X");
}
});

View File

@@ -0,0 +1,9 @@
/**
* @overview Life of German Reallife - Player Quit quit.js
* @author hydrant
* @copyright (c) 2008 - 2018 Life of German
*/
mp.events.add('playerQuit', (player, exitType, reason) => {
mp.game.ui.clearHelp(true);
});

View File

@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
<ApplicationIcon />
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Folder Include="cs_packages\" />
<Folder Include="Gui\vehiclemenu\web\css\" />
<Folder Include="Gui\vehiclemenu\web\font\" />
<Folder Include="Gui\vehiclemenu\web\img\" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(ConfigurationName)' != 'ServerBuild'">
<Exec Command="powershell.exe .\Scripts\moveItems.ps1" />
</Target>
</Project>

View File

@@ -0,0 +1,72 @@
<!--
* @overview Life of German Reallife - Client Save.html
* @author Orangebox, hydrant, VegaZ
* @copyright (c) 2008 - 2018 Life of German
*-->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="save-page" style="padding: 5% 0 0;">
<div class="form">
<div class="blip-form">
<p><b>Blip speichern, bitte fülle die Tabelle aus:</b></p>
<table>
<tr>
<td align="right"><b>Model ID:</b></td>
<td><input type="text" placeholder="[INT]-Wert" id="blipSprite" /></td>
</tr>
<tr>
<td align="right"><b>Name:</b></td>
<td><input type="text" placeholder="Wird angezeigt beim hovern" id="blipName" /></td>
</tr>
<tr>
<td align="right"><b>Skalierung:</b></td>
<td><input type="text" placeholder="[FLOAT]-Wert | Standard: 1" id="blipScale" /></td>
</tr>
<!--<tr>
<td align="right"><b>Farbe:</b></td>
<td>
<input class="colorPicker" type="color" id="blipColor" name="blipColor" value="#000000" />
</td>
</tr>-->
<tr>
<td align="right"><b>Farbe:</b></td>
<td><input type="text" placeholder="Siehe Wiki" id="blipColor" /></td>
</tr>
<tr>
<td align="right"><b>Transparenz:</b></td>
<td><input type="text" placeholder="(0-255)" id="blipAlpha" /></td>
</tr>
<tr>
<td align="right"><b>Draw Distance:</b></td>
<td><input type="text" placeholder="[FLOAT]-Wert" id="blipDrawDistance" /></td>
</tr>
<tr>
<td align="right"><b>Short Range:</b></td>
<td>
<input type="checkbox" id="blipShortRange" name="blipShortRange" value="shortRange" />Zeigt das Blip nur innerhalb der Minimap
</td>
</tr>
<tr>
<td align="right"><b>Rotation:</b></td>
<td><input type="text" placeholder="[FLOAT]-Wert" id="blipRotation" /></td>
</tr>
<tr>
<td align="right"><b>Dimension:</b></td>
<td><input type="text" placeholder="(0-255)" id="blipDimension" /></td>
</tr>
</table>
<button id="saveBtn" onclick="saveData()">Speichern</button><br /><br />
<button class="cancelBtn" onclick="cancelData()">Abbrechen</button>
</div>
</div>
</div>
<script src="package:///Dependencies/jquery-3.3.1.min.js"></script>
<script src="save.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -0,0 +1,23 @@
/**
* @overview Life of German Reallife - Login Login login.js
* @author VegaZ
* @copyright (c) 2008 - 2018 Life of German
*/
function saveData() {
let blipSprite = document.getElementById("blipSprite").value;
let blipName = document.getElementById("blipName").value;
let blipScale = document.getElementById("blipScale").value;
let blipColor = document.getElementById("blipColor").value;
let blipAlpha = document.getElementById("blipAlpha").value;
let blipDrawDistance = document.getElementById("blipSprite").value;
let blipShortRange = document.getElementById("blipShortRange").checked;
let blipRotation = document.getElementById("blipRotation").value;
let blipDimension = document.getElementById("blipDimension").value;
mp.trigger("saveBlipData", blipSprite, blipName, blipScale, blipColor, blipAlpha, blipDrawDistance, blipShortRange, blipRotation, blipDimension);
}
function cancelData() {
mp.trigger("cancelData");
}

View File

@@ -0,0 +1,184 @@
/**
* @overview Life of German Reallife - Save CSS style.css
* @author Orangebox, hydrant, VegaZ
* @copyright (c) 2008 - 2018 Life of German
*/
.save-page {
margin: auto;
}
.isa_info, .isa_success, .isa_warning, .isa_error {
margin: 10px 0px;
padding: 12px;
display: none;
}
.isa_info {
color: #00529B;
background-color: #BDE5F8;
}
.isa_success {
color: #4F8A10;
background-color: #DFF2BF;
}
.isa_warning {
color: #9F6000;
background-color: #FEEFB3;
}
.isa_error {
color: #D8000C;
background-color: #FFBABA;
}
.isa_info i, .isa_success i, .isa_warning i, .isa_error i {
margin: 10px 22px;
font-size: 2em;
vertical-align: middle;
}
.form {
margin-left: 36%;
position: absolute;
z-index: 1;
background: rgba(255, 255, 255, .85);
padding: 20px;
text-align: center;
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2), 0 5px 5px 0 rgba(0, 0, 0, 0.24);
}
input {
font-family: "Roboto", sans-serif;
outline: 0;
background: #f2f2f2;
width: 100%;
border: 0;
margin: 5px 0 5px 0;
padding: 12px;
box-sizing: border-box;
font-size: 12px;
}
input.colorPicker {
font-family: "Roboto", sans-serif;
outline: 0;
background: #f2f2f2;
width: 100%;
border: 0;
margin: 5px 0 5px 0;
padding: 0px;
box-sizing: border-box;
font-size: 12px;
}
input#blipShortRange {
margin: 10px 0 10px 0;
}
button {
font-family: "Roboto", sans-serif;
text-transform: uppercase;
outline: 0;
background: #31c474;
width: 40%;
border: 0;
padding: 15px;
color: #FFFFFF;
font-size: 14px;
-webkit-transition: all 0.3s ease;
transition: all 0.3s ease;
cursor: pointer;
}
button:hover, .form button:active, .form button:focus {
background: #31bd40;
}
.cancelBtn {
background-color: orangered;
}
.cancelBtn:hover, .cancelBtn:focus, .cancelBtn:active {
background-color: #ff0223 !important;
}
table {
align-self: center;
}
.message {
margin: 15px 0 0;
font-size: 12px;
}
.message a {
color: #0035A5;
text-decoration: none;
}
.register-form {
display: none;
}
.container {
position: relative;
z-index: 1;
max-width: 300px;
margin: 0 auto;
}
.container:before, .container:after {
content: "";
display: block;
clear: both;
}
.container .info {
margin: 50px auto;
text-align: center;
}
.info h1 {
margin: 0 0 15px;
padding: 0;
font-size: 36px;
font-weight: 300;
color: #1a1a1a;
}
.info span {
color: #4d4d4d;
font-size: 12px;
}
.info span a {
color: #000000;
text-decoration: none;
}
.info span .fa {
color: #EF3B3A;
}
body {
font-family: "Roboto", sans-serif;
-webkit-font-smoothing: antialiased;
overflow: hidden;
}
tr{
}
td {
align-content: stretch;
padding-left: 10px;
padding-right: 10px;
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2), 0 0 0 0 rgba(0, 0, 0, 0.24);
border-top: 2px double gray;
border-bottom: 2px double gray;
border-width: 0.5px;
}
table{
margin-bottom: 20px;
}

View File

@@ -0,0 +1,33 @@
/**
* @overview Life of German Reallife - Save Main main.js
* @author VegaZ
* @copyright (c) 2008 - 2018 Life of German
*/
var saveBrowser;
mp.events.add('saveBlip', () => {
saveBrowser = mp.browsers.new('package://Save/blip/save.html');
mp.gui.chat.activate(false);
mp.gui.cursor.show(true, true);
});
mp.events.add('saveBlipData', (blipSprite, blipName, blipScale, blipColor, blipAlpha, blipDrawDistance, blipShortRange, blipRotation, blipDimension) => {
if (saveBrowser) {
saveBrowser.destroy();
}
mp.events.callRemote('OnSaveBlipData', blipSprite, blipName, blipScale, blipColor, blipAlpha,
blipDrawDistance, blipShortRange, blipRotation, blipDimension);
mp.gui.chat.push(blipShortRange);
mp.gui.cursor.show(false, false);
mp.gui.chat.activate(true);
});
mp.events.add('cancelData', () => {
if (saveBrowser) {
saveBrowser.destroy();
}
mp.gui.cursor.show(false, false);
mp.gui.chat.activate(true);
});

View File

@@ -0,0 +1,12 @@
$rootPath = "$PSScriptRoot\.."
$tsConfig = "$rootPath\tsconfig.json"
$outputPath = "$rootPath\js_output"
if(Test-Path $outputPath)
{
Remove-Item -Path $outputPath -Recurse -Force | Out-Null
}
tsc -p $tsConfig

View File

@@ -0,0 +1,13 @@
$rootPath = "$PSScriptRoot\.."
$assetPath = "$rootPath\assets"
$csPackagesPath = "$rootPath\cs_packages"
$dlcPacksPath = "$rootPath\dlcpacks"
$clientResourcesPath = "$rootPath\..\..\client_packages"
Remove-Item -Path "$clientResourcesPath\*" -Recurse -Force
$exclude = @('*.ts', 'package.json', 'package-lock.json', 'tsconfig.json', '*.csproj', 'Scripts', 'node_modules', 'bin', 'obj')
Copy-Item "$rootPath\*" $clientResourcesPath -Recurse -Exclude $exclude

View File

@@ -0,0 +1,74 @@
let player = mp.players.local;
var dictLoaded = false;
var lockStatus = false;
mp.events.add('render', () =>
{
if (player.vehicle && player.vehicle.getPedInSeat(-1) === player.handle && !globalData.HideGui) // Check if player is in vehicle and is driver
{
if (!dictLoaded) {
mp.game.graphics.requestStreamedTextureDict("vehicleimages", true);
dictLoaded = true;
}
mp.game.graphics.drawRect(0.5, 0.995, 0.35, 0.05, 0, 0, 0, 170);
var { x, y } = mp.game.graphics.getScreenActiveResolution(0, 0);
var engineR = 255;
var engineG = 255;
var engineB = 255;
if (player.vehicle.getIsEngineRunning()) {
engineR = 104;
engineG = 212;
engineB = 42;
} else {
engineR = 188;
engineG = 25;
engineB = 25;
}
let speed = (player.vehicle.getSpeed() * 3.6).toFixed(0);
var lockSprite = "";
var lockR = 255;
var lockG = 255;
var lockB = 255;
if (lockStatus) {
lockR = 104;
lockG = 212;
lockB = 42;
lockSprite = "lockclosed";
} else {
lockSprite = "lockopen";
lockR = 188;
lockG = 25;
lockB = 25;
}
mp.game.graphics.drawSprite("vehicleimages", "engine", 0.343, 0.985, 0.015, 0.015 * (x / y), 0, engineR, engineG, engineB, 255);
mp.game.graphics.drawSprite("vehicleimages", lockSprite, 0.37, 0.985, 0.015, 0.015 * (x / y), 0, lockR, lockG, lockB, 255);
mp.game.graphics.drawText(speed.toString() + " KM/H", [0.41, 0.973], {
font: 0,
color: [255, 255, 255, 255],
scale: [0.35, 0.35],
outline: true,
centre: false
});
}
else {
if (dictLoaded) {
mp.game.graphics.setStreamedTextureDictAsNoLongerNeeded("vehicleimages");
dictLoaded = false;
}
}
});
mp.events.add("Vehicle_setLockStatus", (status) => {
lockStatus = status;
});

View File

@@ -0,0 +1,570 @@
/**
* @overview Life of German Reallife - Tuning tuning.js
* @author hydrant
* @copyright (c) 2008 - 2018 Life of German
*/
var keyBound = false;
var disableInput = [75, 278, 279, 280, 281, 23, 59, 60, 71, 72, 74];
var carModTypes = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 18, 22, 25, 27, 28, 33, 34, 35, 38, 39, 40, 41, 42, 43, 44, 46, 48, 69];
var carModSlotName = [
{ Slot: 0, Name: "Spoiler" },
{ Slot: 1, Name: "Frontstoßstange"},
{ Slot: 2, Name: "Heckstoßstange"},
{ Slot: 3, Name: "Seitenschweller"},
{ Slot: 4, Name: "Auspuff"},
{ Slot: 5, Name: "Rahmen"},
{ Slot: 6, Name: "Kühlergrill"},
{ Slot: 7, Name: "Motorhaube"},
{ Slot: 8, Name: "Kotflügel"},
{ Slot: 9, Name: "Rechter Kotflügel"},
{ Slot: 10, Name: "Dach"},
{ Slot: 11, Name: "Motor" },
{ Slot: 12, Name: "Bremsen"},
{ Slot: 13, Name: "Getriebe"},
{ Slot: 14, Name: "Hupe"},
{ Slot: 15, Name: "Federung"},
{ Slot: 18, Name: "Turbo"},
{ Slot: 22, Name: "Licht"},
{ Slot: 23, Name: "Reifen" },
{ Slot: 25, Name: "Nummernschildhalter" },
{ Slot: 27, Name: "Innenausstatung" },
{ Slot: 28, Name: "Wackelkopf" },
{ Slot: 33, Name: "Lenkrad" },
{ Slot: 34, Name: "Schalthebel" },
{ Slot: 35, Name: "Schild" },
{ Slot: 38, Name: "Hydraulik" },
{ Slot: 39, Name: "Motorabdeckung" },
{ Slot: 40, Name: "Luftfilter" },
{ Slot: 46, Name: "Fenster" },
{ Slot: 48, Name: "Design" }
];
var customPartNames = [
{
Model: 1093792632,
Names: [
{
Slot: 8,
Name: "Lüftungsschlitze"
},
{
Slot: 43,
Name: "Motorhaubenstifte"
}
]
},
{
Model: 223240013,
Names: [
{
Slot: 9,
Name: "Heckkotflügel"
}
]
},
{
Model: 1031562256,
Names: [
{
Slot: 5,
Name: "Stoßdämpfer"
}
]
},
{
Model: 3308022675,
Names: [
{
Slot: 9,
Name: "Kotflügel"
}
]
}
];
var doorOpeners = [
{
Model: 3308022675,
Doors: [
{
Slot: 5,
Door: 4
}
]
}
];
var bikeModTypes = [];
const NativeUI = require("nativeui");
const Menu = NativeUI.Menu;
const UIMenuItem = NativeUI.UIMenuItem;
const BadgeStyle = NativeUI.BadgeStyle;
const Point = NativeUI.Point;
var mainMenu;
var modMenu;
var closeMenu = false;
mp.events.add('showTuningInfo', () => {
mp.game.ui.setTextComponentFormat('STRING');
mp.game.ui.addTextComponentSubstringPlayerName('Drücke ~INPUT_CONTEXT~, um dein Fahrzeug zu modifizieren');
mp.game.ui.displayHelpTextFromStringLabel(0, true, true, -1);
mp.keys.bind(0x45, false, keyPressHandler);
keyBound = true;
});
mp.events.add('hideTuningInfo', (unbind) => {
mp.game.ui.clearHelp(true);
mp.gui.chat.show(true);
if (mp.players.local.vehicle) {
mp.players.local.vehicle.setLights(0);
}
if (typeof mainMenu !== "undefined" && unbind) {
mainMenu.Close();
globalData.InTuning = false;
}
if (typeof modMenu !== "undefined" && modMenu.Visible && unbind) {
closeMenu = true;
modMenu.Close();
globalData.InTuning = false;
}
if (keyBound && unbind) {
mp.keys.unbind(0x45, false, keyPressHandler);
keyBound = false;
}
});
function keyPressHandler() {
mp.events.callRemote("startPlayerTuning");
}
mp.events.add("render", () => {
if (globalData.InTuning) {
disableInput.forEach((input) => {
mp.game.controls.disableControlAction(1, input, true);
});
}
});
mp.events.add("showTuningMenu", () => {
mp.events.call("hideTuningInfo" , false);
mp.gui.chat.show(false);
var localPlayer = mp.players.local;
var localVehicle = localPlayer.vehicle;
localVehicle.setHalt(1.0, 1, false);
if (typeof mainMenu !== "undefined" && mainMenu.Visible) {
return;
}
if (typeof modMenu !== "undefined" && modMenu.Visible) {
return;
}
globalData.InTuning = true;
localVehicle.setLights(1);
var carName = mp.game.ui.getLabelText(mp.game.vehicle.getDisplayNameFromVehicleModel(localVehicle.model));
mainMenu = new Menu("Fahrzeugwerkstatt", carName, new Point(50, 50));
if (localVehicle.getBodyHealth() !== 1000) {
var repairItem = new UIMenuItem("Fahrzeug reparieren");
mainMenu.AddItem(repairItem);
mainMenu.ItemSelect.on((selectedItem, index) => {
if (selectedItem === repairItem) {
mp.events.callRemote("repairVehicle");
mainMenu.Close();
setTimeout(() => {
mp.events.call("showTuningMenu");
}, 500);
}
});
mainMenu.MenuClose.on(() => {
globalData.InTuning = false;
mp.events.call("hideTuningInfo", false);
});
mainMenu.Open();
return;
}
carModTypes.forEach((modType) => {
if (localVehicle.getModSlotName(modType) !== "undefined") {
var slotName = mp.game.ui.getLabelText(localVehicle.getModSlotName(modType));
if (slotName === "NULL") {
slotName = getCustomName(localVehicle.model, modType);
if (slotName === undefined) slotName = getSlotName(modType);
}
if (slotName === "undefined") slotName = "Slot " + modType;
var menuItem = new UIMenuItem(slotName);
var num = localVehicle.getNumMods(modType);
if (num === undefined && modType !== 18 && modType !== 22) return;
if (num !== 0 || modType === 18 || modType === 22) mainMenu.AddItem(menuItem);
}
});
mainMenu.Open();
mainMenu.ItemSelect.on((item) => {
var modSlot = getSlotId(item.Text);
if (item.Text.startsWith("Slot")) {
restStr = item.Text.substring(5);
modSlot = parseInt(restStr);
}
if (modSlot === undefined) return;
if (modSlot === 38) {
localVehicle.setDoorOpen(5, false, false);
} else if (modSlot === 39 || modSlot === 40 || modSlot === 41) {
localVehicle.setDoorOpen(4, false, false);
}
var door = getDoor(localVehicle.model, modSlot);
if (door !== undefined) {
localVehicle.setDoorOpen(door, false, false);
}
var currentMod = localVehicle.getMod(modSlot);
var oldToggleValue;
if (modSlot === 18) {
oldToggleValue = localVehicle.isToggleModOn(modSlot);
currentMod = oldToggleValue ? 0 : -1;
}
if (modSlot === 22) {
localVehicle.setLights(2);
var hlColor = localVehicle.getVariable("headlightColor");
if (typeof hlColor !== "number" || isNaN(hlColor) || hlColor < 0 || hlColor === 255) {
currentMod = -1;
} else if (hlColor === 13) currentMod = 0;
else currentMod = hlColor + 2;
}
var currentModItem;
var modNum = localVehicle.getNumMods(modSlot);
if (modSlot === 18) modNum = 1;
if (modSlot === 22) modNum = 14;
modMenu = new Menu(item.Text, "Änderung: " + item.Text, new Point(50, 50));
for (var i = -1; i < modNum; i++) {
var modItem;
if (i === -1) {
modItem = new UIMenuItem("Serie", "");
} else {
var modName = getModName(localVehicle, modSlot, i);
modItem = new UIMenuItem(modName, "");
}
if (i === currentMod - (modSlot === 22 ? 1 : 0)) {
modItem.SetRightBadge(BadgeStyle.Car);
currentModItem = modItem;
}
modMenu.AddItem(modItem);
}
modMenu.ItemSelect.on((selectedItem, index) => {
if (currentModItem !== undefined) {
currentModItem.SetRightBadge(BadgeStyle.None);
}
if (selectedItem !== undefined) {
selectedItem.SetRightBadge(BadgeStyle.Car);
currentModItem = selectedItem;
}
mp.events.callRemote("setVehicleMod", modSlot, index);
if (modSlot === 18) {
oldToggleValue = index;
return;
}
if (modSlot === 22) {
currentMod = index;
return;
}
if (index === 0) index = -1;
currentMod = index - 1;
});
modMenu.IndexChange.on((index) => {
if (modSlot === 18) return;
if (modSlot === 22) {
setHeadlightsColor(localVehicle, index);
return;
}
if (index === 0) index = -1;
localVehicle.setMod(modSlot, index - 1);
});
modMenu.MenuClose.on(() => {
if (modSlot === 38) {
localVehicle.setDoorShut(5, false);
} else if (modSlot === 39 || modSlot === 40 || modSlot === 41) {
localVehicle.setDoorShut(4, false);
}
if (door !== undefined) {
localVehicle.setDoorShut(door, false);
}
if (closeMenu) {
closeMenu = false;
return;
}
mainMenu.Visible = true;
modMenu.Visible = false;
if (modSlot === 18) return;
else if (modSlot === 22) {
localVehicle.setLights(1);
setHeadlightsColor(localVehicle, currentMod);
return;
}
localVehicle.setMod(modSlot, currentMod);
});
mainMenu.Visible = false;
modMenu.Visible = true;
});
mainMenu.MenuClose.on(() => {
localVehicle.setLights(0);
globalData.InTuning = false;
mp.events.call("hideTuningInfo", false);
});
});
mp.events.add("playerLeaveVehicle", () => {
if (keyBound) {
mp.events.call("hideTuningInfo", true);
}
});
function getSlotName(slot) {
var toReturn = "undefined";
carModSlotName.forEach((name) => {
if (name.Slot === slot) toReturn = name.Name;
});
return toReturn;
}
function getSlotId(slotName) {
var toReturn = "undefined";
carModSlotName.forEach((name) => {
if (name.Name === slotName) toReturn = name.Slot;
});
if (toReturn === "undefined") {
toReturn = getCustomId(mp.players.local.vehicle.model, slotName);
if (toReturn === undefined) {
carModTypes.forEach((modType) => {
if (mp.game.ui.getLabelText(mp.players.local.vehicle.getModSlotName(modType)) === slotName) toReturn = getSlotId(getSlotName(modType));
});
}
}
return toReturn;
}
function getCustomName(model, slot) {
var toReturn = undefined;
customPartNames.forEach((cpn) => {
if (cpn.Model === model) {
cpn.Names.forEach((names) => {
if (names.Slot === slot) toReturn = names.Name;
});
}
});
return toReturn;
}
function getCustomId(model, name) {
var toReturn = undefined;
customPartNames.forEach((cpn) => {
if (cpn.Model === model) {
cpn.Names.forEach((names) => {
if (names.Name === name) toReturn = names.Slot;
});
}
});
return toReturn;
}
function getDoor(model, slot) {
var toReturn = undefined;
doorOpeners.forEach((cpn) => {
if (cpn.Model === model) {
cpn.Doors.forEach((door) => {
if (door.Slot === slot) toReturn = door.Door;
});
}
});
return toReturn;
}
function getModName(vehicle, slot, mod) {
var modName = vehicle.getModTextLabel(slot, mod);
var realModName = mp.game.ui.getLabelText(modName);
if (slot === 11) {
switch (mod) {
case 0:
realModName = "EMS Verbesserung 1";
break;
case 1:
realModName = "EMS Verbesserung 2";
break;
case 2:
realModName = "EMS Verbesserung 3";
break;
case 3:
realModName = "EMS Verbesserung 4";
break;
}
} else if (slot === 12) {
switch (mod) {
case 0:
realModName = "Straßenbremsen";
break;
case 1:
realModName = "Sportbremsen";
break;
case 2:
realModName = "Rennbremsen";
break;
}
} else if (slot === 13) {
switch (mod) {
case 0:
realModName = "Straßengetriebe";
break;
case 1:
realModName = "Sportgetriebe";
break;
case 2:
realModName = "Renngetriebe";
break;
}
} else if (slot === 15) {
switch (mod) {
case 0:
realModName = "Tiefere Federung";
break;
case 1:
realModName = "Straßenfederung";
break;
case 2:
realModName = "Sportfederung";
break;
case 3:
realModName = "Rennfederung";
break;
case 4:
realModName = "Wettkampffederung";
break;
}
} else if (slot === 18) {
realModName = "Turbotuning";
} else if (slot === 22) {
switch (mod) {
case 0:
realModName = "Xenon Licht";
break;
case 1:
realModName = "Weißes Licht";
break;
case 2:
realModName = "Blaues Licht";
break;
case 3:
realModName = "Hell-blaues Licht";
break;
case 4:
realModName = "Grünes Licht";
break;
case 5:
realModName = "Hell-grünes Licht";
break;
case 6:
realModName = "Hell-gelbes Licht";
break;
case 7:
realModName = "Gelbes Licht";
break;
case 8:
realModName = "Orangenes Licht";
break;
case 9:
realModName = "Rotes Licht";
break;
case 10:
realModName = "Hell-pinkes Licht";
break;
case 11:
realModName = "Pinkes Licht";
break;
case 12:
realModName = "Lila Licht";
break;
case 13:
realModName = "Hell-lila Licht";
break;
}
}
return realModName;
}
function setHeadlightsColor(vehicle, index) {
var color = index - 2;
if (index === 0) color = -1;
if (index === 1) color = 13;
if (typeof color !== "number" || isNaN(color) || color < 0 || color === 255) {
// Disable
vehicle.toggleMod(22, false);
mp.game.invoke("0xE41033B25D003A07", vehicle.handle, 255);
} else {
// Enable
vehicle.toggleMod(22, true);
mp.game.invoke("0xE41033B25D003A07", vehicle.handle, color);
}
}

View File

@@ -0,0 +1,15 @@
mp.keys.bind(0x42, true, _ => {
mp.events.callRemote("keyPress:B:toggleSiren");
});
mp.events.add('toggleVehicleSiren', (vehicle, state) => {
vehicle.setSirenSound(state);
});
mp.events.add('entityStreamIn', (entity) => {
if (entity.isAVehicle()) {
var state = entity.getVariable("sirenSound");
if (state === undefined) return;
entity.setSirenSound(state);
}
});

View File

@@ -0,0 +1,13 @@
mp.events.add('entityStreamIn', (entity) => {
if (entity.isAVehicle()) {
var mod18 = entity.getVariable('mod18');
if (mod18 !== undefined) {
entity.toggleMod(18, mod18);
}
}
});
mp.events.add('vehicleToggleMod', (veh, slot, newval) => {
veh.toggleMod(slot, newval);
});

View File

@@ -0,0 +1,75 @@
body {
font-family: "Roboto", sans-serif;
-webkit-font-smoothing: antialiased;
overflow: hidden;
}
.table {
background-color: rgba(255, 255, 255, .8);
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2), 0 5px 5px 0 rgba(0, 0, 0, 0.24);
width: 350px;
margin: auto;
margin-top: 5%;
padding: 0px 20px 20px 20px;
}
.rankDnD {
background-color: dimgrey;
cursor: move;
}
.save-btn {
display:inline-block;
margin-top: 10px;
width: 100%;
border-radius: 5px;
background-color: forestgreen;
color: white;
outline: 0;
padding: 5px 10px;
border: none;
}
.save-btn:active {
outline: 0;
}
#rank-table {
margin-left: 50%;
transform: translateX(-50%);
width: 100%;
}
#rank-table tr {
width: 100%;
}
.input-rankname {
display: inline-block;
margin-left: 50%;
transform: translateX(-50%);
}
.delete-rank {
background-color: orangered;
color: white;
padding: 3px;
}
.delete-rank:hover, .delete-rank:focus, .delete-rank:active {
background-color: #ff0223 !important;
}
#rank-table tr td {
border-bottom: 1px solid black;
padding: 5px 15px;
}
#rank-table tr:last-child td {
border-bottom: none;
}
#rank-table > tr:not(:first-child):hover {
background-color: dimgrey;
cursor: move;
}

View File

@@ -0,0 +1,49 @@
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
#black {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 100%;
height: 100%;
z-index: -1;
background-color: rgba(0, 0, 0, .3);
}
.input-main {
display: block;
width: 70%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: rgba(0, 0, 0, .8);
padding: 10px;
}
.input-main h1 {
color: white;
font-size: 24px;
font-family: "Arial";
font-weight: lighter;
margin-bottom: 5px;
}
.input-main input {
width: 100%;
background-color: black;
outline: 0;
border: grey 1px solid;
color: white;
padding: 5px;
font-size: 20px;
font-family: "Arial";
font-weight: lighter;
}

View File

@@ -0,0 +1,150 @@
/**
* @overview Life of German Reallife - Login CSS style.css
* @author Orangebox, hydrant
* @copyright (c) 2008 - 2018 Life of German
*/
.login-page {
width: 360px;
margin: auto;
}
.isa_info, .isa_success, .isa_warning, .isa_error {
margin: 10px 0px;
padding: 12px;
display: none;
}
.isa_info {
color: #00529B;
background-color: #BDE5F8;
}
.isa_success {
color: #4F8A10;
background-color: #DFF2BF;
}
.isa_warning {
color: #9F6000;
background-color: #FEEFB3;
}
.isa_error {
color: #D8000C;
background-color: #FFBABA;
}
.isa_info i, .isa_success i, .isa_warning i, .isa_error i {
margin: 10px 22px;
font-size: 2em;
vertical-align: middle;
}
.form {
position: relative;
z-index: 1;
background: rgba(255, 255, 255, .85);
max-width: 360px;
padding: 20px 45px 45px 45px;
text-align: center;
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2), 0 5px 5px 0 rgba(0, 0, 0, 0.24);
}
input {
font-family: "Roboto", sans-serif;
outline: 0;
background: #f2f2f2;
width: 100%;
border: 0;
margin: 0 0 15px;
padding: 15px;
box-sizing: border-box;
font-size: 14px;
}
button {
font-family: "Roboto", sans-serif;
text-transform: uppercase;
outline: 0;
background: #0035A5;
width: 100%;
border: 0;
padding: 15px;
color: #FFFFFF;
font-size: 14px;
-webkit-transition: all 0.3s ease;
transition: all 0.3s ease;
cursor: pointer;
}
button:hover, .form button:active, .form button:focus {
background: #002574;
}
.quitBtn {
background-color: orangered;
}
.quitBtn:hover, .quitBtn:focus, .quitBtn:active {
background-color: #cc3700 !important;
}
.message {
margin: 15px 0 0;
font-size: 12px;
}
.message a {
color: #0035A5;
text-decoration: none;
}
.register-form {
display: none;
}
.container {
position: relative;
z-index: 1;
max-width: 300px;
margin: 0 auto;
}
.container:before, .container:after {
content: "";
display: block;
clear: both;
}
.container .info {
margin: 50px auto;
text-align: center;
}
.info h1 {
margin: 0 0 15px;
padding: 0;
font-size: 36px;
font-weight: 300;
color: #1a1a1a;
}
.info span {
color: #4d4d4d;
font-size: 12px;
}
.info span a {
color: #000000;
text-decoration: none;
}
.info span .fa {
color: #EF3B3A;
}
body {
font-family: "Roboto", sans-serif;
-webkit-font-smoothing: antialiased;
}

View File

@@ -0,0 +1,443 @@
@font-face {
font-family: 'OSL';
src: url('package://assets/font/OpenSans-Bold.ttf') format('truetype');
}
*:focus {
outline: none;
}
body {
font-family:Arial, "Helvetica Neue", Helvetica, sans-serif;
font-size:14px;
font-style:normal;
font-variant:normal;
font-weight:400;
line-height:3;
}
span.arrow {
display:none!important;
}
* {
box-sizing:Border-box;
-webkit-touch-callout:none;
-webkit-user-select:none;
-moz-user-select:none;
-ms-user-select:none;
user-select:none;
color:#000!important;
font-family:OSL;
}
.circular-menu-container {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
max-width:none;
width:auto;
}
.circular-menu {
width:600px;
height:600px;
position:relative;
overflow:hidden;
border-radius:50%;
z-index:1;
list-style:none;
box-shadow:0 0 15px #333;
}
.center-section {
width: 360px;
height: 360px;
position: absolute;
top: 50%;
left: 50%;
margin-top: -180px;
margin-left: -180px;
border-radius: 50%;
text-align: center;
background-color: white;
box-shadow: inset 0 0 15px #333;
display: none;
z-index: 2;
cursor: default;
padding: 55px;
}
.circular-menu li:hover ~ .center-section.section-intro,.touch .circular-menu li:focus ~ .center-section.section-intro {
display:none;
}
.touch .circular-menu li:focus {
outline:0;
}
.circular-menu li div.label {
position:absolute;
width:180px;
height:180px;
z-index:2;
}
.circular-menu li div.label p {
text-align:center;
max-width:145.8px;
color:#000;
font-size: 12px;
margin: 65px 20px 7px;
line-height: 1;
}
.circular-menu li span.arrow {
position:absolute;
width:30px;
height:30px;
display:block;
transition:all 300ms ease-out;
z-index:2;
}
.circular-menu li .bg {
width:350px;
height:300px;
position:absolute;
transform-origin:0 300px;
margin-top:-300px;
left:50%;
top:50%;
transition: background 300ms ease-out;
}
.circular-menu li {
position:absolute;
text-decoration:none;
top:50%;
left:50%;
display:none;
}
.circular-menu li:nth-child(1) .bg {
transform:rotate(-70deg) skew(-50deg);
background:rgba(255,255,255,0.6);
}
.circular-menu li:nth-child(1) span.arrow {
transform:rotate(-45deg);
background:rgba(255,255,255,0.6);
margin:-225px 0 0 -15px;
}
.circular-menu li:nth-child(1) div.label {
margin:-330px 0 0 -90px;
}
.circular-menu li:nth-child(2) .bg {
transform:rotate(-30deg) skew(-50deg);
background:rgba(255,255,255,0.6);
}
.circular-menu li:nth-child(2) span.arrow {
transform:rotate(-5deg);
background:rgba(255,255,255,0.6);
margin:-175.869333055px 0 0 119.9853980342px;
}
.circular-menu li:nth-child(2) div.label {
margin:-273.8506663486px 0 0 64.2690263248px;
}
.circular-menu li:nth-child(3) .bg {
transform:rotate(10deg) skew(-50deg);
background:rgba(255,255,255,0.6);
}
.circular-menu li:nth-child(3) span.arrow {
transform:rotate(35deg);
background:rgba(255,255,255,0.6);
margin:-51.4661173101px 0 0 191.8096281326px;
}
.circular-menu li:nth-child(3) div.label {
margin:-131.6755626401px 0 0 146.3538607229px;
}
.circular-menu li:nth-child(4) .bg {
transform:rotate(50deg) skew(-50deg);
background:rgba(255,255,255,0.6);
}
.circular-menu li:nth-child(4) span.arrow {
transform:rotate(75deg);
background:rgba(255,255,255,0.6);
margin:90px 0 0 166.8653347947px;
}
.circular-menu li:nth-child(4) div.label {
margin:30px 0 0 117.8460969083px;
}
.circular-menu li:nth-child(5) .bg {
transform:rotate(90deg) skew(-50deg);
background:rgba(255,255,255,0.6);
}
.circular-menu li:nth-child(5) span.arrow {
transform:rotate(115deg);
background:rgba(255,255,255,0.6);
margin:182.335450365px 0 0 56.8242300984px;
}
.circular-menu li:nth-child(5) div.label {
margin:135.5262289886px 0 0 -7.9151656019px;
}
.circular-menu li:nth-child(6) .bg {
transform:rotate(130deg) skew(-50deg);
background:rgba(255,255,255,0.6);
}
.circular-menu li:nth-child(6) span.arrow {
transform:rotate(155deg);
background:rgba(255,255,255,0.6);
margin:182.335450365px 0 0 -86.8242300984px;
}
.circular-menu li:nth-child(6) div.label {
margin:135.5262289886px 0 0 -172.0848343982px;
}
.circular-menu li:nth-child(7) .bg {
transform:rotate(170deg) skew(-50deg);
background:rgba(255,255,255,0.6);
}
.circular-menu li:nth-child(7) span.arrow {
transform:rotate(195deg);
background:rgba(255,255,255,0.6);
margin:90px 0 0 -196.8653347945px;
}
.circular-menu li:nth-child(7) div.label {
margin:30px 0 0 -297.846096908px;
}
.circular-menu li:nth-child(8) .bg {
transform:rotate(210deg) skew(-50deg);
background:rgba(255,255,255,0.6);
}
.circular-menu li:nth-child(8) span.arrow {
transform:rotate(235deg);
background:rgba(255,255,255,0.6);
margin:-51.4661173026px 0 0 -221.8096280805px;
}
.circular-menu li:nth-child(8) div.label {
margin:-131.6755626315px 0 0 -326.3538606634px;
}
.circular-menu li:nth-child(9) .bg {
transform:rotate(250deg) skew(-50deg);
background:rgba(255,255,255,0.6);
}
.circular-menu li:nth-child(9) span.arrow {
transform:rotate(275deg);
background:rgba(255,255,255,0.6);
margin:-175.8693324509px 0 0 -149.985394581px;
}
.circular-menu li:nth-child(9) div.label {
margin:-273.8506656582px 0 0 -244.2690223782px;
}
.m {
margin-left:58px;
margin-top: -8px;
}
.m1 {
margin-left:2.4vw;
margin-top:-.6vw;
}
.m2 {
margin-left:60px;
margin-top: -7px;
}
.m4 {
margin-left:68px;
margin-top: -6px;
transform: rotate(-0deg);
width: 70px;
}
.m5 {
margin-left:53px;
margin-top: -6px;
transform: rotate(1deg);
}
.m6 {
transform:scaleX(-1);
margin-top:-5px;
margin-bottom:20px;
margin-left:54px;
max-width:none;
width:60px;
}
.middletext {
z-index:20000;
text-align:center;
color:#000!important;
position:absolute;
top:13vw;
left:48vw;
font-size:13px;
}
.information {
background:rgba(255,255,255,0.6);
border-radius:2px;
max-width:none;
width: 41vw;
box-shadow:0 0 15px #333;
position: absolute;
top: 630px;
left: 30vw;
margin-top: 1vw;
display: none;
}
.information-title {
text-align:center;
}
.information-text {
height:174px;
margin: 1px 40px 35px;
}
.center-section.section-intro,.circular-menu li:nth-child(1):hover div.center-section.section-1,.touch .circular-menu li:nth-child(1):focus div.center-section.section-1,.circular-menu li:nth-child(2):hover div.center-section.section-2,.touch .circular-menu li:nth-child(2):focus div.center-section.section-2,.circular-menu li:nth-child(3):hover div.center-section.section-3,.touch .circular-menu li:nth-child(3):focus div.center-section.section-3,.circular-menu li:nth-child(4):hover div.center-section.section-4,.touch .circular-menu li:nth-child(4):focus div.center-section.section-4,.circular-menu li:nth-child(5):hover div.center-section.section-5,.touch .circular-menu li:nth-child(5):focus div.center-section.section-5,.circular-menu li:nth-child(6):hover div.center-section.section-6,.touch .circular-menu li:nth-child(6):focus div.center-section.section-6,.circular-menu li:nth-child(7):hover div.center-section.section-7,.touch .circular-menu li:nth-child(7):focus div.center-section.section-7,.circular-menu li:nth-child(8):hover div.center-section.section-8,.touch .circular-menu li:nth-child(8):focus div.center-section.section-8,.circular-menu li:nth-child(9):hover div.center-section.section-9,.touch .circular-menu li:nth-child(9):focus div.center-section.section-9 {
display:block;
}
.circular-menu li:nth-child(1),.circular-menu li:nth-child(2),.circular-menu li:nth-child(3),.circular-menu li:nth-child(4),.circular-menu li:nth-child(5),.circular-menu li:nth-child(6),.circular-menu li:nth-child(7),.circular-menu li:nth-child(8),.circular-menu li:nth-child(9) {
display:block;
cursor:pointer;
}
.circular-menu li:nth-child(1):hover .bg,.touch .circular-menu li:nth-child(1):focus .bg,.circular-menu li:nth-child(2):hover .bg,.touch .circular-menu li:nth-child(2):focus .bg,.circular-menu li:nth-child(3):hover .bg,.touch .circular-menu li:nth-child(3):focus .bg,.circular-menu li:nth-child(4):hover .bg,.touch .circular-menu li:nth-child(4):focus .bg,.circular-menu li:nth-child(5):hover .bg,.touch .circular-menu li:nth-child(5):focus .bg,.circular-menu li:nth-child(6):hover .bg,.touch .circular-menu li:nth-child(6):focus .bg,.circular-menu li:nth-child(7):hover .bg,.touch .circular-menu li:nth-child(7):focus .bg,.circular-menu li:nth-child(8):hover .bg,.touch .circular-menu li:nth-child(8):focus .bg,.circular-menu li:nth-child(9):hover .bg,.touch .circular-menu li:nth-child(9):focus .bg {
background:rgba(255,255,255,0.9);
}
img {
width:60px;
}
.options {
background:rgba(255,255,255,0.6);
border-radius:2px;
max-width:none;
width:auto;
box-shadow:0 0 15px #333;
margin: 20px 16vw 20px 65vw;
position: relative;
z-index: 200;
top: 3vw;
padding-bottom: 0vw;
height: 17vw;
left: 9vw;
}
.options {
text-align:center;
}
.options-buttons {
padding-top: 0.2vw;
padding-bottom: 0.2vw;
background: #81ff9d;
border: 1px solid rgba(0, 0, 0, 0.2);
margin-left: 3vw;
margin-right: 3vw;
border-radius: 20px 0px;
cursor: pointer;
font-size: 1vw;
transition: 0.1s;
box-shadow: 0 0 5px #333;
}
.options-buttons:hover {
background: #b2ffc3;
}
.price {
height: 1vw;
padding: 2vw;
background: rgba(0, 0, 0, 0.2);
border: 1px solid rgba(0, 0, 0, 0.3);
margin-left: 2vw;
margin-right: 2vw;
margin-top: 2vw;
/*box-shadow: 0 0 5px #333;*/
}
input:not([type]), input[type="email" i], input[type="number" i], input[type="password" i], input[type="tel" i], input[type="url" i], input[type="text" i] {
padding: 0px 0px;
}
input {
-webkit-appearance: textfield;
background-color: #cccccc;
cursor: text;
padding: 1px;
border-width: 0px;
border-style: inset;
border-color: initial;
border-image: initial;
}
input, textarea, select, button {
text-rendering: auto;
color: initial;
letter-spacing: normal;
word-spacing: normal;
text-transform: none;
text-indent: 0px;
text-shadow: none;
display: inline-block;
text-align: start;
margin: 0em;
font: 400 13.3333px Arial;
width: 280px;
margin-left: 171px;
height: 41px;
position: relative;
top: -30px;
font-size: 21px;
z-index: 10000000;
}
.price-text {
position: relative;
top: -2.6vw;
z-index: 2000000;
font-size: 1vw;
}
.number-dollar {
position: relative;
font-size: 2vw;
top: -8vw;
left: 5vw;
font-family: 'OSL';
}

Binary file not shown.

View File

@@ -0,0 +1,29 @@
<!--
* @overview Life of German Reallife - Client Save.html
* @author hydrant
* @copyright (c) 2008 - 2018 Life of German
*-->
<!DOCTYPE html>
<html lang="de" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
<link rel="stylesheet" href="package://assets/css/factionmanagement/ranks/style.css" />
</head>
<body>
<div class="table">
<table id="rank-table"></table>
<div class="add-rank">
<input id="input-new-rank" placeholder="Neuer Rang"/>
<button id="btn-add-new-rank">Hinzufügen</button>
</div>
<button class="save-btn">Speichern</button>
</div>
<script src="package://assets/js/jquery-3.3.1.min.js"></script>
<script src="package://assets/js/jquery.tablednd.0.8.min.js"></script>
<script src="package://assets/js/jquery.gettable.js"></script>
<script src="package://assets/js/factionmanagement/ranks/script.js"></script>
</body>
</html>

View File

@@ -0,0 +1,32 @@
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="package://assets/css/inputhelper/style.css" />
</head>
<body>
<div id="black"></div>
<div class="input-main">
<h1></h1>
<input id="input-value" autofocus>
</div>
<script type="text/javascript" src="package://assets/js/jquery-3.3.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
mp.trigger('cef_request_title');
$('#input-value').keydown(function (e) {
if (e.keyCode != 13) return;
var currentValue = $('#input-value').val();
if (currentValue) {
mp.trigger('cef_inputhelper_sendvalue', currentValue);
console.log("triggered event: " + currentValue);
}
});
});
function setTitle(title) {
$('.input-main h1').text(title);
}
</script>
</body>
</html>

View File

@@ -0,0 +1,51 @@
<!--
* @overview Life of German Reallife - Client Login login.html
* @author Orangebox, hydrant, VegaZ
* @copyright (c) 2008 - 2018 Life of German
*-->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="package://assets/css/login/style.css" />
</head>
<body>
<div class="login-page" style="padding: 10% 0 0;">
<div class="form">
<div class="isa_error">
ERROR TEXT
</div>
<div class="register-form form-l">
<input type="password" placeholder="Passwort" id="passwordInputRegister" />
<input type="password" placeholder="Passwort wiederholen" id="passwordRepeatInputRegister" />
<button id="registerBtn" onclick="registerPlayer()";>Registrieren</button><br /><br />
<button class="quitBtn">Server verlassen</button>
<p class="message">Bereits registriert? <a href="#">Logg dich ein</a></p>
</div>
<div class="login-form form-l">
<input type="password" placeholder="Passwort" id="passwordInputLogin" />
<button id="loginBtn" onclick="loginPlayer()">Einloggen</button><br /><br />
<button class="quitBtn">Server verlassen</button>
<p class="message">Nicht registriert? <a href="#">Erstelle einen Account</a></p>
</div>
</div>
</div>
<script src="package://assets/js/jquery-3.3.1.min.js"></script>
<script type="text/javascript">
$(".message a").click(() => {
$(".form-l").animate({ height: "toggle", opacity: "toggle" }, "slow");
});
$(".quitBtn").click(() => {
resourceCall("Quit");
});
function showError(error) {
$(".isa_error").html(error.toString());
$(".isa_error").slideDown();
}
</script>
<script src="package://assets/js/login/script.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -0,0 +1,120 @@
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="package://assets/css/vehiclemenu/style.css">
</head>
<body>
<div class="circular-menu-container">
<div class="center-section section-intro">
</div>
<ul class="circular-menu">
<li class="" tabindex="1">
<div class="center-section section-1">
</div>
<span class="arrow"></span>
<div class="bg"></div>
<div class="label">
<p>Schließen</p>
<img class="m" src="package://assets/img/vehiclemenu/exit.png">
</div>
</li>
<li class="" tabindex="2">
<div class="center-section section-2">
</div>
<span class="arrow"></span>
<div class="bg"></div>
<div class="label">
<!--<p>Geld Geben</p>
<img class="m4" src="package://assets/img/vehiclemenu/i9.png">-->
</div>
</li>
<li class="" tabindex="3">
<div class="center-section section-3">
</div>
<span class="arrow"></span>
<div class="bg"></div>
<div class="label">
<p>Türen öffnen / schließen</p>
<img class="m6" src="package://assets/img/vehiclemenu/door.png">
</div>
</li>
<li class="" tabindex="4">
<div class="center-section section-4">
</div>
<span class="arrow"></span>
<div class="bg"></div>
<div class="label">
<!--<p>Lizenzen zeigen</p>
<img class="m6" src="package://assets/img/vehiclemenu/i11.png">-->
</div>
</li>
<li class="" tabindex="5">
<div class="center-section section-5">
</div>
<span class="arrow"></span>
<div class="bg"></div>
<div class="label">
<p>Auf -/ Abschließen</p>
<img class="m" src="package://assets/img/vehiclemenu/lock.png">
</div>
</li>
<li class="" tabindex="6">
<div class="center-section section-6">
</div>
<span class="arrow"></span>
<div class="bg"></div>
<div class="label">
<p>Tanken</p>
<img class="m2" src="package://assets/img/vehiclemenu/fill.png">
</div>
</li>
<li class="" tabindex="7">
<div class="center-section section-7">
</div>
<span class="arrow"></span>
<div class="bg"></div>
<div class="label">
<!--<p>Personalausweis ansehen</p>
<img class="m" src="package://assets/img/vehiclemenu/i10.png">-->
</div>
</li>
<li class="" tabindex="8">
<div class="center-section section-8">
</div>
<span class="arrow"></span>
<div class="bg"></div>
<div class="label">
<p>Motor betätigen</p>
<img class="m" src="package://assets/img/vehiclemenu/power.png">
</div>
</li>
<li class="" tabindex="9">
<div class="center-section section-9">
</div>
<span class="arrow"></span>
<div class="bg"></div>
<div class="label">
<!--<p>Durchsuchen</p>
<img class="m5" src="package://assets/img/vehiclemenu/i14.png">-->
</div>
</li>
</ul>
</div>
<script src="package://assets/js/jquery-3.3.1.min.js"></script>
<!--<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>-->
<script>
$(document).ready(function () {
$("ul li").click(function () {
var action = parseInt($(this).attr("tabindex"));
console.log(action);
mp.trigger('doAction', action);
});
});
</script>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 697 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,63 @@
/**
* @overview Life of German Reallife - Faction Manager Rank (script.js)
* @author hydrant
* @copyright (c) 2008 - 2018 Life of German
*/
var dndConfig = {
onDragClass: "rankDnD"
};
$(document).ready(function () {
mp.trigger("onManageFactionRanksLoaded");
$("table#rank-table").on("click", "tr td span", function () {
$(this).parent().parent().remove();
$("table#rank-table").tableDnD(dndConfig);
});
$("#btn-add-new-rank").click(function () {
var toAdd = $("input#input-new-rank").val();
if (toAdd.length === 0) return;
$("input#input-new-rank").val("");
$("table#rank-table").append("<tr><td style='display:none;'><input disabled class='input-id' value='0' /></td><td><input class='input-rankname' value='" + toAdd + "' /><td><span class='delete-rank'>X</span></td></tr>");
$("table#rank-table").tableDnD(dndConfig);
});
$(".save-btn").click(function () {
var rows = $("table#rank-table tr");
rows = rows.slice(1);
if (rows.length === 0) {
alert("Es muss mindestens ein Rang angegeben werden!");
return;
}
var rankArray = new Array();
rows.each(function () {
var id = $(this).find("input.input-id")[0].value;
var name = $(this).find("input.input-rankname")[0].value;
var rank = new Object();
rank.Id = parseInt(id);
rank.Name = name;
rankArray.push(rank);
});
var json = JSON.stringify(rankArray);
mp.trigger('saveFactionRankData', json);
});
});
function loadData(rankData) {
$("table#rank-table tr").remove();
$("table#rank-table").append("<tr class='nodrop nodrag'><th style='display:none;'>ID</th><th>Fraktions-Ränge</th></tr>");
rankData.forEach(function (rank) {
$("table#rank-table").append("<tr><td style='display:none;'><input disabled class='input-id' value='" + rank.Id + "' /></td><td><input class='input-rankname' value='" + rank.Name + "' /><td><span class='delete-rank'>X</span></td></tr>");
});
$("table#rank-table").tableDnD(dndConfig);
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
!function (n) { "use strict"; function e(e, t) { n.each(t, function (t, o) { n.inArray(o, e) < 0 && e.push(o) }) } function t(t, o) { function r(n) { var e; if (!c.rows[n]) for (e = 0; n >= e; e++)c.rows[e] = c.rows[e] || { cells: [], table: c }; return c.rows[n] } function l(n) { var e; if (!c.cols[n]) for (e = 0; n >= e; e++)c.cols[e] = c.cols[e] || { cells: [], table: c }; return c.cols[n] } var c = { rows: [], cols: [], cells: [] }, s = "number" == typeof o ? o : y.length, u = -1, a = {}, i = "table" === t.get(0).nodeName.toLowerCase() ? t.get(0) : function () { var n = t.closest("table"); return n.length ? n.get(0) : void 0 }(); return i ? (c.elm = i, n(i).data(N, "table:" + s), n.each(i.rows, function (e, t) { var o, i, f, h, w, v, g, m, b, d = 0; for (n(t).data(N, "table:" + s + ",row:" + e), function () { var e = 0; n.each(t.cells, function (n, t) { e += +t.colSpan || 1 }), e - 1 > u && (u = e - 1) }(), h = 0; u >= h; h++)if ((!a[e] || !a[e][h]) && (w = t.cells[d++])) { for (n(w).data(N, "table:" + s + ",cell:" + c.cells.length), f = { elm: w, rows: [], cols: [], table: c, iRow: e, iCol: h }, v = (+w.rowSpan || 1) - 1, g = (+w.colSpan || 1) - 1, m = 0; v >= m; m++)o = r(e + m), f.rows.push(o), o.cells.push(f); for (m = 0; g >= m; m++)i = l(h + m), f.cols.push(i), i.cells.push(f); for (m = 1; v >= m; m++)for (a[e + m] = a[e + m] || {}, b = 0; g >= b; b++)a[e + m][h + b] = !0; h += g, c.cells.push(f) } }), n.each(c.cells, function (t, o) { var r = [o]; n.each(o.rows.concat(o.cols), function (n, t) { e(r, t.cells) }), o.xCells = r }), n.each(c.rows, function (n, e) { e.cells.sort(function (n, e) { return n.iCol - e.iCol }) }), n.each(c.cols, function (n, e) { e.cells.sort(function (n, e) { return n.iRow - e.iRow }) }), y[s] = c, c) : null } function o(n) { for (var e, t = {}, o = n.data(N) || "", r = /\b(\w+):(\d+)/g; null !== (e = r.exec(o));)t[e[1]] = +e[2]; return t } function r(n, e) { var r = o(n).table; return e || "number" != typeof r || !y[r] ? t(n, r) : y[r] } function l(n) { return "table" === n } function c(n) { return "tr" === n } function s(n) { return "td" === n || "th" === n } function u(n) { return "thead" === n || "tfoot" === n || "tbody" === n } function a(n) { return l(n) || c(n) || s(n) || u(n) } function i(e) { return n.map(e, function (n) { return n.elm }) } function f(e) { return n(i(e)) } function h(t) { var a = []; return t.each(function () { var t, f = n(this), h = f.get(0).nodeName.toLowerCase(); l(h) && (t = r(f)) ? e(a, i(t.cells)) : c(h) && (t = r(f)) ? e(a, i(t.rows[o(f).row].cells)) : s(h) && (t = r(f)) ? e(a, [t.cells[o(f).cell].elm]) : u(h) && (t = r(f)) && n.each(f.get(0).rows, function (r, l) { e(a, i(t.rows[o(n(l)).row].cells)) }) }), n(a.length ? a : null) } function w(t) { var l = []; return t.each(function () { var t, c = n(this), u = c.get(0).nodeName.toLowerCase(); s(u) && (t = r(c)) && e(l, i(t.cells[o(c).cell].xCells)) }), n(l.length ? l : null) } function v(t) { var a = []; return t.each(function () { var t, i = n(this), f = i.get(0).nodeName.toLowerCase(); l(f) && (t = r(i)) ? e(a, t.rows) : c(f) && (t = r(i)) ? e(a, [t.rows[o(i).row]]) : s(f) && (t = r(i)) ? e(a, t.cells[o(i).cell].rows) : u(f) && (t = r(i)) && e(a, n.map(i.get(0).rows, function (e) { return t.rows[o(n(e)).row] })) }), a } function g(t) { var a = []; return t.each(function () { var t, i = n(this), f = i.get(0).nodeName.toLowerCase(); (l(f) || c(f) || u(f)) && (t = r(i)) ? e(a, t.cols) : s(f) && (t = r(i)) && e(a, t.cells[o(i).cell].cols) }), a } function m(e) { return n.map(v(e), function (n) { return f(n.cells) }) } function b(t) { var o = []; return n.each(v(t), function (n, t) { e(o, i(t.cells)) }), n(o.length ? o : null) } function d(e) { return n.map(g(e), function (n) { return f(n.cells) }) } function p(t) { var o = []; return n.each(g(t), function (n, t) { e(o, i(t.cells)) }), n(o.length ? o : null) } function C(t) { var o = []; return t.each(function () { var t, l = n(this), c = l.get(0).nodeName.toLowerCase(); a(c) && (t = r(l)) && e(o, [t.elm]) }), n(o.length ? o : null) } function L(e) { return e.each(function () { var e = n(this), t = e.get(0).nodeName.toLowerCase(); a(t) && r(e, !0) }) } var N = "getTable", y = []; n.fn[N] = function (n) { return "cells" === n ? h(this) : "xCells" === n ? w(this) : "rows" === n ? m(this) : "rowsCells" === n ? b(this) : "cols" === n ? d(this) : "colsCells" === n ? p(this) : "table" === n ? C(this) : L(this) } }(jQuery);

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,40 @@
/**
* @overview Life of German Reallife - Login Login login.js
* @author VegaZ
* @copyright (c) 2008 - 2018 Life of German
*/
function registerPlayer() {
var password = document.getElementById("passwordInputRegister").value;
var passwordRepeat = document.getElementById("passwordRepeatInputRegister").value;
if(password === "" || passwordRepeat === "") {
showError("Mindestens ein Passwort Feld ist leer!");
return;
}
if (password !== passwordRepeat) {
showError("Die beiden Passwörter stimmen nicht überein!");
return;
}
if (password.length < 8) {
showError("Das Passwort muss mindestens 8 Zeichen lang sein");
return;
}
$('.isa_error').hide();
mp.trigger("registerInformationToServer", password);
}
function loginPlayer() {
let password = document.getElementById("passwordInputLogin").value;
if (password === "") {
showError("Du musst ein Passwort angeben!");
return;
}
$('.isa_error').hide();
mp.trigger("loginInformationToServer", password);
}

View File

@@ -0,0 +1,19 @@
function setHeadlightsColor(vehicle, color) {
if (typeof color !== "number" || isNaN(color) || color < 0 || color === 255) {
// Disable
vehicle.toggleMod(22, false);
mp.game.invoke("0xE41033B25D003A07", vehicle.handle, 255);
} else {
// Enable
vehicle.toggleMod(22, true);
mp.game.invoke("0xE41033B25D003A07", vehicle.handle, color);
}
}
mp.events.add("entityStreamIn", (entity) => {
if (entity.type === "vehicle") setHeadlightsColor(entity, parseInt(entity.getVariable("headlightColor")));
});
mp.events.addDataHandler("headlightColor", (entity, value) => {
if (entity.type === "vehicle") setHeadlightsColor(entity, value);
});

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3856a938ad287f72150e3e839d1a54c8cf31d78025e63942ccfafa4c8f066300
size 30208

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ad67a68580431746ceea4e52b889f694ce7521430d0d6c6a6cf3582db450f97a
size 76800

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3f017f66bb91eed7430558929321ad5851973a2d75f886bf4b461cda349344fc
size 12288

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2b0c2b1815e1add21f0cae50c575fe2232dc5e875321462bd092a5e0957303e9
size 41567232

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:dcdd3bc395495b6cb05694e219de3fd35302209641cb29977baaeebd2d149654
size 17388032

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:37a0bde45805b1bd2b1492e37a86286544bf643950d63eb188f5a2132676588e
size 24576

View File

@@ -0,0 +1,56 @@
/**
* @overview Life of German Reallife - Login index.js
* @author VegaZ, hydrant
* @copyright (c) 2008 - 2018 Life of German
**/
let globalData = {
InTuning: false,
HideGui: false,
Interaction: false,
InChat: false
};
mp.game.gameplay.enableMpDlcMaps(true);
mp.game.vehicle.defaultEngineBehaviour = true;
//ALPHABETISCH SORTIERT UND ZUSAMMENGEFÜGT
require('./Business/main.js');
require('./Business/cardealer.js');
require('./CharCreator/index.js');
require('./coloredhlights');
require('./DoorManager/doormanager.js');
require('./FactionManagement/main.js');
require('./Gui/deathscreen.js');
require('./Gui/infobox.js');
require('./Gui/nametags.js');
require('./Gui/playerlist.js');
require('./Gui/Inventory/inventory.js');
require('./Gui/vehiclemenu/main.js');
require('./Gui/interiors.js');
require('./Interaction/factioninteraction.js');
require('./Interaction/playerinteraction.js');
require('./Login/main.js');
require('./Player/dutycloth.js');
require('./Player/keys.js');
require('./Player/quit.js');
require('./Player/freecam.js');
require('./Save/main.js');
require('./Speedometer/index.js');
require('./Tuning/main.js');
require('./Tuning/sync.js');
require('./Tuning/sirensilence.js');
require('./vehiclesync/vehiclesync.js');
require('./vehiclesync/smoothtrottle.js');

View File

@@ -0,0 +1,66 @@
class InputHelper {
constructor(title) {
this.title = title;
this.cefTitleCall = this.cefTitleCall.bind(this);
mp.events.add('cef_request_title', this.cefTitleCall);
this.cefCallback = this.cefCallback.bind(this);
mp.events.add('cef_inputhelper_sendvalue', this.cefCallback);
this.finish = this.finish.bind(this);
this.show = this.show.bind(this);
this.valueGetter = this.valueGetter.bind(this);
this.getValue = this.getValue.bind(this);
this.value = undefined;
mp.events.add('render', this.disableControls);
}
disableControls() {
for (var i = 0; i <= 33; i++) {
mp.game.controls.disableAllControlActions(i);
}
}
show() {
if (this.created) return;
this.created = true;
this.browser = mp.browsers.new('package://assets/html/inputhelper/index.html');
}
finish() {
if (this.browser) {
mp.events.remove('cef_inputhelper_sendvalue');
mp.events.remove('cef_request_title');
mp.events.remove('render', this.disableControls);
this.browser.destroy();
this.created = false;
}
}
cefTitleCall() {
this.browser.execute(`setTitle('${this.title}')`);
}
cefCallback(val) {
this.value = val;
this.finish();
}
valueGetter() {
return new Promise(resolve => {
setInterval(() => {
if (this.value !== undefined) resolve(this.value);
}, 50);
});
}
async getValue(callback) {
var getVal = await this.valueGetter();
callback(getVal);
}
}
exports = InputHelper;

View File

@@ -0,0 +1,3 @@
exports = function (money) {
return money.toLocaleString("de-DE", { minimumFractionDigits: 0 });
};

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,18 @@
{
"name": "reallifegamemode.client",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@types/node": {
"version": "11.9.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-11.9.5.tgz",
"integrity": "sha512-vVjM0SVzgaOUpflq4GYBvCpozes8OgIIS5gVXVka+OfK3hvnkC1i93U8WiY2OtNE4XUWyyy/86Kf6e0IHTQw1Q=="
},
"@types/ragemp-c": {
"version": "github:CocaColaBear/types-ragemp-c#22f1d92d2b1e20abcfa5ecd6178b68bf3cc48e33",
"from": "github:CocaColaBear/types-ragemp-c#master",
"dev": true
}
}
}

View File

@@ -0,0 +1,10 @@
{
"name": "reallifegamemode.client",
"version": "1.0.0",
"devDependencies": {
"@types/ragemp-c": "github:CocaColaBear/types-ragemp-c#master"
},
"dependencies": {
"@types/node": "^11.9.5"
}
}

View File

@@ -0,0 +1,18 @@
{
"compilerOptions": {
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": false,
"sourceMap": false,
"alwaysStrict": true,
"target": "es6",
"rootDir": "./"
},
"include": [
"**/*"
],
"exclude": [
"node_modules",
"wwwroot"
]
}

View File

@@ -0,0 +1,137 @@
//This script will make vehicles have smoother acceleration.
//To disable the script call an event and set "GlobalDisable" to true.
//To disable individual sections, set "DisableAntiReverse" or "DisableSmoothThrottle" to true.
//This script includes an anti-reverse brake system with automatic brake lights.
//When you brake, while holding brake you will come to a complete stop and won't reverse until you
//release the brake button and press it again.
mp.events.add("SmoothThrottle_PlayerEnterVehicle", (entity, seat) =>
{
BrakeSystem = true;
});
mp.events.add("SmoothThrottle_PlayerExitVehicle", (entity) =>
{
BrakeSystem = false;
});
mp.events.add("SmoothThrottle_SetSmoothThrottle", (turnedOn) =>
{
DisableSmoothThrottle = !turnedOn;
});
mp.events.add("SmoothThrottle_SetAntiReverse", (turnedOn) =>
{
DisableAntiReverse = !turnedOn;
});
mp.events.add("SmoothThrottle_SetGlobal", (turnedOn) =>
{
GlobalDisable = !turnedOn;
});
let GlobalDisable = false;
let DisableAntiReverse = false;
let DisableSmoothThrottle = false;
let BrakeSystem = false;
let vehicleStopped = false;
let vehicleStoppedOnOwn = false;
let constantStart = 0.25; //starts at 0.25 and increases to 1
let constantStep = 0.135; //You can change this for a faster throttle response (Will cause more skidding)
let deltaAmount = constantStart;
let prevTime = mp.game.invoke('0x9CD27B0045628463');
let diffToggle = false;
mp.events.add("render", () =>
{
if(GlobalDisable)
return;
if(BrakeSystem)
{
if(mp.players.local.vehicle !== null)
{
if(!mp.players.local.vehicle.isSeatFree(-1)) //only do this if the vehicle has a driver (doesn't have to be the player who is rendering this)
{
//Optimize function calls to variables (probably doesn't make a difference)
let vehClass = mp.players.local.vehicle.getClass();
let isControl71Pressed = mp.game.controls.isControlPressed(0, 71); //accelerate
let isControl72Pressed = mp.game.controls.isControlPressed(0, 72); //brake
let isControl76Pressed = mp.game.controls.isControlPressed(0, 76); //handbrake
let speed = mp.players.local.vehicle.getSpeed();
//Only do it to car classes
if(!DisableSmoothThrottle && ((vehClass >= 0 && vehClass <= 12) || vehClass === 18 || vehClass === 19 || vehClass === 20))
{
if(isControl71Pressed || isControl72Pressed)
{
if(isControl76Pressed)
{
deltaAmount = 1.0; //If people are buffering their throttle up
}
mp.players.local.vehicle.setEngineTorqueMultiplier(deltaAmount);
//Calculate tick time and step every 250ms
if (mp.game.invoke('0x9CD27B0045628463') - prevTime > 250)
{
prevTime = mp.game.invoke('0x9CD27B0045628463');
deltaAmount += constantStep * speed; //Curve
if(deltaAmount > 1.0)
{
deltaAmount = 1.0;
}
}
}
else
{
deltaAmount = constantStart; //Reset when they let go of throttle
//mp.game.controls.setControlNormal(0, 71, amount);
}
}
//THIS IS THE BRAKE LIGHT SYSTEM WITH ANTI-REVERSE
if(DisableAntiReverse)
return;
if(speed < 1)
{
vehicleStopped = true;
}
else
{
vehicleStopped = false;
vehicleStoppedOnOwn = false;
diffToggle = false;
}
if((!isControl72Pressed && mp.game.controls.isControlEnabled(0, 72)) && !isControl76Pressed && vehicleStopped)
{
vehicleStoppedOnOwn = true;
mp.players.local.vehicle.setBrakeLights(true);
}
if(vehicleStopped && !vehicleStoppedOnOwn && !mp.players.local.vehicle.isInBurnout() && !diffToggle)
{
mp.players.local.vehicle.setBrakeLights(true);
mp.game.controls.disableControlAction(0, 72, true);
}
if((isControl71Pressed && !isControl72Pressed) || isControl76Pressed)
{
mp.players.local.vehicle.setBrakeLights(false);
}
if(mp.game.controls.isDisabledControlJustReleased(0, 72) && vehicleStopped)
{
mp.game.controls.enableControlAction(0, 72, true);
diffToggle = true;
}
}
}
}
});

View File

@@ -0,0 +1,548 @@
//Disapproved by the entire planet
//You don't need to worry about anything here
mp.events.add("VehStream_SetEngineStatus", (veh, status) => {
if (veh === undefined || veh === null || !veh.isAVehicle()) return;
if (veh !== undefined) {
if (veh.isSeatFree(-1)) //Turns engine on instantly if no driver, otherwise it will not turn on
{
veh.setEngineOn(status, true, false);
veh.setUndriveable(true);
}
else {
veh.setEngineOn(status, false, true);
veh.setUndriveable(!status);
}
}
});
mp.events.add("VehStream_SetLockStatus", (veh, status) => {
if (veh === undefined || veh === null || !veh.isAVehicle()) return;
if (veh !== undefined) {
if (status)
veh.setDoorsLocked(2);
else
veh.setDoorsLocked(1);
}
});
mp.events.add("VehStream_PlayerEnterVehicleAttempt", (entity, seat) => {
entity = mp.vehicles.atRemoteId(entity);
if (entity === undefined || entity === null || !entity.isAVehicle()) return;
if (typeof entity.getVariable("VehicleSyncData") !== 'undefined') {
var toggle = entity.getVariable("VehicleSyncData");
entity.setEngineOn(toggle.Engine, false, true);
entity.setUndriveable(!toggle.Engine);
}
});
mp.events.add("VehStream_PlayerExitVehicleAttempt", (entity) => {
if (entity === undefined || entity === null || !entity.isAVehicle()) return;
if (entity !== undefined) {
if (typeof entity.getVariable("VehicleSyncData") !== 'undefined') {
var toggle = entity.getVariable("VehicleSyncData");
entity.setEngineOn(toggle.Engine, true, false);
entity.setUndriveable(!toggle.Engine);
}
var level = entity.getDirtLevel();
mp.events.callRemote("VehStream_SetDirtLevel", entity, level);
}
});
mp.events.add("VehStream_PlayerExitVehicle", (entity) => {
entity = mp.vehicles.atRemoteId(entity);
if (entity === undefined || entity === null || !entity.isAVehicle()) {
return;
}
setTimeout(() => {
var Status = [];
let y = 0;
for (y = 0; y < 8; y++) {
if (entity.isDoorDamaged(y)) {
Status.push(2);
}
else if (entity.getDoorAngleRatio(y) > 0.15) {
Status.push(1);
}
else {
Status.push(0);
}
}
mp.events.callRemote("VehStream_SetDoorData", entity, Status[0], Status[1], Status[2], Status[3], Status[4], Status[5], Status[6], Status[7]);
Status = [];
if (entity.isWindowIntact(0)) {
if (entity.getBoneIndexByName("window_rf") === -1) {
Status.push(1);
}
else {
Status.push(0);
}
}
else {
Status.push(2);
}
if (entity.isWindowIntact(1)) {
if (entity.getBoneIndexByName("window_lf") === -1) {
Status.push(1);
}
else {
Status.push(0);
}
}
else {
Status.push(2);
}
if (entity.isWindowIntact(2)) {
if (entity.getBoneIndexByName("window_rr") === -1) {
Status.push(1);
}
else {
Status.push(0);
}
}
else {
Status.push(2);
}
if (entity.isWindowIntact(3)) {
if (entity.getBoneIndexByName("window_lr") === -1) {
Status.push(1);
}
else {
Status.push(0);
}
}
else {
Status.push(2);
}
mp.events.callRemote("VehStream_SetWindowData", entity, Status[0], Status[1], Status[2], Status[3]);
Status = [];
if (!entity.isTyreBurst(0, false)) {
Status.push(0);
}
else if (entity.isTyreBurst(0, false)) {
Status.push(1);
}
else {
Status.push(2);
}
if (!entity.isTyreBurst(1, false)) {
Status.push(0);
}
else if (entity.isTyreBurst(1, false)) {
Status.push(1);
}
else {
Status.push(2);
}
if (!entity.isTyreBurst(2, false)) {
Status.push(0);
}
else if (entity.isTyreBurst(2, false)) {
Status.push(1);
}
else {
Status.push(2);
}
if (!entity.isTyreBurst(3, false)) {
Status.push(0);
}
else if (entity.isTyreBurst(3, false)) {
Status.push(1);
}
else {
Status.push(2);
}
if (!entity.isTyreBurst(4, false)) {
Status.push(0);
}
else if (entity.isTyreBurst(4, false)) {
Status.push(1);
}
else {
Status.push(2);
}
if (!entity.isTyreBurst(5, false)) {
Status.push(0);
}
else if (entity.isTyreBurst(5, false)) {
Status.push(1);
}
else {
Status.push(2);
}
if (!entity.isTyreBurst(6, false)) {
Status.push(0);
}
else if (entity.isTyreBurst(6, false)) {
Status.push(1);
}
else {
Status.push(2);
}
if (!entity.isTyreBurst(7, false)) {
Status.push(0);
}
else if (entity.isTyreBurst(7, false)) {
Status.push(1);
}
else {
Status.push(2);
}
if (!entity.isTyreBurst(45, false)) {
Status.push(0);
}
else if (entity.isTyreBurst(45, false)) {
Status.push(1);
}
else {
Status.push(2);
}
if (!entity.isTyreBurst(47, false)) {
Status.push(0);
}
else if (entity.isTyreBurst(47, false)) {
Status.push(1);
}
else {
Status.push(2);
}
mp.events.callRemote("VehStream_SetWheelData", entity, Status[0], Status[1], Status[2], Status[3], Status[4], Status[5], Status[6], Status[7], Status[8], Status[9]);
}, 2500);
});
mp.events.add("VehStream_PlayerEnterVehicleAttempt", (entity, seat) => {
entity = mp.vehicles.atRemoteId(entity);
if (entity === undefined || entity === null || !entity.isAVehicle()) return;
setTimeout(() => {
var Status = [];
let y = 0;
for (y = 0; y < 8; y++) {
if (entity.isDoorDamaged(y)) {
Status.push(2);
}
else if (entity.getDoorAngleRatio(y) > 0.15) {
Status.push(1);
}
else {
Status.push(0);
}
}
//mp.events.callRemote("VehStream_SetDoorData", entity, Status[0], Status[1], Status[2], Status[3], Status[4], Status[5], Status[6], Status[7]);
Status = [];
if (entity.isWindowIntact(0)) {
if (entity.getBoneIndexByName("window_rf") === -1) {
Status.push(1);
}
else {
Status.push(0);
}
}
else {
Status.push(2);
}
if (entity.isWindowIntact(1)) {
if (entity.getBoneIndexByName("window_lf") === -1) {
Status.push(1);
}
else {
Status.push(0);
}
}
else {
Status.push(2);
}
if (entity.isWindowIntact(2)) {
if (entity.getBoneIndexByName("window_rr") === -1) {
Status.push(1);
}
else {
Status.push(0);
}
}
else {
Status.push(2);
}
if (entity.isWindowIntact(3)) {
if (entity.getBoneIndexByName("window_lr") === -1) {
Status.push(1);
}
else {
Status.push(0);
}
}
else {
Status.push(2);
}
mp.events.callRemote("VehStream_SetWindowData", entity, Status[0], Status[1], Status[2], Status[3]);
}, 3000);
});
mp.events.add("VehStream_SetVehicleDirtLevel", (entity, dirt) => {
if (entity === undefined || entity === null || !entity.isAVehicle()) return;
if (entity !== undefined) {
entity.setDirtLevel(dirt);
}
});
mp.events.add("VehStream_SetVehicleDoorStatus_Single", (veh, door, state) => {
if (veh === undefined || veh === null || !veh.isAVehicle()) return;
if (veh !== undefined) {
if (state === 0) {
veh.setDoorShut(door, false);
}
else if (state === 1) {
veh.setDoorOpen(door, false, false);
}
else {
veh.setDoorBroken(door, true);
}
}
});
mp.events.add("VehStream_SetVehicleDoorStatus", (...args) => {
if (args[0] !== undefined && args[0] !== null || !args[0].isAVehicle()) {
let y = 0;
for (y = 1; y < args.length; y++) {
if (args[y] === 0) {
args[0].setDoorShut(y - 1, false);
}
else if (args[y] === 1) {
args[0].setDoorOpen(y - 1, false, false);
}
else {
args[0].setDoorBroken(y - 1, true);
}
}
}
});
mp.events.add("VehStream_SetVehicleWindowStatus_Single", (veh, windw, state) => {
if (veh === undefined || veh === null || !veh.isAVehicle()) return;
if (veh !== undefined) {
if (state === 1) {
veh.rollDownWindow(windw);
}
else if (state === 0) {
veh.fixWindow(windw);
veh.rollUpWindow(windw);
}
else {
veh.smashWindow(windw);
}
}
});
mp.events.add("VehStream_SetVehicleWindowStatus", (...args) => {
if (args[0] !== undefined && args[0] !== null || !args[0].isAVehicle()) {
let y = 0;
for (y = 1; y < 4; y++) {
if (args[y] === 1) {
args[0].rollDownWindow(y - 1);
}
else if (args[y] === 0) {
args[0].fixWindow(y - 1);
args[0].rollUpWindow(y - 1);
}
else {
args[0].smashWindow(y - 1);
}
}
}
});
mp.events.add("VehStream_SetVehicleWheelStatus_Single", (veh, wheel, state) => {
if (veh === undefined || veh === null || !veh.isAVehicle()) return;
if (veh !== undefined) {
if (wheel === 9) {
if (state === 1) {
veh.setTyreBurst(45, false, 1000);
}
else if (state === 0) {
veh.setTyreFixed(45);
}
else {
veh.setTyreBurst(45, true, 1000);
}
}
else if (wheel === 10) {
if (state === 1) {
veh.setTyreBurst(47, false, 1000);
}
else if (state === 0) {
veh.setTyreFixed(47);
}
else {
veh.setTyreBurst(47, true, 1000);
}
}
else {
if (state === 1) {
veh.setTyreBurst(wheel, false, 1000);
}
else if (state === 0) {
veh.setTyreFixed(wheel);
}
else {
veh.setTyreBurst(wheel, true, 1000);
}
}
}
});
mp.events.add("VehStream_SetVehicleWheelStatus", (...args) => {
if (args[0] !== undefined && args[0] !== null || !args[0].isAVehicle()) {
let y = 0;
for (y = 1; y < args.length; y++) {
if (y === 9) {
if (args[y] === 1) {
args[0].setTyreBurst(45, false, 1000);
}
else if (args[y] === 0) {
args[0].setTyreFixed(45);
}
else {
args[0].setTyreBurst(45, true, 1000);
}
}
else if (y === 10) {
if (args[y] === 1) {
args[0].setTyreBurst(47, false, 1000);
}
else if (args[y] === 0) {
args[0].setTyreFixed(47);
}
else {
args[0].setTyreBurst(47, true, 1000);
}
}
else {
if (args[y] === 1) {
args[0].setTyreBurst(y - 1, false, 1000);
}
else if (args[y] === 0) {
args[0].setTyreFixed(y - 1);
}
else {
args[0].setTyreBurst(y - 1, true, 1000);
}
}
}
}
});
//Sync data on stream in
mp.events.add("entityStreamIn", (entity) => {
if (entity === undefined || entity === null || !entity.isAVehicle()) return;
if (entity.type === "vehicle") {
let typeor = typeof entity.getVariable('VehicleSyncData');
let actualData = entity.getVariable('VehicleSyncData');
//Needed to stop vehicles from freaking out
mp.game.streaming.requestCollisionAtCoord(entity.position.x, entity.position.y, entity.position.z);
//mp.game.invoke('0x199640F55E0F7596', entity.position.x, entity.position.y, entity.position.z);
entity.setLoadCollisionFlag(true);
entity.trackVisibility();
if (typeor !== 'undefined' && entity.isSeatFree(-1)) //Only if there is no driver
{
entity.position = actualData.Position;
entity.rotation = actualData.Rotation;
}
//Set doors unbreakable for a moment
let x = 0;
for (x = 0; x < 8; x++) {
entity.setDoorBreakable(x, false);
}
//Do it anyway
entity.setUndriveable(true);
if (typeor !== 'undefined') {
entity.setEngineOn(actualData.Engine, true, false);
entity.setUndriveable(true);
if (actualData.Locked)
entity.setDoorsLocked(2);
else
entity.setDoorsLocked(1);
entity.setDirtLevel(actualData.Dirt);
for (x = 0; x < 8; x++) {
if (actualData.Door[x] === 1)
entity.setDoorOpen(x, false, false);
else if (actualData.Door[x] === 0)
entity.setDoorShut(x, true);
else
entity.setDoorBroken(x, true);
}
for (x = 0; x < 4; x++) {
if (actualData.Window[x] === 0) {
entity.fixWindow(x);
}
else if (actualData.Window[x] === 1) {
entity.rollDownWindow(x);
}
else {
entity.smashWindow(x);
}
}
for (x = 0; x < 8; x++) {
if (actualData.Wheel[x] === 0) {
entity.setTyreFixed(x);
}
else if (actualData.Wheel[x] === 1) {
entity.setTyreBurst(x, false, 0);
}
else {
entity.setTyreBurst(x, true, 1000);
}
}
//For trailer mid wheels
if (actualData.Wheel[8] === 0) {
entity.setTyreFixed(45);
}
else if (actualData.Wheel[8] === 1) {
entity.setTyreBurst(45, false, 0);
}
else {
entity.setTyreBurst(45, true, 1000);
}
if (actualData.Wheel[9] === 0) {
entity.setTyreFixed(47);
}
else if (actualData.Wheel[9] === 1) {
entity.setTyreBurst(47, false, 0);
}
else {
entity.setTyreBurst(47, true, 1000);
}
}
//Make doors breakable again
setTimeout(() => {
for (x = 0; x < 8; x++) {
entity.setDoorBreakable(x, true);
}
}, 1500);
}
});