├── .gitattributes ├── client ├── includes │ └── NativeUI │ │ ├── enums │ │ ├── ChangeDirection.ts │ │ ├── Alignment.ts │ │ ├── Font.ts │ │ ├── ChangeDirection.js │ │ ├── Alignment.js │ │ ├── Font.js │ │ ├── BadgeStyle.ts │ │ ├── BadgeStyle.js │ │ ├── HudColor.ts │ │ ├── Control.ts │ │ ├── HudColor.js │ │ └── Control.js │ │ ├── modules │ │ ├── IElement.js │ │ ├── IElement.ts │ │ ├── ListItem.js │ │ ├── ListItem.ts │ │ ├── InstructionalButton.js │ │ ├── ItemsCollection.ts │ │ ├── ItemsCollection.js │ │ ├── Rectangle.js │ │ ├── Rectangle.ts │ │ ├── ResRectangle.js │ │ ├── Container.js │ │ ├── MidsizedMessage.js │ │ ├── ResRectangle.ts │ │ ├── Container.ts │ │ ├── MidsizedMessage.ts │ │ ├── InstructionalButton.ts │ │ ├── Text.js │ │ ├── BigMessage.js │ │ ├── Sprite.js │ │ ├── BigMessage.ts │ │ ├── Text.ts │ │ ├── Sprite.ts │ │ ├── Message.js │ │ ├── ResText.js │ │ ├── ResText.ts │ │ └── Message.ts │ │ ├── utils │ │ ├── Size.js │ │ ├── Common.js │ │ ├── Size.ts │ │ ├── Common.ts │ │ ├── Color.js │ │ ├── LiteEvent.js │ │ ├── Color.ts │ │ ├── UUIDV4.ts │ │ ├── UUIDV4.js │ │ ├── LiteEvent.ts │ │ ├── Point.js │ │ ├── Point.ts │ │ ├── Screen.js │ │ ├── Scaleform.js │ │ ├── Scaleform.ts │ │ └── Screen.ts │ │ └── items │ │ ├── UIMenuCheckboxItem.js │ │ ├── UIMenuCheckboxItem.ts │ │ ├── UIMenuSliderItem.js │ │ ├── UIMenuSliderItem.ts │ │ ├── UIMenuDynamicListItem.js │ │ ├── UIMenuListItem.js │ │ ├── UIMenuListItem.ts │ │ ├── UIMenuDynamicListItem.ts │ │ ├── UIMenuAutoListItem.js │ │ ├── UIMenuAutoListItem.ts │ │ ├── UIMenuItem.js │ │ └── UIMenuItem.ts └── client.js ├── resource.cfg ├── colors.json ├── README.md └── server └── server.js /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /client/includes/NativeUI/enums/ChangeDirection.ts: -------------------------------------------------------------------------------- 1 | enum ChangeDirection { 2 | Left, 3 | Right 4 | } 5 | 6 | export default ChangeDirection; -------------------------------------------------------------------------------- /client/includes/NativeUI/enums/Alignment.ts: -------------------------------------------------------------------------------- 1 | export enum Alignment { 2 | Left, 3 | Centered, 4 | Right 5 | } 6 | 7 | export default Alignment; -------------------------------------------------------------------------------- /client/includes/NativeUI/modules/IElement.js: -------------------------------------------------------------------------------- 1 | export default class IElement { 2 | constructor() { 3 | this.Enabled = true; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /resource.cfg: -------------------------------------------------------------------------------- 1 | type: js, 2 | main: server/server.js, 3 | client-main: client/client.js, 4 | client-files: [ 5 | client/* 6 | ], 7 | deps: [ 8 | chat 9 | ] -------------------------------------------------------------------------------- /client/includes/NativeUI/modules/IElement.ts: -------------------------------------------------------------------------------- 1 | export default class IElement { 2 | public Enabled: boolean; 3 | 4 | constructor() { 5 | this.Enabled = true; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /client/includes/NativeUI/utils/Size.js: -------------------------------------------------------------------------------- 1 | export default class Size { 2 | constructor(w = 0, h = 0) { 3 | this.Width = w; 4 | this.Height = h; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /client/includes/NativeUI/enums/Font.ts: -------------------------------------------------------------------------------- 1 | enum Font { 2 | ChaletLondon = 0, 3 | HouseScript = 1, 4 | Monospace = 2, 5 | CharletComprimeColonge = 4, 6 | Pricedown = 7 7 | } 8 | 9 | export default Font; 10 | -------------------------------------------------------------------------------- /client/includes/NativeUI/utils/Common.js: -------------------------------------------------------------------------------- 1 | import game from 'natives'; 2 | export default class Common { 3 | static PlaySound(audioName, audioRef) { 4 | game.playSound(-1, audioName, audioRef, false, 0, true); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /client/includes/NativeUI/utils/Size.ts: -------------------------------------------------------------------------------- 1 | export default class Size { 2 | public Width: number; 3 | public Height: number; 4 | 5 | constructor(w: number = 0, h: number = 0) { 6 | this.Width = w; 7 | this.Height = h; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /client/includes/NativeUI/utils/Common.ts: -------------------------------------------------------------------------------- 1 | import game from 'natives'; 2 | 3 | export default class Common { 4 | public static PlaySound(audioName: string, audioRef: string) { 5 | game.playSound(-1, audioName, audioRef, false, 0, true); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /client/includes/NativeUI/modules/ListItem.js: -------------------------------------------------------------------------------- 1 | import UUIDV4 from "../utils/UUIDV4"; 2 | export default class ListItem { 3 | constructor(text = "", data = null) { 4 | this.Id = UUIDV4(); 5 | this.DisplayText = text; 6 | this.Data = data; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /client/includes/NativeUI/enums/ChangeDirection.js: -------------------------------------------------------------------------------- 1 | var ChangeDirection; 2 | (function (ChangeDirection) { 3 | ChangeDirection[ChangeDirection["Left"] = 0] = "Left"; 4 | ChangeDirection[ChangeDirection["Right"] = 1] = "Right"; 5 | })(ChangeDirection || (ChangeDirection = {})); 6 | export default ChangeDirection; 7 | -------------------------------------------------------------------------------- /client/includes/NativeUI/enums/Alignment.js: -------------------------------------------------------------------------------- 1 | export var Alignment; 2 | (function (Alignment) { 3 | Alignment[Alignment["Left"] = 0] = "Left"; 4 | Alignment[Alignment["Centered"] = 1] = "Centered"; 5 | Alignment[Alignment["Right"] = 2] = "Right"; 6 | })(Alignment || (Alignment = {})); 7 | export default Alignment; 8 | -------------------------------------------------------------------------------- /client/includes/NativeUI/modules/ListItem.ts: -------------------------------------------------------------------------------- 1 | import UUIDV4 from "../utils/UUIDV4"; 2 | 3 | export default class ListItem { 4 | public readonly Id: string = UUIDV4(); 5 | 6 | public DisplayText: string; 7 | public Data: any; 8 | 9 | constructor(text: string = "", data: any = null) { 10 | this.DisplayText = text; 11 | this.Data = data; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /client/includes/NativeUI/enums/Font.js: -------------------------------------------------------------------------------- 1 | var Font; 2 | (function (Font) { 3 | Font[Font["ChaletLondon"] = 0] = "ChaletLondon"; 4 | Font[Font["HouseScript"] = 1] = "HouseScript"; 5 | Font[Font["Monospace"] = 2] = "Monospace"; 6 | Font[Font["CharletComprimeColonge"] = 4] = "CharletComprimeColonge"; 7 | Font[Font["Pricedown"] = 7] = "Pricedown"; 8 | })(Font || (Font = {})); 9 | export default Font; 10 | -------------------------------------------------------------------------------- /client/includes/NativeUI/utils/Color.js: -------------------------------------------------------------------------------- 1 | export default class Color { 2 | constructor(r, g, b, a = 255) { 3 | this.R = r; 4 | this.G = g; 5 | this.B = b; 6 | this.A = a; 7 | } 8 | } 9 | Color.Empty = new Color(0, 0, 0, 0); 10 | Color.Transparent = new Color(0, 0, 0, 0); 11 | Color.Black = new Color(0, 0, 0, 255); 12 | Color.White = new Color(255, 255, 255, 255); 13 | Color.WhiteSmoke = new Color(245, 245, 245, 255); 14 | -------------------------------------------------------------------------------- /client/includes/NativeUI/enums/BadgeStyle.ts: -------------------------------------------------------------------------------- 1 | enum BadgeStyle { 2 | None, 3 | BronzeMedal, 4 | GoldMedal, 5 | SilverMedal, 6 | Alert, 7 | Crown, 8 | Ammo, 9 | Armour, 10 | Barber, 11 | Clothes, 12 | Franklin, 13 | Bike, 14 | Car, 15 | Gun, 16 | Heart, 17 | Makeup, 18 | Mask, 19 | Michael, 20 | Star, 21 | Tatoo, 22 | Trevor, 23 | Lock, 24 | Tick, 25 | Sale, 26 | ArrowLeft, 27 | ArrowRight, 28 | Audio1, 29 | Audio2, 30 | Audio3, 31 | AudioInactive, 32 | AudioMute 33 | } 34 | 35 | export default BadgeStyle; 36 | -------------------------------------------------------------------------------- /client/includes/NativeUI/utils/LiteEvent.js: -------------------------------------------------------------------------------- 1 | export default class LiteEvent { 2 | constructor() { 3 | this.handlers = []; 4 | } 5 | on(handler) { 6 | this.handlers.push(handler); 7 | } 8 | off(handler) { 9 | this.handlers = this.handlers.filter(h => h !== handler); 10 | } 11 | emit(...args) { 12 | this.handlers.slice(0).forEach(h => h(...args)); 13 | } 14 | expose() { 15 | return this; 16 | } 17 | count() { 18 | return this.handlers.length; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /client/includes/NativeUI/utils/Color.ts: -------------------------------------------------------------------------------- 1 | export default class Color { 2 | public static Empty = new Color(0, 0, 0, 0); 3 | public static Transparent = new Color(0, 0, 0, 0); 4 | public static Black = new Color(0, 0, 0, 255); 5 | public static White = new Color(255, 255, 255, 255); 6 | public static WhiteSmoke = new Color(245, 245, 245, 255); 7 | 8 | public R: number; 9 | public G: number; 10 | public B: number; 11 | public A: number; 12 | 13 | constructor(r: number, g: number, b: number, a = 255) { 14 | this.R = r; 15 | this.G = g; 16 | this.B = b; 17 | this.A = a; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /client/includes/NativeUI/utils/UUIDV4.ts: -------------------------------------------------------------------------------- 1 | export default function UUIDV4(): string { 2 | let uuid: string = ""; 3 | let ii: number; 4 | 5 | for (ii = 0; ii < 32; ii += 1) { 6 | switch (ii) { 7 | case 8: 8 | case 20: 9 | uuid += "-"; 10 | uuid += ((Math.random() * 16) | 0).toString(16); 11 | break; 12 | case 12: 13 | uuid += "-"; 14 | uuid += "4"; 15 | break; 16 | case 16: 17 | uuid += "-"; 18 | uuid += ((Math.random() * 4) | 8).toString(16); 19 | break; 20 | default: 21 | uuid += ((Math.random() * 16) | 0).toString(16); 22 | } 23 | } 24 | return uuid; 25 | } 26 | -------------------------------------------------------------------------------- /client/includes/NativeUI/modules/InstructionalButton.js: -------------------------------------------------------------------------------- 1 | import game from 'natives'; 2 | export default class InstructionalButton { 3 | constructor(text, control, buttonString = null) { 4 | this._itemBind = null; 5 | this.Text = text; 6 | this._buttonControl = control; 7 | this._usingControls = buttonString == null; 8 | this._buttonString = buttonString; 9 | } 10 | get ItemBind() { return this._itemBind; } 11 | BindToItem(item) { 12 | this._itemBind = item; 13 | } 14 | GetButtonId() { 15 | return this._usingControls ? game.getControlInstructionalButton(2, this._buttonControl, false) : "t_" + this._buttonString; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /client/includes/NativeUI/utils/UUIDV4.js: -------------------------------------------------------------------------------- 1 | export default function UUIDV4() { 2 | let uuid = ""; 3 | let ii; 4 | for (ii = 0; ii < 32; ii += 1) { 5 | switch (ii) { 6 | case 8: 7 | case 20: 8 | uuid += "-"; 9 | uuid += ((Math.random() * 16) | 0).toString(16); 10 | break; 11 | case 12: 12 | uuid += "-"; 13 | uuid += "4"; 14 | break; 15 | case 16: 16 | uuid += "-"; 17 | uuid += ((Math.random() * 4) | 8).toString(16); 18 | break; 19 | default: 20 | uuid += ((Math.random() * 16) | 0).toString(16); 21 | } 22 | } 23 | return uuid; 24 | } 25 | -------------------------------------------------------------------------------- /client/includes/NativeUI/utils/LiteEvent.ts: -------------------------------------------------------------------------------- 1 | interface ILiteEvent { 2 | on(handler: { (...args: any[]): void }): void; 3 | off(handler: { (...args: any[]): void }): void; 4 | } 5 | 6 | export default class LiteEvent implements ILiteEvent { 7 | private handlers: { (...args: any[]): void }[] = []; 8 | 9 | public on(handler: { (...args: any[]): void }): void { 10 | this.handlers.push(handler); 11 | } 12 | 13 | public off(handler: { (...args: any[]): void }): void { 14 | this.handlers = this.handlers.filter(h => h !== handler); 15 | } 16 | 17 | public emit(...args: any[]) { 18 | this.handlers.slice(0).forEach(h => h(...args)); 19 | } 20 | 21 | public expose(): ILiteEvent { 22 | return this; 23 | } 24 | 25 | public count(): number { 26 | return this.handlers.length; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /client/includes/NativeUI/utils/Point.js: -------------------------------------------------------------------------------- 1 | export default class Point { 2 | constructor(x, y) { 3 | this.X = 0; 4 | this.Y = 0; 5 | this.X = x; 6 | this.Y = y; 7 | } 8 | static Parse(arg) { 9 | if (typeof arg === "object") { 10 | if (arg.length) { 11 | return new Point(arg[0], arg[1]); 12 | } 13 | else if (arg.X && arg.Y) { 14 | return new Point(arg.X, arg.Y); 15 | } 16 | } 17 | else if (typeof arg === "string") { 18 | if (arg.indexOf(",") !== -1) { 19 | const arr = arg.split(","); 20 | return new Point(parseFloat(arr[0]), parseFloat(arr[1])); 21 | } 22 | } 23 | return new Point(0, 0); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /client/includes/NativeUI/utils/Point.ts: -------------------------------------------------------------------------------- 1 | export default class Point { 2 | public X: number = 0; 3 | public Y: number = 0; 4 | 5 | constructor(x: number, y: number) { 6 | this.X = x; 7 | this.Y = y; 8 | } 9 | 10 | public static Parse(point: number[]): Point; 11 | public static Parse(point: { X: number; Y: number }): Point; 12 | public static Parse(arg: any): Point { 13 | if (typeof arg === "object") { 14 | if (arg.length) { 15 | // Array 16 | return new Point(arg[0], arg[1]); 17 | } else if (arg.X && arg.Y) { 18 | // Object 19 | return new Point(arg.X, arg.Y); 20 | } 21 | } else if (typeof arg === "string") { 22 | if (arg.indexOf(",") !== -1) { 23 | const arr = arg.split(","); 24 | return new Point(parseFloat(arr[0]), parseFloat(arr[1])); 25 | } 26 | } 27 | return new Point(0, 0); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /client/includes/NativeUI/modules/ItemsCollection.ts: -------------------------------------------------------------------------------- 1 | import ListItem from "../modules/ListItem"; 2 | 3 | export default class ItemsCollection { 4 | private items: ListItem[] | string[] | number[]; 5 | 6 | constructor(items: ListItem[] | string[] | number[]) { 7 | if (items.length === 0) throw new Error("ItemsCollection cannot be empty"); 8 | this.items = items; 9 | } 10 | 11 | public length() { 12 | return this.items.length; 13 | } 14 | 15 | public getListItems() { 16 | const items = []; 17 | for (const item of this.items) { 18 | if (item instanceof ListItem) { 19 | items.push(item); 20 | } else if (typeof item == "string") { 21 | items.push(new ListItem(item)); 22 | } else if (typeof item == "number") { 23 | items.push(new ListItem(item.toString())); 24 | } 25 | } 26 | return items; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /client/includes/NativeUI/modules/ItemsCollection.js: -------------------------------------------------------------------------------- 1 | import ListItem from "../modules/ListItem"; 2 | export default class ItemsCollection { 3 | constructor(items) { 4 | if (items.length === 0) 5 | throw new Error("ItemsCollection cannot be empty"); 6 | this.items = items; 7 | } 8 | length() { 9 | return this.items.length; 10 | } 11 | getListItems() { 12 | const items = []; 13 | for (const item of this.items) { 14 | if (item instanceof ListItem) { 15 | items.push(item); 16 | } 17 | else if (typeof item == "string") { 18 | items.push(new ListItem(item)); 19 | } 20 | else if (typeof item == "number") { 21 | items.push(new ListItem(item.toString())); 22 | } 23 | } 24 | return items; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /client/includes/NativeUI/modules/Rectangle.js: -------------------------------------------------------------------------------- 1 | import game from 'natives'; 2 | import Point from "../utils/Point"; 3 | import Size from "../utils/Size"; 4 | import IElement from "./IElement"; 5 | export default class Rectangle extends IElement { 6 | constructor(pos, size, color) { 7 | super(); 8 | this.Enabled = true; 9 | this.Pos = pos; 10 | this.Size = size; 11 | this.Color = color; 12 | } 13 | Draw(pos, size, color) { 14 | if (!pos) 15 | pos = new Size(0, 0); 16 | if (!size && !color) { 17 | pos = new Point(this.Pos.X + pos.Width, this.Pos.Y + pos.Height); 18 | size = this.Size; 19 | color = this.Color; 20 | } 21 | const w = size.Width / 1280.0; 22 | const h = size.Height / 720.0; 23 | const x = pos.X / 1280.0 + w * 0.5; 24 | const y = pos.Y / 720.0 + h * 0.5; 25 | game.drawRect(x, y, w, h, color.R, color.G, color.B, color.A, false); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /colors.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "metallic": [ 4 | { 5 | "id": 0, 6 | "name": "black" 7 | }, 8 | { 9 | "id": 1, 10 | "name": "white" 11 | }, 12 | { 13 | "id": 2, 14 | "name": "white" 15 | }, 16 | { 17 | "id": 3, 18 | "name": "white" 19 | }, 20 | { 21 | "id": 4, 22 | "name": "white" 23 | }, 24 | { 25 | "id": 5, 26 | "name": "white" 27 | } 28 | ], 29 | "matt": [ 30 | { 31 | "id": 0, 32 | "name": "black" 33 | }, 34 | { 35 | "id": 1, 36 | "name": "white" 37 | }, 38 | { 39 | "id": 2, 40 | "name": "white" 41 | }, 42 | { 43 | "id": 3, 44 | "name": "white" 45 | }, 46 | { 47 | "id": 4, 48 | "name": "white" 49 | }, 50 | { 51 | "id": 5, 52 | "name": "white" 53 | } 54 | ] 55 | } 56 | -------------------------------------------------------------------------------- /client/includes/NativeUI/modules/Rectangle.ts: -------------------------------------------------------------------------------- 1 | import game from 'natives'; 2 | import Color from "../utils/Color"; 3 | import Point from "../utils/Point"; 4 | import Size from "../utils/Size"; 5 | import IElement from "./IElement"; 6 | 7 | export default class Rectangle extends IElement { 8 | public Pos: Point; 9 | public Size: Size; 10 | public Color: Color; 11 | 12 | constructor(pos: Point, size: Size, color: Color) { 13 | super(); 14 | this.Enabled = true; 15 | this.Pos = pos; 16 | this.Size = size; 17 | this.Color = color; 18 | } 19 | 20 | public Draw(pos: Point | Size, size: Size, color: Color) { 21 | if (!pos) pos = new Size(0, 0); 22 | if (!size && !color) { 23 | pos = new Point(this.Pos.X + (pos as Size).Width, this.Pos.Y + (pos as Size).Height); 24 | size = this.Size; 25 | color = this.Color; 26 | } 27 | const w = size.Width / 1280.0; 28 | const h = size.Height / 720.0; 29 | const x = (pos as Point).X / 1280.0 + w * 0.5; 30 | const y = (pos as Point).Y / 720.0 + h * 0.5; 31 | 32 | game.drawRect(x, y, w, h, color.R, color.G, color.B, color.A, false); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /client/includes/NativeUI/modules/ResRectangle.js: -------------------------------------------------------------------------------- 1 | import game from 'natives'; 2 | import Point from "../utils/Point"; 3 | import Size from "../utils/Size"; 4 | import Rectangle from "./Rectangle"; 5 | import Screen from "../utils/Screen"; 6 | export default class ResRectangle extends Rectangle { 7 | constructor(pos, size, color) { 8 | super(pos, size, color); 9 | } 10 | Draw(pos, size, color) { 11 | if (!pos) 12 | pos = new Size(); 13 | if (pos && !size && !color) { 14 | pos = new Point(this.Pos.X + pos.Width, this.Pos.Y + pos.Height); 15 | size = this.Size; 16 | color = this.Color; 17 | } 18 | const screenw = Screen.Width; 19 | const screenh = Screen.Height; 20 | const height = 1080.0; 21 | const ratio = screenw / screenh; 22 | const width = height * ratio; 23 | const w = size.Width / width; 24 | const h = size.Height / height; 25 | const x = pos.X / width + w * 0.5; 26 | const y = pos.Y / height + h * 0.5; 27 | game.drawRect(x, y, w, h, color.R, color.G, color.B, color.A, false); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /client/includes/NativeUI/modules/Container.js: -------------------------------------------------------------------------------- 1 | import game from 'natives'; 2 | import Size from "../utils/Size"; 3 | import Rectangle from "./Rectangle"; 4 | import Screen from "../utils/Screen"; 5 | export default class Container extends Rectangle { 6 | constructor(pos, size, color) { 7 | super(pos, size, color); 8 | this.Items = []; 9 | } 10 | addItem(item) { 11 | this.Items.push(item); 12 | } 13 | Draw(offset) { 14 | if (!this.Enabled) 15 | return; 16 | offset = offset || new Size(); 17 | const screenw = Screen.Width; 18 | const screenh = Screen.Height; 19 | const height = 1080.0; 20 | const ratio = screenw / screenh; 21 | const width = height * ratio; 22 | const w = this.Size.Width / width; 23 | const h = this.Size.Height / height; 24 | const x = (this.Pos.X + offset.Width) / width + w * 0.5; 25 | const y = (this.Pos.Y + offset.Height) / height + h * 0.5; 26 | game.drawRect(x, y, w, h, this.Color.R, this.Color.G, this.Color.B, this.Color.A, false); 27 | for (var item of this.Items) 28 | item.Draw(new Size(this.Pos.X + offset.Width, this.Pos.Y + offset.Height)); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /client/includes/NativeUI/modules/MidsizedMessage.js: -------------------------------------------------------------------------------- 1 | import * as alt from 'alt-client'; 2 | import Message from './Message'; 3 | export default class MidsizedMessage extends Message { 4 | static Initialize(scaleForm, transitionOutAnimName) { 5 | super.Initialize(scaleForm, transitionOutAnimName); 6 | alt.everyTick(() => this.Render()); 7 | } 8 | static ShowMidsizedMessage(title, message = "", time = 5000) { 9 | this.ShowCustomShard("SHOW_MIDSIZED_MESSAGE", time, title, message); 10 | } 11 | static ShowBridgesKnivesProgress(title, totalToDo, message, info, completed, time = 5000) { 12 | this.ShowCustomShard("SHOW_BRIDGES_KNIVES_PROGRESS", time, title, totalToDo, message, info, completed); 13 | } 14 | static ShowCondensedShardMessage(title, message, bgColor, useDarkerShard, time = 5000) { 15 | this.ShowCustomShard("SHOW_COND_SHARD_MESSAGE", time, title, message, bgColor, useDarkerShard); 16 | } 17 | static ShowMidsizedShardMessage(title, message, bgColor, useDarkerShard, useCondensedShard, time = 5000) { 18 | this.ShowCustomShard("SHOW_SHARD_MIDSIZED_MESSAGE", time, title, message, bgColor, useDarkerShard, useCondensedShard); 19 | } 20 | } 21 | MidsizedMessage.Initialize("MIDSIZED_MESSAGE", "SHARD_ANIM_OUT"); 22 | -------------------------------------------------------------------------------- /client/includes/NativeUI/modules/ResRectangle.ts: -------------------------------------------------------------------------------- 1 | import game from 'natives'; 2 | import Point from "../utils/Point"; 3 | import Size from "../utils/Size"; 4 | import Rectangle from "./Rectangle"; 5 | import Screen from "../utils/Screen"; 6 | import Color from '../utils/Color'; 7 | 8 | export default class ResRectangle extends Rectangle { 9 | constructor(pos: Point, size: Size, color: Color) { 10 | super(pos, size, color); 11 | } 12 | 13 | public Draw(): void; 14 | public Draw(offset: any): void; 15 | public Draw(pos: Point | Size, size: Size, color: Color): void; 16 | 17 | public Draw(pos?: Point | Size, size?: Size, color?: Color) { 18 | if (!pos) pos = new Size(); 19 | if (pos && !size && !color) { 20 | pos = new Point(this.Pos.X + (pos as Size).Width, this.Pos.Y + (pos as Size).Height); 21 | size = this.Size; 22 | color = this.Color; 23 | } 24 | 25 | const screenw = Screen.Width; 26 | const screenh = Screen.Height; 27 | const height = 1080.0; 28 | const ratio = screenw / screenh; 29 | const width = height * ratio; 30 | 31 | const w = size.Width / width; 32 | const h = size.Height / height; 33 | const x = (pos as Point).X / width + w * 0.5; 34 | const y = (pos as Point).Y / height + h * 0.5; 35 | 36 | game.drawRect(x, y, w, h, color.R, color.G, color.B, color.A, false); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /client/includes/NativeUI/modules/Container.ts: -------------------------------------------------------------------------------- 1 | import game from 'natives'; 2 | import Size from "../utils/Size"; 3 | import Rectangle from "./Rectangle"; 4 | import Screen from "../utils/Screen"; 5 | import Point from '../utils/Point'; 6 | import Color from '../utils/Color'; 7 | 8 | export default class Container extends Rectangle { 9 | public Items: any[]; 10 | 11 | constructor(pos: Point, size: Size, color: Color) { 12 | super(pos, size, color); 13 | this.Items = []; 14 | } 15 | 16 | addItem(item: any) { 17 | this.Items.push(item); 18 | } 19 | 20 | Draw(offset?: Size) { 21 | if (!this.Enabled) return; 22 | offset = offset || new Size(); 23 | const screenw = Screen.Width; 24 | const screenh = Screen.Height; 25 | const height = 1080.0; 26 | const ratio = screenw / screenh; 27 | const width = height * ratio; 28 | 29 | const w = this.Size.Width / width; 30 | const h = this.Size.Height / height; 31 | const x = (this.Pos.X + offset.Width) / width + w * 0.5; 32 | const y = (this.Pos.Y + offset.Height) / height + h * 0.5; 33 | 34 | game.drawRect(x, y, w, h, this.Color.R, this.Color.G, this.Color.B, this.Color.A, false); 35 | 36 | for (var item of this.Items) 37 | item.Draw(new Size(this.Pos.X + offset.Width, this.Pos.Y + offset.Height)); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /client/includes/NativeUI/modules/MidsizedMessage.ts: -------------------------------------------------------------------------------- 1 | import * as alt from 'alt-client'; 2 | import HudColor from '../enums/HudColor'; 3 | import Message from './Message'; 4 | 5 | export default class MidsizedMessage extends Message { 6 | public static Initialize(scaleForm: string, transitionOutAnimName: string) { 7 | super.Initialize(scaleForm, transitionOutAnimName); 8 | alt.everyTick(() => this.Render()); 9 | } 10 | 11 | public static ShowMidsizedMessage(title: string, message: string = "", time: number = 5000): void { 12 | this.ShowCustomShard("SHOW_MIDSIZED_MESSAGE", time, title, message); 13 | } 14 | 15 | public static ShowBridgesKnivesProgress(title: string, totalToDo: number, message: string, info: string, completed: number, time: number = 5000): void { 16 | this.ShowCustomShard("SHOW_BRIDGES_KNIVES_PROGRESS", time, title, totalToDo, message, info, completed); 17 | } 18 | 19 | public static ShowCondensedShardMessage(title: string, message: string, bgColor: HudColor, useDarkerShard: boolean, time: number = 5000): void { 20 | this.ShowCustomShard("SHOW_COND_SHARD_MESSAGE", time, title, message, bgColor, useDarkerShard); 21 | } 22 | 23 | public static ShowMidsizedShardMessage(title: string, message: string, bgColor: HudColor, useDarkerShard: boolean, useCondensedShard: boolean, time: number = 5000): void { 24 | this.ShowCustomShard("SHOW_SHARD_MIDSIZED_MESSAGE", time, title, message, bgColor, useDarkerShard, useCondensedShard); 25 | } 26 | } 27 | MidsizedMessage.Initialize("MIDSIZED_MESSAGE", "SHARD_ANIM_OUT"); -------------------------------------------------------------------------------- /client/includes/NativeUI/modules/InstructionalButton.ts: -------------------------------------------------------------------------------- 1 | import game from 'natives'; 2 | import UIMenuItem from "../items/UIMenuItem"; 3 | import Control from '../enums/Control'; 4 | 5 | export default class InstructionalButton { 6 | public Text: string; 7 | public get ItemBind(): UIMenuItem { return this._itemBind; } 8 | 9 | private _itemBind: UIMenuItem = null; 10 | private readonly _buttonString: string; 11 | private readonly _buttonControl: Control; 12 | private readonly _usingControls: boolean; 13 | 14 | /* 15 | * Add a dynamic button to the instructional buttons array. 16 | * Changes whether the controller is being used and changes depending on keybinds. 17 | * @param control GTA.Control that gets converted into a button. 18 | * @param keystring Custom keyboard button, like "I", or "O", or "F5". 19 | * @param text Help text that goes with the button. 20 | */ 21 | constructor(text: string, control: Control, buttonString: string = null) { 22 | this.Text = text; 23 | this._buttonControl = control; 24 | this._usingControls = buttonString == null; 25 | this._buttonString = buttonString; 26 | } 27 | 28 | /* 29 | * Bind this button to an item, so it's only shown when that item is selected. 30 | * @param item Item to bind to. 31 | */ 32 | public BindToItem(item: UIMenuItem): void { 33 | this._itemBind = item; 34 | } 35 | 36 | public GetButtonId(): string { 37 | return this._usingControls ? game.getControlInstructionalButton(2, this._buttonControl as number, false) : "t_" + this._buttonString; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # alt:V Vehicle Transport Script 2 | Script for Transporting Vehicles. For these this script allows you to use a Vehicle-Trailer. Flatbed and others coming soon. 3 | 4 | Credits to 5 | [DurtyFree](https://github.com/DurtyFree/alt-V-NativeUI) and [datWeazel](https://github.com/datWeazel/alt-V-NativeUI). 6 | 7 | ## Installation: 8 | **** 9 | 1. Copy the main folder in your Alt:V ressources dirtonary. 10 | 2. add the resoure to your server.cfg: 11 | 12 | ## Usage Trailer: 13 | **** 14 | 1. Spawn the Trailer by the name 'tr2' 15 | 2. Press G if you are near to a Trailer 16 | 3. use teh Raise/Lower menu to control the ramps 17 | 4. use Attach to attach the veh on the lower floor or the upper floor in the front 18 | 5. use Attach Upper Middle to attach the veh in the Upper Middle 19 | 6. use Attach Upper End to attach the veh in the Upper End 20 | 21 | ## Usage Flatbed: 22 | **** 23 | 1. Spawn the Flatbed by the name 'flatbed' 24 | 2. Press G if you are in a Flatbed 25 | 3. if there is no Vehicle on the Flatbed leave the Flatbed and keep the menu open 26 | 4. go to the Target Vehicel and press "Enter" 27 | 5. Confirm the selected Vehicle switch the list item to "Yes" and press "Enter" 28 | 6. To unload the Vehicle just go in the Flatbed with the vehicle and press G 29 | 7. now select where you want to unload the Vehicle (Ground or Truck Bed) and press Enter 30 | 31 | ## Credits: 32 | **** 33 | - NativeUI: [DurtyFree](https://github.com/DurtyFree/alt-V-NativeUI) / [datWeazel](https://github.com/datWeazel/alt-V-NativeUI) 34 | 35 | ## Changes: 36 | **** 37 | - V2.0.0
38 | => Key to open menu is now "G"
39 | => Addet Flatbed as Transport Vehicle 40 | -------------------------------------------------------------------------------- /client/includes/NativeUI/enums/BadgeStyle.js: -------------------------------------------------------------------------------- 1 | var BadgeStyle; 2 | (function (BadgeStyle) { 3 | BadgeStyle[BadgeStyle["None"] = 0] = "None"; 4 | BadgeStyle[BadgeStyle["BronzeMedal"] = 1] = "BronzeMedal"; 5 | BadgeStyle[BadgeStyle["GoldMedal"] = 2] = "GoldMedal"; 6 | BadgeStyle[BadgeStyle["SilverMedal"] = 3] = "SilverMedal"; 7 | BadgeStyle[BadgeStyle["Alert"] = 4] = "Alert"; 8 | BadgeStyle[BadgeStyle["Crown"] = 5] = "Crown"; 9 | BadgeStyle[BadgeStyle["Ammo"] = 6] = "Ammo"; 10 | BadgeStyle[BadgeStyle["Armour"] = 7] = "Armour"; 11 | BadgeStyle[BadgeStyle["Barber"] = 8] = "Barber"; 12 | BadgeStyle[BadgeStyle["Clothes"] = 9] = "Clothes"; 13 | BadgeStyle[BadgeStyle["Franklin"] = 10] = "Franklin"; 14 | BadgeStyle[BadgeStyle["Bike"] = 11] = "Bike"; 15 | BadgeStyle[BadgeStyle["Car"] = 12] = "Car"; 16 | BadgeStyle[BadgeStyle["Gun"] = 13] = "Gun"; 17 | BadgeStyle[BadgeStyle["Heart"] = 14] = "Heart"; 18 | BadgeStyle[BadgeStyle["Makeup"] = 15] = "Makeup"; 19 | BadgeStyle[BadgeStyle["Mask"] = 16] = "Mask"; 20 | BadgeStyle[BadgeStyle["Michael"] = 17] = "Michael"; 21 | BadgeStyle[BadgeStyle["Star"] = 18] = "Star"; 22 | BadgeStyle[BadgeStyle["Tatoo"] = 19] = "Tatoo"; 23 | BadgeStyle[BadgeStyle["Trevor"] = 20] = "Trevor"; 24 | BadgeStyle[BadgeStyle["Lock"] = 21] = "Lock"; 25 | BadgeStyle[BadgeStyle["Tick"] = 22] = "Tick"; 26 | BadgeStyle[BadgeStyle["Sale"] = 23] = "Sale"; 27 | BadgeStyle[BadgeStyle["ArrowLeft"] = 24] = "ArrowLeft"; 28 | BadgeStyle[BadgeStyle["ArrowRight"] = 25] = "ArrowRight"; 29 | BadgeStyle[BadgeStyle["Audio1"] = 26] = "Audio1"; 30 | BadgeStyle[BadgeStyle["Audio2"] = 27] = "Audio2"; 31 | BadgeStyle[BadgeStyle["Audio3"] = 28] = "Audio3"; 32 | BadgeStyle[BadgeStyle["AudioInactive"] = 29] = "AudioInactive"; 33 | BadgeStyle[BadgeStyle["AudioMute"] = 30] = "AudioMute"; 34 | })(BadgeStyle || (BadgeStyle = {})); 35 | export default BadgeStyle; 36 | -------------------------------------------------------------------------------- /client/includes/NativeUI/items/UIMenuCheckboxItem.js: -------------------------------------------------------------------------------- 1 | import Sprite from "../modules/Sprite"; 2 | import Color from "../utils/Color"; 3 | import Point from "../utils/Point"; 4 | import Size from "../utils/Size"; 5 | import UIMenuItem from "./UIMenuItem"; 6 | export default class UIMenuCheckboxItem extends UIMenuItem { 7 | constructor(text, check = false, description = "") { 8 | super(text, description); 9 | this.Checked = false; 10 | const y = 0; 11 | this._checkedSprite = new Sprite("commonmenu", "shop_box_blank", new Point(410, y + 95), new Size(50, 50)); 12 | this.Checked = check; 13 | } 14 | SetVerticalPosition(y) { 15 | super.SetVerticalPosition(y); 16 | this._checkedSprite.Pos = new Point(380 + this.Offset.X + this.Parent.WidthOffset, y + 138 + this.Offset.Y); 17 | } 18 | Draw() { 19 | super.Draw(); 20 | this._checkedSprite.Pos = this._checkedSprite.Pos = new Point(380 + this.Offset.X + this.Parent.WidthOffset, this._checkedSprite.Pos.Y); 21 | const isDefaultHightlitedForeColor = this.HighlightedForeColor == UIMenuItem.DefaultHighlightedForeColor; 22 | if (this.Selected && isDefaultHightlitedForeColor) { 23 | this._checkedSprite.TextureName = this.Checked 24 | ? "shop_box_tickb" 25 | : "shop_box_blankb"; 26 | } 27 | else { 28 | this._checkedSprite.TextureName = this.Checked 29 | ? "shop_box_tick" 30 | : "shop_box_blank"; 31 | } 32 | this._checkedSprite.Color = this.Enabled 33 | ? this.Selected && !isDefaultHightlitedForeColor 34 | ? this.HighlightedForeColor 35 | : this.ForeColor 36 | : new Color(163, 159, 148); 37 | this._checkedSprite.Draw(); 38 | } 39 | SetRightBadge(badge) { 40 | return this; 41 | } 42 | SetRightLabel(text) { 43 | return this; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /client/includes/NativeUI/modules/Text.js: -------------------------------------------------------------------------------- 1 | import game from 'natives'; 2 | import Color from "../utils/Color"; 3 | import Point from "../utils/Point"; 4 | import IElement from "./IElement"; 5 | export default class Text extends IElement { 6 | constructor(caption, pos, scale, color, font, centered) { 7 | super(); 8 | this.Caption = caption; 9 | this.Pos = pos; 10 | this.Scale = scale; 11 | this.Color = color || new Color(255, 255, 255, 255); 12 | this.Font = font || 0; 13 | this.Centered = centered || false; 14 | } 15 | Draw(caption, pos, scale, color, font, centered) { 16 | if (caption && !pos && !scale && !color && !font && !centered) { 17 | pos = new Point(this.Pos.X + caption.Width, this.Pos.Y + caption.Height); 18 | scale = this.Scale; 19 | color = this.Color; 20 | font = this.Font; 21 | centered = this.Centered; 22 | } 23 | const x = pos.X / 1280.0; 24 | const y = pos.Y / 720.0; 25 | game.setTextFont(parseInt(font)); 26 | game.setTextScale(scale, scale); 27 | game.setTextColour(color.R, color.G, color.B, color.A); 28 | game.setTextCentre(centered); 29 | game.beginTextCommandDisplayText("STRING"); 30 | Text.AddLongString(caption); 31 | game.endTextCommandDisplayText(x, y, 0); 32 | } 33 | static AddLongString(text) { 34 | if (!text.length) 35 | return; 36 | const maxStringLength = 99; 37 | for (let i = 0, position; i < text.length; i += maxStringLength) { 38 | let currentText = text.substr(i, i + maxStringLength); 39 | let currentIndex = i; 40 | if ((currentText.match(/~/g) || []).length % 2 !== 0) { 41 | position = currentText.lastIndexOf('~'); 42 | i -= (maxStringLength - position); 43 | } 44 | else { 45 | position = Math.min(maxStringLength, text.length - currentIndex); 46 | } 47 | game.addTextComponentSubstringPlayerName(text.substr(currentIndex, position)); 48 | } 49 | } 50 | } 51 | export { Text }; 52 | -------------------------------------------------------------------------------- /client/includes/NativeUI/modules/BigMessage.js: -------------------------------------------------------------------------------- 1 | import * as alt from 'alt-client'; 2 | import Message from './Message'; 3 | export default class BigMessage extends Message { 4 | static Initialize(scaleForm, transitionOutAnimName) { 5 | super.Initialize(scaleForm, transitionOutAnimName); 6 | alt.everyTick(() => this.Render()); 7 | } 8 | static ShowMissionPassedMessage(msg, subtitle = "", time = 5000) { 9 | this.ShowCustomShard("SHOW_MISSION_PASSED_MESSAGE", time, msg, subtitle, 100, true, 0, true); 10 | } 11 | static ShowColoredShard(msg, desc, textColor, bgColor, time = 5000) { 12 | this.ShowCustomShard("SHOW_SHARD_CENTERED_MP_MESSAGE", time, msg, desc, bgColor, textColor); 13 | } 14 | static ShowOldMessage(msg, time = 5000) { 15 | this.ShowCustomShard("SHOW_MISSION_PASSED_MESSAGE", time, msg); 16 | } 17 | static ShowSimpleShard(title, subtitle = "", time = 5000) { 18 | this.ShowCustomShard("SHOW_SHARD_CREW_RANKUP_MP_MESSAGE", time, title, subtitle); 19 | } 20 | static ShowRankupMessage(msg, subtitle, rank, time = 5000) { 21 | this.ShowCustomShard("SHOW_BIG_MP_MESSAGE", time, msg, subtitle, rank, "", ""); 22 | } 23 | static ShowPlaneMessage(title, planeName, planeHash, time = 5000) { 24 | this.ShowCustomShard("SHOW_PLANE_MESSAGE", time, title, planeName, planeHash, "", ""); 25 | } 26 | static ShowWeaponPurchasedMessage(bigMessage, weaponName, weaponHash, time = 5000) { 27 | this.ShowCustomShard("SHOW_WEAPON_PURCHASED", time, bigMessage, weaponName, weaponHash, "", 100); 28 | } 29 | static ShowWastedMessage(title, message, color, darkenBackground, time = 5000) { 30 | this.ShowCustomShard("SHOW_SHARD_WASTED_MP_MESSAGE", time, title, message, color, darkenBackground); 31 | } 32 | static ShowMpMessageLarge(msg, subtitle = "", time = 5000) { 33 | this.ShowComplexCustomShard(() => { 34 | this.Scaleform.callFunction("SHOW_CENTERED_MP_MESSAGE_LARGE", msg, subtitle, 100, true, 100); 35 | this.Scaleform.callFunction("TRANSITION_IN"); 36 | }, time); 37 | } 38 | } 39 | BigMessage.Initialize("MP_BIG_MESSAGE_FREEMODE", "TRANSITION_OUT"); 40 | -------------------------------------------------------------------------------- /server/server.js: -------------------------------------------------------------------------------- 1 | import * as alt from "alt-server"; 2 | 3 | const flatbeds = [] 4 | 5 | alt.onClient('send:trailer', (player, closestVehicle) => { 6 | alt.onClient('get:trailer', (player) => { 7 | alt.emitClient(player, 'send:trailer', closestVehicle) 8 | }); 9 | }); 10 | 11 | alt.onClient('send:trailer', (player, closestVehicle) => { 12 | alt.onClient('get:trailer2', (player) => { 13 | alt.emitClient(player, 'send:trailer2', closestVehicle) 14 | }); 15 | }); 16 | 17 | alt.onClient('send:trailer', (player, closestVehicle) => { 18 | alt.onClient('get:trailer3', (player) => { 19 | alt.emitClient(player, 'send:trailer3', closestVehicle) 20 | }); 21 | }); 22 | 23 | alt.onClient('getDoorState', (player, veh, door) =>{ 24 | let doorState = veh.getDoorState(door); 25 | alt.emitClient(player, 'send:doorstate', doorState); 26 | }); 27 | 28 | alt.onClient('ramp', (player, veh) =>{ 29 | let doorState = veh.getDoorState(1) 30 | if(doorState == 0){ 31 | veh.setDoorState(5, 7); 32 | } else if(doorState == 7){ 33 | veh.setDoorState(5, 0); 34 | } 35 | }); 36 | 37 | alt.onClient('uppr', (player, veh) =>{ 38 | let doorState = veh.getDoorState(0) 39 | if(doorState == 0){ 40 | veh.setDoorState(4, 7); 41 | } else if(doorState == 7){ 42 | veh.setDoorState(4, 2); 43 | alt.setTimeout(() => { 44 | veh.setDoorState(4, 0); 45 | }, 1000); 46 | } 47 | }); 48 | 49 | alt.onClient('getNumberPlateText', (player, veh) =>{ 50 | let numberPlateText = veh.numberPlateText 51 | alt.emitClient(player, 'sendNumberPlateIndex', veh, numberPlateText); 52 | }); 53 | 54 | alt.onClient('flat:save', (player, tow, flat) => { 55 | flatbeds.push({savedtow: tow, savedflat: flat}); 56 | console.log(flatbeds); 57 | }); 58 | 59 | 60 | alt.onClient('flat:load', (player) => { 61 | alt.emitClient(player, 'flat:loadet', flatbeds) 62 | }); 63 | 64 | alt.onClient('flat:del', (player, flat) => { 65 | let i = 0; 66 | flatbeds.forEach(e => { 67 | if(e['savedflat'] == flat){ 68 | flatbeds.splice(i, 1); 69 | console.log(flatbeds) 70 | } 71 | }); 72 | }); 73 | -------------------------------------------------------------------------------- /client/includes/NativeUI/items/UIMenuCheckboxItem.ts: -------------------------------------------------------------------------------- 1 | import BadgeStyle from "../enums/BadgeStyle"; 2 | import Sprite from "../modules/Sprite"; 3 | import Color from "../utils/Color"; 4 | import Point from "../utils/Point"; 5 | import Size from "../utils/Size"; 6 | import UIMenuItem from "./UIMenuItem"; 7 | 8 | export default class UIMenuCheckboxItem extends UIMenuItem { 9 | private readonly _checkedSprite: Sprite; 10 | 11 | public Checked: boolean = false; 12 | 13 | constructor(text: string, check: boolean = false, description: string = "") { 14 | super(text, description); 15 | 16 | const y = 0; 17 | this._checkedSprite = new Sprite("commonmenu", "shop_box_blank", new Point(410, y + 95), new Size(50, 50)); 18 | this.Checked = check; 19 | } 20 | 21 | public SetVerticalPosition(y: number) { 22 | super.SetVerticalPosition(y); 23 | this._checkedSprite.Pos = new Point(380 + this.Offset.X + this.Parent.WidthOffset, y + 138 + this.Offset.Y); 24 | } 25 | 26 | public Draw() { 27 | super.Draw(); 28 | 29 | this._checkedSprite.Pos = this._checkedSprite.Pos = new Point(380 + this.Offset.X + this.Parent.WidthOffset, this._checkedSprite.Pos.Y); 30 | const isDefaultHightlitedForeColor = this.HighlightedForeColor == UIMenuItem.DefaultHighlightedForeColor; 31 | 32 | if (this.Selected && isDefaultHightlitedForeColor) { 33 | this._checkedSprite.TextureName = this.Checked 34 | ? "shop_box_tickb" 35 | : "shop_box_blankb"; 36 | } else { 37 | this._checkedSprite.TextureName = this.Checked 38 | ? "shop_box_tick" 39 | : "shop_box_blank"; 40 | } 41 | 42 | this._checkedSprite.Color = this.Enabled 43 | ? this.Selected && !isDefaultHightlitedForeColor 44 | ? this.HighlightedForeColor 45 | : this.ForeColor 46 | : new Color(163, 159, 148); 47 | this._checkedSprite.Draw(); 48 | } 49 | 50 | public SetRightBadge(badge: BadgeStyle) { 51 | return this; 52 | } 53 | 54 | public SetRightLabel(text: string) { 55 | return this; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /client/includes/NativeUI/utils/Screen.js: -------------------------------------------------------------------------------- 1 | import * as alt from 'alt-client'; 2 | import game from 'natives'; 3 | import Size from "./Size"; 4 | import Text from '../modules/Text'; 5 | const gameScreen = game.getActiveScreenResolution(0, 0); 6 | export default class Screen { 7 | static get ResolutionMaintainRatio() { 8 | const ratio = Screen.Width / Screen.Height; 9 | const width = 1080.0 * ratio; 10 | return new Size(width, 1080.0); 11 | } 12 | static MousePosition(relative = false) { 13 | const res = Screen.ResolutionMaintainRatio; 14 | const cursor = alt.getCursorPos(); 15 | let [mouseX, mouseY] = [cursor.x, cursor.y]; 16 | if (relative) 17 | [mouseX, mouseY] = [cursor.x / res.Width, cursor.y / res.Height]; 18 | return { 19 | X: mouseX, 20 | Y: mouseY 21 | }; 22 | } 23 | static IsMouseInBounds(topLeft, boxSize) { 24 | const mousePosition = Screen.MousePosition(); 25 | return (mousePosition.X >= topLeft.X && 26 | mousePosition.X <= topLeft.X + boxSize.Width && 27 | (mousePosition.Y > topLeft.Y && mousePosition.Y < topLeft.Y + boxSize.Height)); 28 | } 29 | static GetTextWidth(text, font, scale) { 30 | game.beginTextCommandGetWidth("CELL_EMAIL_BCON"); 31 | Text.AddLongString(text); 32 | game.setTextFont(font); 33 | game.setTextScale(1.0, scale); 34 | const width = game.endTextCommandGetWidth(true); 35 | const res = Screen.ResolutionMaintainRatio; 36 | return res.Width * width; 37 | } 38 | static GetLineCount(text, position, font, scale, wrap) { 39 | game.beginTextCommandLineCount("CELL_EMAIL_BCON"); 40 | Text.AddLongString(text); 41 | const res = Screen.ResolutionMaintainRatio; 42 | const x = position.X / res.Width; 43 | const y = position.Y / res.Height; 44 | game.setTextFont(font); 45 | game.setTextScale(1.0, scale); 46 | if (wrap > 0) { 47 | const start = position.X / res.Width; 48 | const end = start + (wrap / res.Width); 49 | game.setTextWrap(x, end); 50 | } 51 | let lineCount = game.endTextCommandLineCount(x, y); 52 | return lineCount; 53 | } 54 | } 55 | Screen.Width = gameScreen[1]; 56 | Screen.Height = gameScreen[2]; 57 | -------------------------------------------------------------------------------- /client/includes/NativeUI/modules/Sprite.js: -------------------------------------------------------------------------------- 1 | import * as alt from 'alt-client'; 2 | import game from 'natives'; 3 | import Color from "../utils/Color"; 4 | import Screen from "../utils/Screen"; 5 | export default class Sprite { 6 | constructor(textureDict, textureName, pos, size, heading = 0, color = new Color(255, 255, 255)) { 7 | this.TextureDict = textureDict; 8 | this.TextureName = textureName; 9 | this.Pos = pos; 10 | this.Size = size; 11 | this.Heading = heading; 12 | this.Color = color; 13 | this.Visible = true; 14 | } 15 | LoadTextureDictionary() { 16 | this.requestTextureDictPromise(this._textureDict).then((succ) => { }); 17 | } 18 | requestTextureDictPromise(textureDict) { 19 | return new Promise((resolve, reject) => { 20 | game.requestStreamedTextureDict(textureDict, true); 21 | let inter = alt.setInterval(() => { 22 | if (game.hasStreamedTextureDictLoaded(textureDict)) { 23 | alt.clearInterval(inter); 24 | return resolve(true); 25 | } 26 | }, 10); 27 | }); 28 | } 29 | set TextureDict(v) { 30 | this._textureDict = v; 31 | if (!this.IsTextureDictionaryLoaded) 32 | this.LoadTextureDictionary(); 33 | } 34 | get TextureDict() { 35 | return this._textureDict; 36 | } 37 | get IsTextureDictionaryLoaded() { 38 | return game.hasStreamedTextureDictLoaded(this._textureDict); 39 | } 40 | Draw(textureDictionary, textureName, pos, size, heading, color, loadTexture) { 41 | textureDictionary = textureDictionary || this.TextureDict; 42 | textureName = textureName || this.TextureName; 43 | pos = pos || this.Pos; 44 | size = size || this.Size; 45 | heading = heading || this.Heading; 46 | color = color || this.Color; 47 | loadTexture = loadTexture || true; 48 | if (loadTexture) { 49 | if (!game.hasStreamedTextureDictLoaded(textureDictionary)) 50 | game.requestStreamedTextureDict(textureDictionary, true); 51 | } 52 | const screenw = Screen.Width; 53 | const screenh = Screen.Height; 54 | const height = 1080.0; 55 | const ratio = screenw / screenh; 56 | const width = height * ratio; 57 | const w = this.Size.Width / width; 58 | const h = this.Size.Height / height; 59 | const x = this.Pos.X / width + w * 0.5; 60 | const y = this.Pos.Y / height + h * 0.5; 61 | game.drawSprite(textureDictionary, textureName, x, y, w, h, heading, color.R, color.G, color.B, color.A, true); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /client/includes/NativeUI/modules/BigMessage.ts: -------------------------------------------------------------------------------- 1 | import * as alt from 'alt-client'; 2 | import HudColor from '../enums/HudColor'; 3 | import Message from './Message'; 4 | 5 | export default class BigMessage extends Message { 6 | public static Initialize(scaleForm: string, transitionOutAnimName: string) { 7 | super.Initialize(scaleForm, transitionOutAnimName); 8 | alt.everyTick(() => this.Render()); 9 | } 10 | 11 | public static ShowMissionPassedMessage(msg: string, subtitle: string = "", time: number = 5000): void { 12 | this.ShowCustomShard("SHOW_MISSION_PASSED_MESSAGE", time, msg, subtitle, 100, true, 0, true); 13 | } 14 | 15 | public static ShowColoredShard(msg: string, desc: string, textColor: HudColor, bgColor: HudColor, time: number = 5000): void { 16 | this.ShowCustomShard("SHOW_SHARD_CENTERED_MP_MESSAGE", time, msg, desc, bgColor as number, textColor as number); 17 | } 18 | 19 | public static ShowOldMessage(msg: string, time: number = 5000): void { 20 | this.ShowCustomShard("SHOW_MISSION_PASSED_MESSAGE", time, msg); 21 | } 22 | 23 | public static ShowSimpleShard(title: string, subtitle: string = "", time: number = 5000): void { 24 | this.ShowCustomShard("SHOW_SHARD_CREW_RANKUP_MP_MESSAGE", time, title, subtitle); 25 | } 26 | 27 | public static ShowRankupMessage(msg: string, subtitle: string, rank: number, time: number = 5000): void { 28 | this.ShowCustomShard("SHOW_BIG_MP_MESSAGE", time, msg, subtitle, rank, "", ""); 29 | } 30 | 31 | public static ShowPlaneMessage(title: string, planeName: string, planeHash: number, time: number = 5000): void { 32 | this.ShowCustomShard("SHOW_PLANE_MESSAGE", time, title, planeName, planeHash, "", ""); 33 | } 34 | 35 | public static ShowWeaponPurchasedMessage(bigMessage: string, weaponName: string, weaponHash: number, time: number = 5000): void { 36 | this.ShowCustomShard("SHOW_WEAPON_PURCHASED", time, bigMessage, weaponName, weaponHash, "", 100); 37 | } 38 | 39 | public static ShowWastedMessage(title: string, message: string, color: HudColor, darkenBackground: boolean, time: number = 5000): void { 40 | this.ShowCustomShard("SHOW_SHARD_WASTED_MP_MESSAGE", time, title, message, color as number, darkenBackground); 41 | } 42 | 43 | public static ShowMpMessageLarge(msg: string, subtitle: string = "", time: number = 5000): void { 44 | this.ShowComplexCustomShard(() => { 45 | this.Scaleform.callFunction("SHOW_CENTERED_MP_MESSAGE_LARGE", msg, subtitle, 100, true, 100); 46 | this.Scaleform.callFunction("TRANSITION_IN"); 47 | }, time); 48 | } 49 | } 50 | BigMessage.Initialize("MP_BIG_MESSAGE_FREEMODE", "TRANSITION_OUT"); -------------------------------------------------------------------------------- /client/includes/NativeUI/utils/Scaleform.js: -------------------------------------------------------------------------------- 1 | import * as alt from 'alt-client'; 2 | import * as game from 'natives'; 3 | export default class Scaleform { 4 | constructor(scaleForm) { 5 | this._handle = 0; 6 | this.scaleForm = scaleForm; 7 | this._handle = game.requestScaleformMovie(this.scaleForm); 8 | } 9 | get handle() { 10 | return this._handle; 11 | } 12 | get isValid() { 13 | return this._handle != 0; 14 | } 15 | get isLoaded() { 16 | return game.hasScaleformMovieLoaded(this._handle); 17 | } 18 | callFunctionHead(funcName, ...args) { 19 | if (!this.isValid || !this.isLoaded) 20 | return; 21 | game.beginScaleformMovieMethod(this._handle, funcName); 22 | args.forEach((arg) => { 23 | switch (typeof arg) { 24 | case "number": 25 | { 26 | if (Number(arg) === arg && arg % 1 !== 0) { 27 | game.scaleformMovieMethodAddParamFloat(arg); 28 | } 29 | else { 30 | game.scaleformMovieMethodAddParamInt(arg); 31 | } 32 | } 33 | case "string": 34 | { 35 | game.scaleformMovieMethodAddParamPlayerNameString(arg); 36 | break; 37 | } 38 | case "boolean": 39 | { 40 | game.scaleformMovieMethodAddParamBool(arg); 41 | break; 42 | } 43 | default: 44 | { 45 | alt.logError(`Unknown argument type ${typeof arg} = ${arg.toString()} passed to scaleform with handle ${this._handle}`); 46 | } 47 | } 48 | }); 49 | } 50 | callFunction(funcName, ...args) { 51 | this.callFunctionHead(funcName, ...args); 52 | game.endScaleformMovieMethod(); 53 | } 54 | callFunctionReturn(funcName, ...args) { 55 | this.callFunctionHead(funcName, ...args); 56 | return game.endScaleformMovieMethodReturnValue(); 57 | } 58 | render2D() { 59 | if (!this.isValid || !this.isLoaded) 60 | return; 61 | game.drawScaleformMovieFullscreen(this._handle, 255, 255, 255, 255, 0); 62 | } 63 | recreate() { 64 | if (!this.isValid || !this.isLoaded) 65 | return; 66 | game.setScaleformMovieAsNoLongerNeeded(this._handle); 67 | this._handle = game.requestScaleformMovie(this.scaleForm); 68 | } 69 | destroy() { 70 | if (!this.isValid) 71 | return; 72 | game.setScaleformMovieAsNoLongerNeeded(this._handle); 73 | this._handle = 0; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /client/includes/NativeUI/modules/Text.ts: -------------------------------------------------------------------------------- 1 | import game from 'natives'; 2 | import Color from "../utils/Color"; 3 | import Point from "../utils/Point"; 4 | import IElement from "./IElement"; 5 | import Size from '../utils/Size'; 6 | 7 | export default class Text extends IElement { 8 | public Caption: string; 9 | public Pos: Point; 10 | public Scale: number; 11 | public Color: Color; 12 | public Font: number; 13 | public Centered: boolean; 14 | 15 | constructor(caption: string, pos: Point, scale: number, color: Color, font: number, centered: boolean) { 16 | super(); 17 | this.Caption = caption; 18 | this.Pos = pos; 19 | this.Scale = scale; 20 | this.Color = color || new Color(255, 255, 255, 255); 21 | this.Font = font || 0; 22 | this.Centered = centered || false; 23 | } 24 | 25 | public Draw(caption: Size, pos: Point, scale: number, color: Color, font: string | number, centered: boolean) { 26 | if (caption && !pos && !scale && !color && !font && !centered) { 27 | pos = new Point(this.Pos.X + caption.Width, this.Pos.Y + caption.Height); 28 | scale = this.Scale; 29 | color = this.Color; 30 | font = this.Font; 31 | centered = this.Centered; 32 | } 33 | const x = pos.X / 1280.0; 34 | const y = pos.Y / 720.0; 35 | 36 | game.setTextFont(parseInt(font as string)); 37 | game.setTextScale(scale, scale); 38 | game.setTextColour(color.R, color.G, color.B, color.A); 39 | game.setTextCentre(centered); 40 | game.beginTextCommandDisplayText("STRING"); 41 | Text.AddLongString(caption as any); 42 | game.endTextCommandDisplayText(x, y, 0); 43 | } 44 | 45 | public static AddLongString(text: string) { 46 | if (!text.length) 47 | return; 48 | 49 | const maxStringLength = 99; 50 | const splittedArrayOfStrings = []; 51 | 52 | let i = 0; 53 | let position; 54 | let next; 55 | let currentText; 56 | 57 | while(i < text.length) { 58 | next = (i + maxStringLength) > text.length ? text.length : i + maxStringLength; 59 | position = next; 60 | currentText = text.substring(i, position); 61 | if(((currentText.match(/~/g)||[]).length % 2) !== 0 && (i + maxStringLength) <= text.length) { 62 | position = currentText.lastIndexOf('~'); 63 | currentText = text.substring(i, i + position); 64 | i = i + position; 65 | } else { 66 | i = next; 67 | } 68 | splittedArrayOfStrings.push(currentText); 69 | } 70 | for(const str of splittedArrayOfStrings) { 71 | game.addTextComponentSubstringPlayerName(str); 72 | } 73 | } 74 | } 75 | 76 | export { 77 | Text 78 | } 79 | -------------------------------------------------------------------------------- /client/includes/NativeUI/modules/Sprite.ts: -------------------------------------------------------------------------------- 1 | import * as alt from 'alt-client'; 2 | import game from 'natives'; 3 | import Color from "../utils/Color"; 4 | import Point from "../utils/Point"; 5 | import Size from "../utils/Size"; 6 | import Screen from "../utils/Screen"; 7 | 8 | export default class Sprite { 9 | public TextureName: string; 10 | public Pos: Point; 11 | public Size: Size; 12 | public Heading: number; 13 | public Color: Color; 14 | public Visible: boolean; 15 | 16 | private _textureDict: string; 17 | 18 | constructor(textureDict: string, textureName: string, pos: Point, size: Size, heading = 0, color = new Color(255, 255, 255)) { 19 | this.TextureDict = textureDict; 20 | this.TextureName = textureName; 21 | this.Pos = pos; 22 | this.Size = size; 23 | this.Heading = heading; 24 | this.Color = color; 25 | this.Visible = true; 26 | } 27 | 28 | public LoadTextureDictionary() { 29 | this.requestTextureDictPromise(this._textureDict).then((succ) => { }); 30 | } 31 | private requestTextureDictPromise(textureDict: string) { 32 | return new Promise((resolve, reject) => { 33 | game.requestStreamedTextureDict(textureDict, true); 34 | let inter = alt.setInterval(() => { 35 | if (game.hasStreamedTextureDictLoaded(textureDict)) { 36 | alt.clearInterval(inter); 37 | return resolve(true); 38 | } 39 | }, 10); 40 | }); 41 | } 42 | 43 | public set TextureDict(v) { 44 | this._textureDict = v; 45 | if (!this.IsTextureDictionaryLoaded) this.LoadTextureDictionary(); 46 | } 47 | public get TextureDict(): string { 48 | return this._textureDict; 49 | } 50 | 51 | public get IsTextureDictionaryLoaded() { 52 | return game.hasStreamedTextureDictLoaded(this._textureDict); 53 | } 54 | 55 | public Draw(textureDictionary?: string, textureName?: string, pos?: Point, size?: Size, heading?: number, color?: Color, loadTexture?: boolean) { 56 | textureDictionary = textureDictionary || this.TextureDict; 57 | textureName = textureName || this.TextureName; 58 | pos = pos || this.Pos; 59 | size = size || this.Size; 60 | heading = heading || this.Heading; 61 | color = color || this.Color; 62 | loadTexture = loadTexture || true; 63 | 64 | if (loadTexture) { 65 | if (!game.hasStreamedTextureDictLoaded(textureDictionary)) 66 | game.requestStreamedTextureDict(textureDictionary, true); 67 | } 68 | 69 | const screenw = Screen.Width; 70 | const screenh = Screen.Height; 71 | const height = 1080.0; 72 | const ratio = screenw / screenh; 73 | const width = height * ratio; 74 | 75 | const w = this.Size.Width / width; 76 | const h = this.Size.Height / height; 77 | const x = this.Pos.X / width + w * 0.5; 78 | const y = this.Pos.Y / height + h * 0.5; 79 | 80 | game.drawSprite(textureDictionary, textureName, x, y, w, h, heading, color.R, color.G, color.B, color.A, true); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /client/includes/NativeUI/modules/Message.js: -------------------------------------------------------------------------------- 1 | import * as alt from 'alt-client'; 2 | import Scaleform from '../utils/Scaleform'; 3 | export default class Message { 4 | static Initialize(scaleForm, transitionOutAnimName) { 5 | this._transitionOutAnimName = transitionOutAnimName; 6 | this._scaleform = new Scaleform(scaleForm); 7 | } 8 | static get IsVisible() { 9 | return this._messageVisible; 10 | } 11 | static get Scaleform() { 12 | return this._scaleform; 13 | } 14 | static Load() { 15 | if (this._delayedTransitionInTimeout != null) { 16 | alt.clearTimeout(this._delayedTransitionInTimeout); 17 | this._delayedTransitionInTimeout = null; 18 | } 19 | } 20 | static SetDelayedTransition(messageHandler, time) { 21 | this._delayedTransitionInTimeout = alt.setTimeout(() => { 22 | this._delayedTransitionInTimeout = null; 23 | this.TransitionIn(messageHandler, time); 24 | }, this._transitionOutTimeMs); 25 | } 26 | static ShowCustomShard(funcName, time = 5000, ...funcArgs) { 27 | this.ShowComplexCustomShard(() => { 28 | this._scaleform.callFunction(funcName, ...funcArgs); 29 | }, time); 30 | } 31 | static ShowComplexCustomShard(messageHandler, time = 5000) { 32 | this.Load(); 33 | if (this._messageVisible) { 34 | this.TransitionOut(); 35 | this.SetDelayedTransition(() => messageHandler(), time); 36 | } 37 | else { 38 | this.TransitionIn(messageHandler, time); 39 | } 40 | } 41 | static TransitionOut() { 42 | if (!this._messageVisible) 43 | return; 44 | if (this._transitionOutTimeout != null) { 45 | alt.clearTimeout(this._transitionOutTimeout); 46 | this._transitionOutTimeout = null; 47 | } 48 | if (this._transitionOutFinishedTimeout != null) { 49 | alt.clearTimeout(this._transitionOutFinishedTimeout); 50 | this._transitionOutFinishedTimeout = null; 51 | } 52 | this._scaleform.callFunction(this._transitionOutAnimName); 53 | this._transitionOutFinishedTimeout = alt.setTimeout(() => { 54 | this._messageVisible = false; 55 | this._scaleform.recreate(); 56 | }, this._transitionOutTimeMs); 57 | } 58 | static TransitionIn(messageHandler, transitionOutTime = 500) { 59 | this._messageVisible = true; 60 | messageHandler(); 61 | this.SetTransitionOutTimer(transitionOutTime); 62 | } 63 | static SetTransitionOutTimer(time) { 64 | this._transitionOutTimeout = alt.setTimeout(() => { 65 | this._transitionOutTimeout = null; 66 | this.TransitionOut(); 67 | }, time); 68 | } 69 | static Render() { 70 | if (this._messageVisible) { 71 | this._scaleform.render2D(); 72 | } 73 | } 74 | } 75 | Message._messageVisible = false; 76 | Message._transitionOutTimeout = null; 77 | Message._transitionOutFinishedTimeout = null; 78 | Message._delayedTransitionInTimeout = null; 79 | Message._scaleform = null; 80 | Message._transitionOutTimeMs = 500; 81 | Message._transitionOutAnimName = null; 82 | -------------------------------------------------------------------------------- /client/includes/NativeUI/modules/ResText.js: -------------------------------------------------------------------------------- 1 | import * as alt from 'alt-client'; 2 | import Alignment from "../enums/Alignment"; 3 | import game from 'natives'; 4 | import Color from "../utils/Color"; 5 | import Point from "../utils/Point"; 6 | import Size from "../utils/Size"; 7 | import Text from "./Text"; 8 | import Screen from "../utils/Screen"; 9 | export default class ResText extends Text { 10 | constructor(caption, pos, scale, color, font, centered) { 11 | super(caption, pos, scale, color || new Color(255, 255, 255), font || 0, false); 12 | this.TextAlignment = Alignment.Left; 13 | this.Wrap = 0; 14 | if (centered) 15 | this.TextAlignment = centered; 16 | } 17 | get WordWrap() { 18 | return new Size(this.Wrap, 0); 19 | } 20 | set WordWrap(value) { 21 | this.Wrap = value.Width; 22 | } 23 | Draw(arg1, pos, scale, color, font, arg2, dropShadow, outline, wordWrap) { 24 | let caption = arg1; 25 | let centered = arg2; 26 | let textAlignment = arg2; 27 | if (!arg1) 28 | arg1 = new Size(0, 0); 29 | if (arg1 && !pos) { 30 | textAlignment = this.TextAlignment; 31 | caption = this.Caption; 32 | pos = new Point(this.Pos.X + arg1.Width, this.Pos.Y + arg1.Height); 33 | scale = this.Scale; 34 | color = this.Color; 35 | font = this.Font; 36 | if (centered == true || centered == false) { 37 | centered = this.Centered; 38 | } 39 | else { 40 | centered = undefined; 41 | dropShadow = this.DropShadow; 42 | outline = this.Outline; 43 | wordWrap = this.WordWrap; 44 | } 45 | } 46 | const screenw = Screen.Width; 47 | const screenh = Screen.Height; 48 | const height = 1080.0; 49 | const ratio = screenw / screenh; 50 | const width = height * ratio; 51 | const x = this.Pos.X / width; 52 | const y = this.Pos.Y / height; 53 | game.setTextFont(parseInt(font)); 54 | game.setTextScale(1.0, scale); 55 | game.setTextColour(color.R, color.G, color.B, color.A); 56 | if (centered !== undefined) { 57 | game.setTextCentre(centered); 58 | } 59 | else { 60 | if (dropShadow) 61 | game.setTextDropshadow(2, 0, 0, 0, 0); 62 | if (outline) 63 | alt.logWarning("[NativeUI] ResText outline not working!"); 64 | switch (textAlignment) { 65 | case Alignment.Centered: 66 | game.setTextCentre(true); 67 | break; 68 | case Alignment.Right: 69 | game.setTextRightJustify(true); 70 | game.setTextWrap(0.0, x); 71 | break; 72 | } 73 | if (this.Wrap) { 74 | const xsize = (this.Pos.X + this.Wrap) / width; 75 | game.setTextWrap(x, xsize); 76 | } 77 | } 78 | game.beginTextCommandDisplayText("CELL_EMAIL_BCON"); 79 | Text.AddLongString(caption); 80 | game.endTextCommandDisplayText(x, y, 0); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /client/includes/NativeUI/utils/Scaleform.ts: -------------------------------------------------------------------------------- 1 | import * as alt from 'alt-client'; 2 | import * as game from 'natives'; 3 | 4 | export default class Scaleform { 5 | private _handle: number = 0; 6 | private scaleForm: string; 7 | 8 | public constructor(scaleForm: string) { 9 | this.scaleForm = scaleForm; 10 | this._handle = game.requestScaleformMovie(this.scaleForm); 11 | } 12 | 13 | public get handle(): number { 14 | return this._handle; 15 | } 16 | 17 | public get isValid(): boolean { 18 | return this._handle != 0; 19 | } 20 | 21 | public get isLoaded(): boolean { 22 | return game.hasScaleformMovieLoaded(this._handle); 23 | } 24 | 25 | private callFunctionHead(funcName: string, ...args: any[]): void { 26 | if (!this.isValid || !this.isLoaded) 27 | return; 28 | 29 | game.beginScaleformMovieMethod(this._handle, funcName); 30 | //alt.log("Running func head " + funcName + "(" + args + ") on " + this.handle + " (" + this.scaleForm + ")"); 31 | 32 | args.forEach((arg: any) => { 33 | switch (typeof arg) { 34 | case "number": 35 | { 36 | if (Number(arg) === arg && arg % 1 !== 0) { 37 | game.scaleformMovieMethodAddParamFloat(arg); 38 | } 39 | else { 40 | game.scaleformMovieMethodAddParamInt(arg); 41 | } 42 | } 43 | case "string": 44 | { 45 | game.scaleformMovieMethodAddParamPlayerNameString(arg as string); 46 | break; 47 | } 48 | case "boolean": 49 | { 50 | game.scaleformMovieMethodAddParamBool(arg); 51 | break; 52 | } 53 | default: 54 | { 55 | alt.logError(`Unknown argument type ${typeof arg} = ${arg.toString()} passed to scaleform with handle ${this._handle}`); 56 | } 57 | } 58 | }); 59 | } 60 | 61 | public callFunction(funcName: string, ...args: any[]): void { 62 | this.callFunctionHead(funcName, ...args); 63 | game.endScaleformMovieMethod(); 64 | } 65 | 66 | public callFunctionReturn(funcName: string, ...args: any[]): number { 67 | this.callFunctionHead(funcName, ...args); 68 | return game.endScaleformMovieMethodReturnValue(); 69 | } 70 | 71 | public render2D(): void { 72 | if (!this.isValid || !this.isLoaded) 73 | return; 74 | game.drawScaleformMovieFullscreen(this._handle, 255, 255, 255, 255, 0); 75 | } 76 | 77 | public recreate(): void { 78 | if (!this.isValid || !this.isLoaded) 79 | return; 80 | game.setScaleformMovieAsNoLongerNeeded(this._handle); 81 | this._handle = game.requestScaleformMovie(this.scaleForm); 82 | } 83 | 84 | public destroy(): void { 85 | if (!this.isValid) 86 | return; 87 | game.setScaleformMovieAsNoLongerNeeded(this._handle); 88 | this._handle = 0; 89 | } 90 | } -------------------------------------------------------------------------------- /client/includes/NativeUI/items/UIMenuSliderItem.js: -------------------------------------------------------------------------------- 1 | import ResRectangle from "../modules/ResRectangle"; 2 | import Sprite from "../modules/Sprite"; 3 | import Color from "../utils/Color"; 4 | import Point from "../utils/Point"; 5 | import Size from "../utils/Size"; 6 | import UIMenuItem from "./UIMenuItem"; 7 | export default class UIMenuSliderItem extends UIMenuItem { 8 | constructor(text, items, index, description = "", divider = false, data = null) { 9 | super(text, description, data); 10 | const y = 0; 11 | this._items = items; 12 | this._arrowLeft = new Sprite("commonmenutu", "arrowleft", new Point(0, 105 + y), new Size(15, 15)); 13 | this._arrowRight = new Sprite("commonmenutu", "arrowright", new Point(0, 105 + y), new Size(15, 15)); 14 | this._rectangleBackground = new ResRectangle(new Point(0, 0), new Size(150, 9), new Color(4, 32, 57, 255)); 15 | this._rectangleSlider = new ResRectangle(new Point(0, 0), new Size(75, 9), new Color(57, 116, 200, 255)); 16 | if (divider) { 17 | this._rectangleDivider = new ResRectangle(new Point(0, 0), new Size(2.5, 20), Color.WhiteSmoke); 18 | } 19 | else { 20 | this._rectangleDivider = new ResRectangle(new Point(0, 0), new Size(2.5, 20), Color.Transparent); 21 | } 22 | this.Index = index; 23 | } 24 | get Index() { 25 | return this._index % this._items.length; 26 | } 27 | set Index(value) { 28 | this._index = 100000000 - (100000000 % this._items.length) + value; 29 | } 30 | SetVerticalPosition(y) { 31 | this._rectangleBackground.Pos = new Point(250 + this.Offset.X + this.Parent.WidthOffset, y + 158.5 + this.Offset.Y); 32 | this._rectangleSlider.Pos = new Point(250 + this.Offset.X + this.Parent.WidthOffset, y + 158.5 + this.Offset.Y); 33 | this._rectangleDivider.Pos = new Point(323.5 + this.Offset.X + this.Parent.WidthOffset, y + 153 + this.Offset.Y); 34 | this._arrowLeft.Pos = new Point(235 + this.Offset.X + this.Parent.WidthOffset, 155.5 + y + this.Offset.Y); 35 | this._arrowRight.Pos = new Point(400 + this.Offset.X + this.Parent.WidthOffset, 155.5 + y + this.Offset.Y); 36 | super.SetVerticalPosition(y); 37 | } 38 | IndexToItem(index) { 39 | return this._items[index]; 40 | } 41 | Draw() { 42 | super.Draw(); 43 | this._arrowLeft.Color = this.Enabled 44 | ? this.Selected 45 | ? Color.Black 46 | : Color.WhiteSmoke 47 | : new Color(163, 159, 148); 48 | this._arrowRight.Color = this.Enabled 49 | ? this.Selected 50 | ? Color.Black 51 | : Color.WhiteSmoke 52 | : new Color(163, 159, 148); 53 | let offset = ((this._rectangleBackground.Size.Width - this._rectangleSlider.Size.Width) / (this._items.length - 1)) * this.Index; 54 | this._rectangleSlider.Pos = new Point(250 + this.Offset.X + offset + +this.Parent.WidthOffset, this._rectangleSlider.Pos.Y); 55 | if (this.Selected) { 56 | this._arrowLeft.Draw(); 57 | this._arrowRight.Draw(); 58 | } 59 | this._rectangleBackground.Draw(); 60 | this._rectangleSlider.Draw(); 61 | this._rectangleDivider.Draw(); 62 | } 63 | SetRightBadge(badge) { } 64 | SetRightLabel(text) { } 65 | } 66 | -------------------------------------------------------------------------------- /client/includes/NativeUI/utils/Screen.ts: -------------------------------------------------------------------------------- 1 | import * as alt from 'alt-client'; 2 | import game from 'natives'; 3 | import Font from "../enums/Font"; 4 | import Point from "./Point"; 5 | import Size from "./Size"; 6 | import Text from '../modules/Text'; 7 | 8 | const gameScreen = game.getActiveScreenResolution(0, 0); 9 | 10 | export default class Screen { 11 | public static Width: number = gameScreen[1]; 12 | public static Height: number = gameScreen[2]; 13 | 14 | public static get ResolutionMaintainRatio(): Size { 15 | const ratio = Screen.Width / Screen.Height; 16 | const width = 1080.0 * ratio; 17 | 18 | return new Size(width, 1080.0); 19 | } 20 | 21 | public static MousePosition(relative: boolean = false): { X: number; Y: number } { 22 | const res = Screen.ResolutionMaintainRatio; 23 | const cursor: { x: number; y: number; } = alt.getCursorPos() as { x: number; y: number; }; 24 | let [mouseX, mouseY] = [cursor.x, cursor.y]; 25 | if (relative) 26 | [mouseX, mouseY] = [cursor.x / res.Width, cursor.y / res.Height]; 27 | return { 28 | X: mouseX, 29 | Y: mouseY 30 | }; 31 | } 32 | 33 | public static IsMouseInBounds(topLeft: Point, boxSize: Size) { 34 | const mousePosition = Screen.MousePosition(); 35 | return ( 36 | mousePosition.X >= topLeft.X && 37 | mousePosition.X <= topLeft.X + boxSize.Width && 38 | (mousePosition.Y > topLeft.Y && mousePosition.Y < topLeft.Y + boxSize.Height) 39 | ); 40 | } 41 | 42 | public static GetTextWidth(text: string, font: Font, scale: number): number { 43 | // Start by requesting the game to start processing a width measurement 44 | game.beginTextCommandGetWidth("CELL_EMAIL_BCON"); 45 | // Add the text string 46 | Text.AddLongString(text); 47 | 48 | // Set the properties for the text 49 | game.setTextFont(font); 50 | game.setTextScale(1.0, scale); 51 | 52 | // Ask the game for the relative string width 53 | const width: number = game.endTextCommandGetWidth(true); 54 | // And return the literal result 55 | const res = Screen.ResolutionMaintainRatio; 56 | return res.Width * width; 57 | } 58 | 59 | public static GetLineCount(text: string, position: Point, font: Font, scale: number, wrap: number): number { 60 | // Tell the game that we are going to request the number of lines 61 | game.beginTextCommandLineCount("CELL_EMAIL_BCON"); 62 | // Add the text that has been sent to us 63 | Text.AddLongString(text); 64 | 65 | // Get the resolution with the correct aspect ratio 66 | const res: Size = Screen.ResolutionMaintainRatio; 67 | // Calculate the x and y positions 68 | const x: number = position.X / res.Width; 69 | const y: number = position.Y / res.Height; 70 | 71 | // Set the properties for the text 72 | game.setTextFont(font); 73 | game.setTextScale(1.0, scale); 74 | 75 | // If there is some text wrap to add 76 | if (wrap > 0) { 77 | // Calculate the wrap size 78 | const start: number = position.X / res.Width; 79 | const end: number = start + (wrap / res.Width); 80 | // And apply it 81 | game.setTextWrap(x, end); 82 | } 83 | 84 | // Finally, return the number of lines being made by the string 85 | let lineCount = game.endTextCommandLineCount(x, y); 86 | return lineCount; 87 | } 88 | } -------------------------------------------------------------------------------- /client/includes/NativeUI/modules/ResText.ts: -------------------------------------------------------------------------------- 1 | import * as alt from 'alt-client'; 2 | import Alignment from "../enums/Alignment"; 3 | import game from 'natives'; 4 | import Color from "../utils/Color"; 5 | import Point from "../utils/Point"; 6 | import Size from "../utils/Size"; 7 | import Text from "./Text"; 8 | import Screen from "../utils/Screen"; 9 | 10 | export default class ResText extends Text { 11 | public TextAlignment: Alignment = Alignment.Left; 12 | public DropShadow: boolean; 13 | public Outline: boolean; 14 | public Wrap: number = 0; 15 | 16 | public get WordWrap() { 17 | return new Size(this.Wrap, 0); 18 | } 19 | public set WordWrap(value) { 20 | this.Wrap = value.Width; 21 | } 22 | 23 | constructor(caption: string, pos: Point, scale: number, color?: Color, font?: number, centered?: Alignment) { 24 | super(caption, pos, scale, color || new Color(255, 255, 255), font || 0, false); 25 | if (centered) this.TextAlignment = centered; 26 | } 27 | 28 | public Draw(): void; 29 | public Draw(offset: Size): void; 30 | public Draw(caption: Size, pos: Point, scale: number, color: Color, font: string | number, arg2: any): void; 31 | 32 | public Draw(arg1?: any, pos?: Point, scale?: number, color?: Color, font?: string | number, arg2?: any, dropShadow?: boolean, outline?: boolean, wordWrap?: Size) { 33 | let caption = arg1; 34 | let centered = arg2; 35 | let textAlignment = arg2; 36 | if (!arg1) arg1 = new Size(0, 0); 37 | 38 | if (arg1 && !pos) { 39 | textAlignment = this.TextAlignment; 40 | caption = this.Caption; 41 | pos = new Point(this.Pos.X + arg1.Width, this.Pos.Y + arg1.Height); 42 | scale = this.Scale; 43 | color = this.Color; 44 | font = this.Font; 45 | if (centered == true || centered == false) { 46 | centered = this.Centered; 47 | } else { 48 | centered = undefined; 49 | dropShadow = this.DropShadow; 50 | outline = this.Outline; 51 | wordWrap = this.WordWrap; 52 | } 53 | } 54 | 55 | const screenw = Screen.Width; 56 | const screenh = Screen.Height; 57 | 58 | const height = 1080.0; 59 | const ratio = screenw / screenh; 60 | const width = height * ratio; 61 | 62 | const x = this.Pos.X / width; 63 | const y = this.Pos.Y / height; 64 | 65 | game.setTextFont(parseInt(font as string)); 66 | game.setTextScale(1.0, scale); 67 | game.setTextColour(color.R, color.G, color.B, color.A); 68 | 69 | if (centered !== undefined) { 70 | game.setTextCentre(centered); 71 | } else { 72 | if (dropShadow) game.setTextDropshadow(2, 0, 0, 0, 0); 73 | 74 | if (outline) alt.logWarning("[NativeUI] ResText outline not working!"); 75 | 76 | switch (textAlignment) { 77 | case Alignment.Centered: 78 | game.setTextCentre(true); 79 | break; 80 | case Alignment.Right: 81 | game.setTextRightJustify(true); 82 | game.setTextWrap(0.0, x); 83 | break; 84 | } 85 | 86 | if (this.Wrap) { 87 | const xsize = (this.Pos.X + this.Wrap) / width; 88 | game.setTextWrap(x, xsize); 89 | } 90 | } 91 | 92 | game.beginTextCommandDisplayText("CELL_EMAIL_BCON"); 93 | Text.AddLongString(caption as string); 94 | game.endTextCommandDisplayText(x, y, 0); 95 | } 96 | } -------------------------------------------------------------------------------- /client/includes/NativeUI/items/UIMenuSliderItem.ts: -------------------------------------------------------------------------------- 1 | import BadgeStyle from "../enums/BadgeStyle"; 2 | import ResRectangle from "../modules/ResRectangle"; 3 | import Sprite from "../modules/Sprite"; 4 | import Color from "../utils/Color"; 5 | import Point from "../utils/Point"; 6 | import Size from "../utils/Size"; 7 | import UIMenuItem from "./UIMenuItem"; 8 | 9 | export default class UIMenuSliderItem extends UIMenuItem { 10 | private _arrowLeft: Sprite; 11 | private _arrowRight: Sprite; 12 | private _rectangleBackground: ResRectangle; 13 | private _rectangleSlider: ResRectangle; 14 | private _rectangleDivider: ResRectangle; 15 | private _items: any[]; 16 | private _index: number; 17 | 18 | public get Index() { 19 | return this._index % this._items.length; 20 | } 21 | public set Index(value) { 22 | this._index = 100000000 - (100000000 % this._items.length) + value; 23 | } 24 | 25 | constructor(text: string, items: any[], index: number, description: string = "", divider: boolean = false, data: any = null) { 26 | super(text, description, data); 27 | 28 | const y: number = 0; 29 | this._items = items; 30 | this._arrowLeft = new Sprite("commonmenutu", "arrowleft", new Point(0, 105 + y), new Size(15, 15)); 31 | this._arrowRight = new Sprite("commonmenutu", "arrowright", new Point(0, 105 + y), new Size(15, 15)); 32 | this._rectangleBackground = new ResRectangle(new Point(0, 0), new Size(150, 9), new Color(4, 32, 57, 255)); 33 | this._rectangleSlider = new ResRectangle(new Point(0, 0), new Size(75, 9), new Color(57, 116, 200, 255)); 34 | if (divider) { 35 | this._rectangleDivider = new ResRectangle(new Point(0, 0), new Size(2.5, 20), Color.WhiteSmoke); 36 | } else { 37 | this._rectangleDivider = new ResRectangle(new Point(0, 0), new Size(2.5, 20), Color.Transparent); 38 | } 39 | this.Index = index; 40 | } 41 | 42 | public SetVerticalPosition(y: number) { 43 | this._rectangleBackground.Pos = new Point(250 + this.Offset.X + this.Parent.WidthOffset, y + 158.5 + this.Offset.Y); 44 | this._rectangleSlider.Pos = new Point(250 + this.Offset.X + this.Parent.WidthOffset, y + 158.5 + this.Offset.Y); 45 | this._rectangleDivider.Pos = new Point(323.5 + this.Offset.X + this.Parent.WidthOffset, y + 153 + this.Offset.Y); 46 | this._arrowLeft.Pos = new Point(235 + this.Offset.X + this.Parent.WidthOffset, 155.5 + y + this.Offset.Y); 47 | this._arrowRight.Pos = new Point(400 + this.Offset.X + this.Parent.WidthOffset, 155.5 + y + this.Offset.Y); 48 | 49 | super.SetVerticalPosition(y); 50 | } 51 | 52 | public IndexToItem(index: number) { 53 | return this._items[index]; 54 | } 55 | 56 | public Draw() { 57 | super.Draw(); 58 | this._arrowLeft.Color = this.Enabled 59 | ? this.Selected 60 | ? Color.Black 61 | : Color.WhiteSmoke 62 | : new Color(163, 159, 148); 63 | this._arrowRight.Color = this.Enabled 64 | ? this.Selected 65 | ? Color.Black 66 | : Color.WhiteSmoke 67 | : new Color(163, 159, 148); 68 | let offset = ((this._rectangleBackground.Size.Width - this._rectangleSlider.Size.Width) / (this._items.length - 1)) * this.Index; 69 | this._rectangleSlider.Pos = new Point(250 + this.Offset.X + offset + +this.Parent.WidthOffset, this._rectangleSlider.Pos.Y); 70 | if (this.Selected) { 71 | this._arrowLeft.Draw(); 72 | this._arrowRight.Draw(); 73 | } 74 | this._rectangleBackground.Draw(); 75 | this._rectangleSlider.Draw(); 76 | this._rectangleDivider.Draw(); 77 | } 78 | 79 | public SetRightBadge(badge: BadgeStyle) { } 80 | 81 | public SetRightLabel(text: string) { } 82 | } 83 | -------------------------------------------------------------------------------- /client/includes/NativeUI/modules/Message.ts: -------------------------------------------------------------------------------- 1 | import * as alt from 'alt-client'; 2 | import Scaleform from '../utils/Scaleform'; 3 | 4 | export default class Message { 5 | private static _messageVisible: boolean = false; 6 | private static _transitionOutTimeout: number = null; 7 | private static _transitionOutFinishedTimeout: number = null; 8 | private static _delayedTransitionInTimeout: number = null; 9 | private static _scaleform: Scaleform = null; 10 | private static _transitionOutTimeMs: number = 500; 11 | private static _transitionOutAnimName: string = null; 12 | 13 | protected static Initialize(scaleForm: string, transitionOutAnimName: string) { 14 | this._transitionOutAnimName = transitionOutAnimName; 15 | this._scaleform = new Scaleform(scaleForm); 16 | } 17 | 18 | public static get IsVisible(): boolean { 19 | return this._messageVisible; 20 | } 21 | 22 | protected static get Scaleform(): Scaleform { 23 | return this._scaleform; 24 | } 25 | 26 | private static Load() { 27 | //Make sure there is no delayed transition existing 28 | if (this._delayedTransitionInTimeout != null) { 29 | alt.clearTimeout(this._delayedTransitionInTimeout); 30 | this._delayedTransitionInTimeout = null; 31 | } 32 | } 33 | 34 | //Delayed transition is needed when transition out got played before, this is the case when bigmessage is called before other one is finished showing. 35 | private static SetDelayedTransition(messageHandler: { (): void }, time: number) { 36 | this._delayedTransitionInTimeout = alt.setTimeout(() => { 37 | this._delayedTransitionInTimeout = null; 38 | this.TransitionIn(messageHandler, time); 39 | }, this._transitionOutTimeMs); 40 | } 41 | 42 | public static ShowCustomShard(funcName: string, time: number = 5000, ...funcArgs: any[]): void { 43 | this.ShowComplexCustomShard(() => { 44 | this._scaleform.callFunction(funcName, ...funcArgs); 45 | }, time); 46 | } 47 | 48 | public static ShowComplexCustomShard(messageHandler: { (): void }, time: number = 5000): void { 49 | this.Load(); 50 | if (this._messageVisible) { //When a shard is already shown 51 | this.TransitionOut(); 52 | this.SetDelayedTransition(() => messageHandler(), time); 53 | } 54 | else { 55 | this.TransitionIn(messageHandler, time); 56 | } 57 | } 58 | 59 | protected static TransitionOut() { 60 | if (!this._messageVisible) 61 | return; 62 | if (this._transitionOutTimeout != null) { 63 | alt.clearTimeout(this._transitionOutTimeout); 64 | this._transitionOutTimeout = null; 65 | } 66 | if (this._transitionOutFinishedTimeout != null) { 67 | alt.clearTimeout(this._transitionOutFinishedTimeout); 68 | this._transitionOutFinishedTimeout = null; 69 | } 70 | this._scaleform.callFunction(this._transitionOutAnimName); 71 | this._transitionOutFinishedTimeout = alt.setTimeout(() => { 72 | this._messageVisible = false; 73 | this._scaleform.recreate(); 74 | }, this._transitionOutTimeMs); 75 | } 76 | 77 | private static TransitionIn(messageHandler: { (): void }, transitionOutTime: number = 500) { 78 | this._messageVisible = true; 79 | messageHandler(); 80 | this.SetTransitionOutTimer(transitionOutTime); 81 | } 82 | 83 | private static SetTransitionOutTimer(time: number) { 84 | this._transitionOutTimeout = alt.setTimeout(() => { 85 | this._transitionOutTimeout = null; 86 | this.TransitionOut(); 87 | }, time); 88 | } 89 | 90 | protected static Render() { 91 | if (this._messageVisible) { 92 | this._scaleform.render2D(); 93 | } 94 | } 95 | } -------------------------------------------------------------------------------- /client/includes/NativeUI/items/UIMenuDynamicListItem.js: -------------------------------------------------------------------------------- 1 | import * as alt from 'alt-client'; 2 | import Font from "../enums/Font"; 3 | import Alignment from "../enums/Alignment"; 4 | import ResText from "../modules/ResText"; 5 | import Sprite from "../modules/Sprite"; 6 | import Color from "../utils/Color"; 7 | import Point from "../utils/Point"; 8 | import Size from "../utils/Size"; 9 | import Screen from "../utils/Screen"; 10 | import UIMenuItem from "./UIMenuItem"; 11 | export default class UIMenuDynamicListItem extends UIMenuItem { 12 | constructor(text, selectionChangeHandler, description = "", selectedStartValueHandler = null, data = null) { 13 | super(text, description, data); 14 | this._currentOffset = 0; 15 | this._precaptionText = ''; 16 | this._selectedStartValueHandler = null; 17 | this.SelectionChangeHandler = null; 18 | if (!this.isVariableFunction(selectionChangeHandler)) { 19 | alt.logError(`[UIMenuDynamicListItem] ${text} is not created with a valid selectionChangeHandler, needs to be function. Please see docs.`); 20 | } 21 | if (!this.isVariableFunction(selectedStartValueHandler)) { 22 | alt.logError(`[UIMenuDynamicListItem] ${text} is not created with a valid selectedStartValueHandler, needs to be function. Please see docs.`); 23 | } 24 | this.SelectionChangeHandler = selectionChangeHandler; 25 | this._selectedStartValueHandler = selectedStartValueHandler; 26 | let y = 0; 27 | this._arrowLeft = new Sprite("commonmenu", "arrowleft", new Point(110, 105 + y), new Size(30, 30)); 28 | this._arrowRight = new Sprite("commonmenu", "arrowright", new Point(280, 105 + y), new Size(30, 30)); 29 | this._itemText = new ResText("", new Point(290, y + 104), 0.35, Color.White, Font.ChaletLondon, Alignment.Right); 30 | } 31 | SelectionChangeHandlerPromise(item, selectedValue, changeDirection) { 32 | return new Promise((resolve, reject) => { 33 | let newSelectedValue = this.SelectionChangeHandler(item, selectedValue, changeDirection); 34 | resolve(newSelectedValue); 35 | }); 36 | } 37 | get PreCaptionText() { 38 | return this._precaptionText; 39 | } 40 | set PreCaptionText(text) { 41 | if (!text) 42 | throw new Error("The pre caption text can't be null"); 43 | if (typeof text !== 'string') 44 | throw new Error("The pre caption text must be a string"); 45 | this._precaptionText = text; 46 | this._currentOffset = Screen.GetTextWidth(this.PreCaptionText + this._selectedValue, this._itemText && this._itemText.Font ? this._itemText.Font : 0, 0.35); 47 | } 48 | get SelectedValue() { 49 | return this._selectedValue; 50 | } 51 | set SelectedValue(value) { 52 | this._selectedValue = value; 53 | if (value == undefined) 54 | return; 55 | this._currentOffset = Screen.GetTextWidth(this.PreCaptionText + this._selectedValue, this._itemText && this._itemText.Font ? this._itemText.Font : 0, this._itemText && this._itemText.Scale ? this._itemText.Scale : 0.35); 56 | } 57 | SetVerticalPosition(y) { 58 | this._arrowLeft.Pos = new Point(300 + this.Offset.X + this.Parent.WidthOffset, 147 + y + this.Offset.Y); 59 | this._arrowRight.Pos = new Point(400 + this.Offset.X + this.Parent.WidthOffset, 147 + y + this.Offset.Y); 60 | this._itemText.Pos = new Point(300 + this.Offset.X + this.Parent.WidthOffset, y + 147 + this.Offset.Y); 61 | super.SetVerticalPosition(y); 62 | } 63 | SetRightLabel(text) { 64 | return this; 65 | } 66 | SetRightBadge(badge) { 67 | return this; 68 | } 69 | Draw() { 70 | super.Draw(); 71 | if (this._selectedValue == undefined) { 72 | if (this._selectedStartValueHandler != null) { 73 | this.SelectedValue = this._selectedStartValueHandler(); 74 | } 75 | else { 76 | this._selectedValue = ""; 77 | } 78 | } 79 | const offset = this._currentOffset; 80 | this._itemText.Color = this.Enabled 81 | ? this.Selected 82 | ? this.HighlightedForeColor 83 | : this.ForeColor 84 | : new Color(163, 159, 148); 85 | this._itemText.Caption = this.PreCaptionText + this._selectedValue; 86 | this._arrowLeft.Color = this.Enabled 87 | ? this.Selected 88 | ? this.HighlightedForeColor 89 | : this.ForeColor 90 | : new Color(163, 159, 148); 91 | this._arrowRight.Color = this.Enabled 92 | ? this.Selected 93 | ? this.HighlightedForeColor 94 | : this.ForeColor 95 | : new Color(163, 159, 148); 96 | this._arrowLeft.Pos = new Point(380 - offset + this.Offset.X + this.Parent.WidthOffset, this._arrowLeft.Pos.Y); 97 | if (this.Selected) { 98 | this._arrowLeft.Draw(); 99 | this._arrowRight.Draw(); 100 | this._itemText.Pos = new Point(405 + this.Offset.X + this.Parent.WidthOffset, this._itemText.Pos.Y); 101 | } 102 | else { 103 | this._itemText.Pos = new Point(420 + this.Offset.X + this.Parent.WidthOffset, this._itemText.Pos.Y); 104 | } 105 | this._itemText.Draw(); 106 | } 107 | isVariableFunction(functionToCheck) { 108 | return functionToCheck && {}.toString.call(functionToCheck) === '[object Function]'; 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /client/includes/NativeUI/items/UIMenuListItem.js: -------------------------------------------------------------------------------- 1 | import Font from "../enums/Font"; 2 | import Alignment from "../enums/Alignment"; 3 | import ItemsCollection from "../modules/ItemsCollection"; 4 | import ListItem from "../modules/ListItem"; 5 | import ResText from "../modules/ResText"; 6 | import Sprite from "../modules/Sprite"; 7 | import Color from "../utils/Color"; 8 | import Point from "../utils/Point"; 9 | import Size from "../utils/Size"; 10 | import Screen from "../utils/Screen"; 11 | import UIMenuItem from "./UIMenuItem"; 12 | export default class UIMenuListItem extends UIMenuItem { 13 | constructor(text, description = "", collection = new ItemsCollection([]), startIndex = 0, data = null) { 14 | super(text, description, data); 15 | this.ScrollingEnabled = true; 16 | this.HoldTimeBeforeScroll = 200; 17 | this._currentOffset = 0; 18 | this._itemsCollection = []; 19 | this._index = 0; 20 | let y = 0; 21 | this.Collection = collection.getListItems(); 22 | this.Index = startIndex; 23 | this._arrowLeft = new Sprite("commonmenu", "arrowleft", new Point(110, 105 + y), new Size(30, 30)); 24 | this._arrowRight = new Sprite("commonmenu", "arrowright", new Point(280, 105 + y), new Size(30, 30)); 25 | this._itemText = new ResText("", new Point(290, y + 104), 0.35, Color.White, Font.ChaletLondon, Alignment.Right); 26 | } 27 | get Collection() { 28 | return this._itemsCollection; 29 | } 30 | set Collection(v) { 31 | if (!v) 32 | throw new Error("The collection can't be null"); 33 | this._itemsCollection = v; 34 | } 35 | set SelectedItem(v) { 36 | const idx = this.Collection.findIndex(li => li.Id === v.Id); 37 | if (idx > 0) 38 | this.Index = idx; 39 | else 40 | this.Index = 0; 41 | } 42 | get SelectedItem() { 43 | return this.Collection.length > 0 ? this.Collection[this.Index] : null; 44 | } 45 | get SelectedValue() { 46 | return this.SelectedItem == null 47 | ? null 48 | : this.SelectedItem.Data == null 49 | ? this.SelectedItem.DisplayText 50 | : this.SelectedItem.Data; 51 | } 52 | get Index() { 53 | if (this.Collection == null) 54 | return -1; 55 | if (this.Collection != null && this.Collection.length == 0) 56 | return -1; 57 | return this._index % this.Collection.length; 58 | } 59 | set Index(value) { 60 | if (this.Collection == null) 61 | return; 62 | if (this.Collection != null && this.Collection.length == 0) 63 | return; 64 | this._index = 100000000 - (100000000 % this.Collection.length) + value; 65 | const caption = this.Collection.length >= this.Index 66 | ? this.Collection[this.Index].DisplayText 67 | : " "; 68 | this._currentOffset = Screen.GetTextWidth(caption, this._itemText && this._itemText.Font ? this._itemText.Font : 0, 0.35); 69 | } 70 | setCollection(collection) { 71 | this.Collection = collection.getListItems(); 72 | } 73 | setCollectionItem(index, item, resetSelection = true) { 74 | if (index > this.Collection.length) 75 | throw new Error("Index out of bounds"); 76 | if (typeof item === "string") 77 | item = new ListItem(item); 78 | this.Collection.splice(index, 1, item); 79 | if (resetSelection) 80 | this.Index = 0; 81 | } 82 | SetVerticalPosition(y) { 83 | this._arrowLeft.Pos = new Point(300 + this.Offset.X + this.Parent.WidthOffset, 147 + y + this.Offset.Y); 84 | this._arrowRight.Pos = new Point(400 + this.Offset.X + this.Parent.WidthOffset, 147 + y + this.Offset.Y); 85 | this._itemText.Pos = new Point(300 + this.Offset.X + this.Parent.WidthOffset, y + 147 + this.Offset.Y); 86 | super.SetVerticalPosition(y); 87 | } 88 | SetRightLabel(text) { 89 | return this; 90 | } 91 | SetRightBadge(badge) { 92 | return this; 93 | } 94 | Draw() { 95 | super.Draw(); 96 | const caption = this.Collection.length >= this.Index 97 | ? this.Collection[this.Index].DisplayText 98 | : " "; 99 | const offset = this._currentOffset; 100 | this._itemText.Color = this.Enabled 101 | ? this.Selected 102 | ? this.HighlightedForeColor 103 | : this.ForeColor 104 | : new Color(163, 159, 148); 105 | this._itemText.Caption = caption; 106 | this._arrowLeft.Color = this.Enabled 107 | ? this.Selected 108 | ? this.HighlightedForeColor 109 | : this.ForeColor 110 | : new Color(163, 159, 148); 111 | this._arrowRight.Color = this.Enabled 112 | ? this.Selected 113 | ? this.HighlightedForeColor 114 | : this.ForeColor 115 | : new Color(163, 159, 148); 116 | this._arrowLeft.Pos = new Point(380 - offset + this.Offset.X + this.Parent.WidthOffset, this._arrowLeft.Pos.Y); 117 | if (this.Selected) { 118 | this._arrowLeft.Draw(); 119 | this._arrowRight.Draw(); 120 | this._itemText.Pos = new Point(405 + this.Offset.X + this.Parent.WidthOffset, this._itemText.Pos.Y); 121 | } 122 | else { 123 | this._itemText.Pos = new Point(420 + this.Offset.X + this.Parent.WidthOffset, this._itemText.Pos.Y); 124 | } 125 | this._itemText.Draw(); 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /client/includes/NativeUI/items/UIMenuListItem.ts: -------------------------------------------------------------------------------- 1 | import BadgeStyle from "../enums/BadgeStyle"; 2 | import Font from "../enums/Font"; 3 | import Alignment from "../enums/Alignment"; 4 | import ItemsCollection from "../modules/ItemsCollection"; 5 | import ListItem from "../modules/ListItem"; 6 | import ResText from "../modules/ResText"; 7 | import Sprite from "../modules/Sprite"; 8 | import Color from "../utils/Color"; 9 | import Point from "../utils/Point"; 10 | import Size from "../utils/Size"; 11 | import Screen from "../utils/Screen"; 12 | import UIMenuItem from "./UIMenuItem"; 13 | 14 | export default class UIMenuListItem extends UIMenuItem { 15 | public ScrollingEnabled: boolean = true; 16 | public HoldTimeBeforeScroll: number = 200; 17 | 18 | protected _itemText: ResText; 19 | protected _arrowLeft: Sprite; 20 | protected _arrowRight: Sprite; 21 | 22 | private _currentOffset: number = 0; 23 | private _itemsCollection: Array = []; 24 | 25 | public get Collection() { 26 | return this._itemsCollection; 27 | } 28 | public set Collection(v) { 29 | if (!v) throw new Error("The collection can't be null"); 30 | this._itemsCollection = v; 31 | } 32 | 33 | public set SelectedItem(v: ListItem) { 34 | const idx = this.Collection.findIndex(li => li.Id === v.Id); 35 | if (idx > 0) 36 | this.Index = idx; 37 | else 38 | this.Index = 0; 39 | } 40 | 41 | public get SelectedItem() { 42 | return this.Collection.length > 0 ? this.Collection[this.Index] : null; 43 | } 44 | 45 | public get SelectedValue() { 46 | return this.SelectedItem == null 47 | ? null 48 | : this.SelectedItem.Data == null 49 | ? this.SelectedItem.DisplayText 50 | : this.SelectedItem.Data; 51 | } 52 | 53 | protected _index: number = 0; 54 | 55 | public get Index() { 56 | if (this.Collection == null) 57 | return -1; 58 | if (this.Collection != null && this.Collection.length == 0) 59 | return -1; 60 | 61 | return this._index % this.Collection.length; 62 | } 63 | public set Index(value) { 64 | if (this.Collection == null) 65 | return; 66 | if (this.Collection != null && this.Collection.length == 0) 67 | return; 68 | 69 | this._index = 100000000 - (100000000 % this.Collection.length) + value; 70 | 71 | const caption = this.Collection.length >= this.Index 72 | ? this.Collection[this.Index].DisplayText 73 | : " "; 74 | this._currentOffset = Screen.GetTextWidth(caption, this._itemText && this._itemText.Font ? this._itemText.Font : 0, 0.35); // this._itemText && this._itemText.font ? this._itemText.font : 0, this._itemText && this._itemText.scale ? this._itemText.scale : 0.35 75 | } 76 | 77 | constructor(text: string, description: string = "", collection: ItemsCollection = new ItemsCollection([]), startIndex: number = 0, data: any = null) { 78 | super(text, description, data); 79 | 80 | let y = 0; 81 | this.Collection = collection.getListItems(); 82 | this.Index = startIndex; 83 | this._arrowLeft = new Sprite("commonmenu", "arrowleft", new Point(110, 105 + y), new Size(30, 30)); 84 | this._arrowRight = new Sprite("commonmenu", "arrowright", new Point(280, 105 + y), new Size(30, 30)); 85 | this._itemText = new ResText("", new Point(290, y + 104), 0.35, Color.White, Font.ChaletLondon, Alignment.Right); 86 | } 87 | 88 | public setCollection(collection: ItemsCollection) { 89 | this.Collection = collection.getListItems(); 90 | } 91 | 92 | public setCollectionItem(index: number, item: ListItem | string, resetSelection: boolean = true) { 93 | if (index > this.Collection.length) 94 | // Placeholder for formatting 95 | throw new Error("Index out of bounds"); 96 | if (typeof item === "string") 97 | // Placeholder for formatting 98 | item = new ListItem(item); 99 | 100 | this.Collection.splice(index, 1, item); 101 | 102 | if (resetSelection) 103 | // Placeholder for formatting 104 | this.Index = 0; 105 | } 106 | 107 | public SetVerticalPosition(y: number) { 108 | this._arrowLeft.Pos = new Point(300 + this.Offset.X + this.Parent.WidthOffset, 147 + y + this.Offset.Y); 109 | this._arrowRight.Pos = new Point(400 + this.Offset.X + this.Parent.WidthOffset, 147 + y + this.Offset.Y); 110 | this._itemText.Pos = new Point(300 + this.Offset.X + this.Parent.WidthOffset, y + 147 + this.Offset.Y); 111 | super.SetVerticalPosition(y); 112 | } 113 | 114 | public SetRightLabel(text: string) { 115 | return this; 116 | } 117 | 118 | public SetRightBadge(badge: BadgeStyle) { 119 | return this; 120 | } 121 | 122 | public Draw() { 123 | super.Draw(); 124 | const caption = this.Collection.length >= this.Index 125 | ? this.Collection[this.Index].DisplayText 126 | : " "; 127 | const offset = this._currentOffset; 128 | 129 | this._itemText.Color = this.Enabled 130 | ? this.Selected 131 | ? this.HighlightedForeColor 132 | : this.ForeColor 133 | : new Color(163, 159, 148); 134 | 135 | this._itemText.Caption = caption; 136 | 137 | this._arrowLeft.Color = this.Enabled 138 | ? this.Selected 139 | ? this.HighlightedForeColor 140 | : this.ForeColor 141 | : new Color(163, 159, 148); 142 | this._arrowRight.Color = this.Enabled 143 | ? this.Selected 144 | ? this.HighlightedForeColor 145 | : this.ForeColor 146 | : new Color(163, 159, 148); 147 | 148 | this._arrowLeft.Pos = new Point(380 - offset + this.Offset.X + this.Parent.WidthOffset, this._arrowLeft.Pos.Y); 149 | 150 | if (this.Selected) { 151 | this._arrowLeft.Draw(); 152 | this._arrowRight.Draw(); 153 | this._itemText.Pos = new Point(405 + this.Offset.X + this.Parent.WidthOffset, this._itemText.Pos.Y); 154 | } else { 155 | this._itemText.Pos = new Point(420 + this.Offset.X + this.Parent.WidthOffset, this._itemText.Pos.Y); 156 | } 157 | this._itemText.Draw(); 158 | } 159 | } 160 | -------------------------------------------------------------------------------- /client/includes/NativeUI/items/UIMenuDynamicListItem.ts: -------------------------------------------------------------------------------- 1 | import * as alt from 'alt-client'; 2 | import BadgeStyle from "../enums/BadgeStyle"; 3 | import Font from "../enums/Font"; 4 | import Alignment from "../enums/Alignment"; 5 | import ChangeDirection from "../enums/ChangeDirection"; 6 | import ResText from "../modules/ResText"; 7 | import Sprite from "../modules/Sprite"; 8 | import Color from "../utils/Color"; 9 | import Point from "../utils/Point"; 10 | import Size from "../utils/Size"; 11 | import Screen from "../utils/Screen"; 12 | import UIMenuItem from "./UIMenuItem"; 13 | 14 | interface SelectionChangeHandler { 15 | (item: UIMenuDynamicListItem, selectedValue: string, changeDirection: ChangeDirection): string 16 | } 17 | 18 | interface SelectedStartValueHandler { 19 | (): string 20 | } 21 | 22 | export default class UIMenuDynamicListItem extends UIMenuItem { 23 | protected _itemText: ResText; 24 | protected _arrowLeft: Sprite; 25 | protected _arrowRight: Sprite; 26 | 27 | private _currentOffset: number = 0; 28 | private _precaptionText: string = ''; 29 | private _selectedValue: string; 30 | private readonly _selectedStartValueHandler: SelectedStartValueHandler = null; 31 | 32 | public readonly SelectionChangeHandler: SelectionChangeHandler = null; 33 | public SelectionChangeHandlerPromise(item: UIMenuDynamicListItem, selectedValue: string, changeDirection: ChangeDirection): Promise { 34 | return new Promise((resolve, reject) => { 35 | let newSelectedValue: string = this.SelectionChangeHandler(item, selectedValue, changeDirection); 36 | resolve(newSelectedValue); 37 | }); 38 | } 39 | 40 | public get PreCaptionText() { 41 | return this._precaptionText; 42 | } 43 | public set PreCaptionText(text) { 44 | if (!text) throw new Error("The pre caption text can't be null"); 45 | if (typeof text !== 'string') throw new Error("The pre caption text must be a string"); 46 | this._precaptionText = text; 47 | this._currentOffset = Screen.GetTextWidth(this.PreCaptionText + this._selectedValue, this._itemText && this._itemText.Font ? this._itemText.Font : 0, 0.35); 48 | } 49 | 50 | public get SelectedValue(): string { 51 | return this._selectedValue; 52 | } 53 | public set SelectedValue(value: string) { 54 | this._selectedValue = value; 55 | if (value == undefined) 56 | return; 57 | 58 | this._currentOffset = Screen.GetTextWidth(this.PreCaptionText + this._selectedValue, this._itemText && this._itemText.Font ? this._itemText.Font : 0, this._itemText && this._itemText.Scale ? this._itemText.Scale : 0.35); 59 | } 60 | 61 | constructor(text: string, selectionChangeHandler: { (item: UIMenuDynamicListItem, selectedValue: string, changeDirection: ChangeDirection): string }, description: string = "", selectedStartValueHandler: { (): string } = null, data: any = null) { 62 | super(text, description, data); 63 | 64 | if (!this.isVariableFunction(selectionChangeHandler)) { 65 | alt.logError(`[UIMenuDynamicListItem] ${text} is not created with a valid selectionChangeHandler, needs to be function. Please see docs.`); 66 | } 67 | if (!this.isVariableFunction(selectedStartValueHandler)) { 68 | alt.logError(`[UIMenuDynamicListItem] ${text} is not created with a valid selectedStartValueHandler, needs to be function. Please see docs.`); 69 | } 70 | 71 | this.SelectionChangeHandler = selectionChangeHandler; 72 | this._selectedStartValueHandler = selectedStartValueHandler; 73 | let y = 0; 74 | 75 | this._arrowLeft = new Sprite("commonmenu", "arrowleft", new Point(110, 105 + y), new Size(30, 30)); 76 | this._arrowRight = new Sprite("commonmenu", "arrowright", new Point(280, 105 + y), new Size(30, 30)); 77 | this._itemText = new ResText("", new Point(290, y + 104), 0.35, Color.White, Font.ChaletLondon, Alignment.Right); 78 | } 79 | 80 | public SetVerticalPosition(y: number) { 81 | this._arrowLeft.Pos = new Point(300 + this.Offset.X + this.Parent.WidthOffset, 147 + y + this.Offset.Y); 82 | this._arrowRight.Pos = new Point(400 + this.Offset.X + this.Parent.WidthOffset, 147 + y + this.Offset.Y); 83 | this._itemText.Pos = new Point(300 + this.Offset.X + this.Parent.WidthOffset, y + 147 + this.Offset.Y); 84 | super.SetVerticalPosition(y); 85 | } 86 | 87 | public SetRightLabel(text: string) { 88 | return this; 89 | } 90 | 91 | public SetRightBadge(badge: BadgeStyle) { 92 | return this; 93 | } 94 | 95 | public Draw() { 96 | super.Draw(); 97 | if (this._selectedValue == undefined) { 98 | if (this._selectedStartValueHandler != null) { 99 | this.SelectedValue = this._selectedStartValueHandler(); 100 | } 101 | else { 102 | this._selectedValue = ""; 103 | } 104 | } 105 | 106 | const offset = this._currentOffset; 107 | 108 | this._itemText.Color = this.Enabled 109 | ? this.Selected 110 | ? this.HighlightedForeColor 111 | : this.ForeColor 112 | : new Color(163, 159, 148); 113 | 114 | this._itemText.Caption = this.PreCaptionText + this._selectedValue; 115 | 116 | this._arrowLeft.Color = this.Enabled 117 | ? this.Selected 118 | ? this.HighlightedForeColor 119 | : this.ForeColor 120 | : new Color(163, 159, 148); 121 | this._arrowRight.Color = this.Enabled 122 | ? this.Selected 123 | ? this.HighlightedForeColor 124 | : this.ForeColor 125 | : new Color(163, 159, 148); 126 | 127 | this._arrowLeft.Pos = new Point(380 - offset + this.Offset.X + this.Parent.WidthOffset, this._arrowLeft.Pos.Y); 128 | 129 | if (this.Selected) { 130 | this._arrowLeft.Draw(); 131 | this._arrowRight.Draw(); 132 | this._itemText.Pos = new Point(405 + this.Offset.X + this.Parent.WidthOffset, this._itemText.Pos.Y); 133 | } else { 134 | this._itemText.Pos = new Point(420 + this.Offset.X + this.Parent.WidthOffset, this._itemText.Pos.Y); 135 | } 136 | this._itemText.Draw(); 137 | } 138 | 139 | private isVariableFunction(functionToCheck: any): boolean { 140 | return functionToCheck && {}.toString.call(functionToCheck) === '[object Function]'; 141 | } 142 | } -------------------------------------------------------------------------------- /client/includes/NativeUI/items/UIMenuAutoListItem.js: -------------------------------------------------------------------------------- 1 | import Font from "../enums/Font"; 2 | import Alignment from "../enums/Alignment"; 3 | import ResText from "../modules/ResText"; 4 | import Sprite from "../modules/Sprite"; 5 | import Color from "../utils/Color"; 6 | import Point from "../utils/Point"; 7 | import Size from "../utils/Size"; 8 | import Screen from "../utils/Screen"; 9 | import UIMenuItem from "./UIMenuItem"; 10 | export default class UIMenuAutoListItem extends UIMenuItem { 11 | constructor(text, description = "", lowerThreshold = 0, upperThreshold = 10, startValue = 0, data = null) { 12 | super(text, description, data); 13 | this._currentOffset = 0; 14 | this._leftMoveThreshold = 1; 15 | this._rightMoveThreshold = 1; 16 | this._lowerThreshold = 0; 17 | this._upperThreshold = 10; 18 | this._preCaptionText = ''; 19 | this._postCaptionText = ''; 20 | let y = 0; 21 | this.LowerThreshold = lowerThreshold; 22 | this.UpperThreshold = lowerThreshold > upperThreshold ? lowerThreshold : upperThreshold; 23 | this.SelectedValue = (startValue < lowerThreshold || startValue > upperThreshold) ? lowerThreshold : startValue; 24 | this._arrowLeft = new Sprite("commonmenu", "arrowleft", new Point(110, 105 + y), new Size(30, 30)); 25 | this._arrowRight = new Sprite("commonmenu", "arrowright", new Point(280, 105 + y), new Size(30, 30)); 26 | this._itemText = new ResText("", new Point(290, y + 104), 0.35, Color.White, Font.ChaletLondon, Alignment.Right); 27 | } 28 | get PreCaptionText() { 29 | return this._preCaptionText; 30 | } 31 | set PreCaptionText(text) { 32 | if (!text) 33 | throw new Error("The pre caption text can't be null"); 34 | if (typeof text !== 'string') 35 | throw new Error("The pre caption text must be a string"); 36 | this._preCaptionText = text; 37 | this._currentOffset = Screen.GetTextWidth(this.PreCaptionText + this._selectedValue.toString() + this.PostCaptionText, this._itemText && this._itemText.Font ? this._itemText.Font : 0, 0.35); 38 | } 39 | get PostCaptionText() { 40 | return this._postCaptionText; 41 | } 42 | set PostCaptionText(text) { 43 | if (!text) 44 | throw new Error("The post caption text can't be null"); 45 | if (typeof text !== 'string') 46 | throw new Error("The post caption text must be a string"); 47 | this._postCaptionText = text; 48 | this._currentOffset = Screen.GetTextWidth(this.PreCaptionText + this._selectedValue.toString() + this.PostCaptionText, this._itemText && this._itemText.Font ? this._itemText.Font : 0, 0.35); 49 | } 50 | get LeftMoveThreshold() { 51 | return this._leftMoveThreshold; 52 | } 53 | set LeftMoveThreshold(value) { 54 | if (!value) 55 | throw new Error("The left threshold can't be null"); 56 | this._leftMoveThreshold = value; 57 | } 58 | get RightMoveThreshold() { 59 | return this._rightMoveThreshold; 60 | } 61 | set RightMoveThreshold(value) { 62 | if (!value) 63 | throw new Error("The right threshold can't be null"); 64 | this._rightMoveThreshold = value; 65 | } 66 | get LowerThreshold() { 67 | return this._lowerThreshold; 68 | } 69 | set LowerThreshold(value) { 70 | if (typeof value !== 'number' && !value) 71 | throw new Error("The lower threshold can't be null"); 72 | this._lowerThreshold = value; 73 | if (this.SelectedValue < value) { 74 | this.SelectedValue = value; 75 | } 76 | } 77 | get UpperThreshold() { 78 | return this._upperThreshold; 79 | } 80 | set UpperThreshold(value) { 81 | if (typeof value !== 'number' && !value) 82 | throw new Error("The upper threshold can't be null"); 83 | this._upperThreshold = value; 84 | if (this.SelectedValue > value) { 85 | this.SelectedValue = value; 86 | } 87 | } 88 | get SelectedValue() { 89 | return this._selectedValue; 90 | } 91 | set SelectedValue(value) { 92 | if (value < this._lowerThreshold || value > this._upperThreshold) 93 | throw new Error("The value can not be outside the lower or upper limits"); 94 | this._selectedValue = value; 95 | this._currentOffset = Screen.GetTextWidth(this.PreCaptionText + this._selectedValue.toString() + this.PostCaptionText, this._itemText && this._itemText.Font ? this._itemText.Font : 0, this._itemText && this._itemText.Scale ? this._itemText.Scale : 0.35); 96 | } 97 | SetVerticalPosition(y) { 98 | this._arrowLeft.Pos = new Point(300 + this.Offset.X + this.Parent.WidthOffset, 147 + y + this.Offset.Y); 99 | this._arrowRight.Pos = new Point(400 + this.Offset.X + this.Parent.WidthOffset, 147 + y + this.Offset.Y); 100 | this._itemText.Pos = new Point(300 + this.Offset.X + this.Parent.WidthOffset, y + 147 + this.Offset.Y); 101 | super.SetVerticalPosition(y); 102 | } 103 | SetRightLabel(text) { 104 | return this; 105 | } 106 | SetRightBadge(badge) { 107 | return this; 108 | } 109 | Draw() { 110 | super.Draw(); 111 | const offset = this._currentOffset; 112 | this._itemText.Color = this.Enabled 113 | ? this.Selected 114 | ? this.HighlightedForeColor 115 | : this.ForeColor 116 | : new Color(163, 159, 148); 117 | this._itemText.Caption = this.PreCaptionText + this._selectedValue + this.PostCaptionText; 118 | this._arrowLeft.Color = this.Enabled 119 | ? this.Selected 120 | ? this.HighlightedForeColor 121 | : this.ForeColor 122 | : new Color(163, 159, 148); 123 | this._arrowRight.Color = this.Enabled 124 | ? this.Selected 125 | ? this.HighlightedForeColor 126 | : this.ForeColor 127 | : new Color(163, 159, 148); 128 | this._arrowLeft.Pos = new Point(380 - offset + this.Offset.X + this.Parent.WidthOffset, this._arrowLeft.Pos.Y); 129 | if (this.Selected) { 130 | this._arrowLeft.Draw(); 131 | this._arrowRight.Draw(); 132 | this._itemText.Pos = new Point(405 + this.Offset.X + this.Parent.WidthOffset, this._itemText.Pos.Y); 133 | } 134 | else { 135 | this._itemText.Pos = new Point(420 + this.Offset.X + this.Parent.WidthOffset, this._itemText.Pos.Y); 136 | } 137 | this._itemText.Draw(); 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /client/includes/NativeUI/enums/HudColor.ts: -------------------------------------------------------------------------------- 1 | enum HudColor { 2 | HUD_COLOUR_PURE_WHITE = 0, 3 | HUD_COLOUR_WHITE = 1, 4 | HUD_COLOUR_BLACK = 2, 5 | HUD_COLOUR_GREY = 3, 6 | HUD_COLOUR_GREYLIGHT = 4, 7 | HUD_COLOUR_GREYDARK = 5, 8 | HUD_COLOUR_RED = 6, 9 | HUD_COLOUR_REDLIGHT = 7, 10 | HUD_COLOUR_REDDARK = 8, 11 | HUD_COLOUR_BLUE = 9, 12 | HUD_COLOUR_BLUELIGHT = 10, 13 | HUD_COLOUR_BLUEDARK = 11, 14 | HUD_COLOUR_YELLOW = 12, 15 | HUD_COLOUR_YELLOWLIGHT = 13, 16 | HUD_COLOUR_YELLOWDARK = 14, 17 | HUD_COLOUR_ORANGE = 15, 18 | HUD_COLOUR_ORANGELIGHT = 16, 19 | HUD_COLOUR_ORANGEDARK = 17, 20 | HUD_COLOUR_GREEN = 18, 21 | HUD_COLOUR_GREENLIGHT = 19, 22 | HUD_COLOUR_GREENDARK = 20, 23 | HUD_COLOUR_PURPLE = 21, 24 | HUD_COLOUR_PURPLELIGHT = 22, 25 | HUD_COLOUR_PURPLEDARK = 23, 26 | HUD_COLOUR_PINK = 24, 27 | HUD_COLOUR_RADAR_HEALTH = 25, 28 | HUD_COLOUR_RADAR_ARMOUR = 26, 29 | HUD_COLOUR_RADAR_DAMAGE = 27, 30 | HUD_COLOUR_NET_PLAYER1 = 28, 31 | HUD_COLOUR_NET_PLAYER2 = 29, 32 | HUD_COLOUR_NET_PLAYER3 = 30, 33 | HUD_COLOUR_NET_PLAYER4 = 31, 34 | HUD_COLOUR_NET_PLAYER5 = 32, 35 | HUD_COLOUR_NET_PLAYER6 = 33, 36 | HUD_COLOUR_NET_PLAYER7 = 34, 37 | HUD_COLOUR_NET_PLAYER8 = 35, 38 | HUD_COLOUR_NET_PLAYER9 = 36, 39 | HUD_COLOUR_NET_PLAYER10 = 37, 40 | HUD_COLOUR_NET_PLAYER11 = 38, 41 | HUD_COLOUR_NET_PLAYER12 = 39, 42 | HUD_COLOUR_NET_PLAYER13 = 40, 43 | HUD_COLOUR_NET_PLAYER14 = 41, 44 | HUD_COLOUR_NET_PLAYER15 = 42, 45 | HUD_COLOUR_NET_PLAYER16 = 43, 46 | HUD_COLOUR_NET_PLAYER17 = 44, 47 | HUD_COLOUR_NET_PLAYER18 = 45, 48 | HUD_COLOUR_NET_PLAYER19 = 46, 49 | HUD_COLOUR_NET_PLAYER20 = 47, 50 | HUD_COLOUR_NET_PLAYER21 = 48, 51 | HUD_COLOUR_NET_PLAYER22 = 49, 52 | HUD_COLOUR_NET_PLAYER23 = 50, 53 | HUD_COLOUR_NET_PLAYER24 = 51, 54 | HUD_COLOUR_NET_PLAYER25 = 52, 55 | HUD_COLOUR_NET_PLAYER26 = 53, 56 | HUD_COLOUR_NET_PLAYER27 = 54, 57 | HUD_COLOUR_NET_PLAYER28 = 55, 58 | HUD_COLOUR_NET_PLAYER29 = 56, 59 | HUD_COLOUR_NET_PLAYER30 = 57, 60 | HUD_COLOUR_NET_PLAYER31 = 58, 61 | HUD_COLOUR_NET_PLAYER32 = 59, 62 | HUD_COLOUR_SIMPLEBLIP_DEFAULT = 60, 63 | HUD_COLOUR_MENU_BLUE = 61, 64 | HUD_COLOUR_MENU_GREY_LIGHT = 62, 65 | HUD_COLOUR_MENU_BLUE_EXTRA_DARK = 63, 66 | HUD_COLOUR_MENU_YELLOW = 64, 67 | HUD_COLOUR_MENU_YELLOW_DARK = 65, 68 | HUD_COLOUR_MENU_GREEN = 66, 69 | HUD_COLOUR_MENU_GREY = 67, 70 | HUD_COLOUR_MENU_GREY_DARK = 68, 71 | HUD_COLOUR_MENU_HIGHLIGHT = 69, 72 | HUD_COLOUR_MENU_STANDARD = 70, 73 | HUD_COLOUR_MENU_DIMMED = 71, 74 | HUD_COLOUR_MENU_EXTRA_DIMMED = 72, 75 | HUD_COLOUR_BRIEF_TITLE = 73, 76 | HUD_COLOUR_MID_GREY_MP = 74, 77 | HUD_COLOUR_NET_PLAYER1_DARK = 75, 78 | HUD_COLOUR_NET_PLAYER2_DARK = 76, 79 | HUD_COLOUR_NET_PLAYER3_DARK = 77, 80 | HUD_COLOUR_NET_PLAYER4_DARK = 78, 81 | HUD_COLOUR_NET_PLAYER5_DARK = 79, 82 | HUD_COLOUR_NET_PLAYER6_DARK = 80, 83 | HUD_COLOUR_NET_PLAYER7_DARK = 81, 84 | HUD_COLOUR_NET_PLAYER8_DARK = 82, 85 | HUD_COLOUR_NET_PLAYER9_DARK = 83, 86 | HUD_COLOUR_NET_PLAYER10_DARK = 84, 87 | HUD_COLOUR_NET_PLAYER11_DARK = 85, 88 | HUD_COLOUR_NET_PLAYER12_DARK = 86, 89 | HUD_COLOUR_NET_PLAYER13_DARK = 87, 90 | HUD_COLOUR_NET_PLAYER14_DARK = 88, 91 | HUD_COLOUR_NET_PLAYER15_DARK = 89, 92 | HUD_COLOUR_NET_PLAYER16_DARK = 90, 93 | HUD_COLOUR_NET_PLAYER17_DARK = 91, 94 | HUD_COLOUR_NET_PLAYER18_DARK = 92, 95 | HUD_COLOUR_NET_PLAYER19_DARK = 93, 96 | HUD_COLOUR_NET_PLAYER20_DARK = 94, 97 | HUD_COLOUR_NET_PLAYER21_DARK = 95, 98 | HUD_COLOUR_NET_PLAYER22_DARK = 96, 99 | HUD_COLOUR_NET_PLAYER23_DARK = 97, 100 | HUD_COLOUR_NET_PLAYER24_DARK = 98, 101 | HUD_COLOUR_NET_PLAYER25_DARK = 99, 102 | HUD_COLOUR_NET_PLAYER26_DARK = 100, 103 | HUD_COLOUR_NET_PLAYER27_DARK = 101, 104 | HUD_COLOUR_NET_PLAYER28_DARK = 102, 105 | HUD_COLOUR_NET_PLAYER29_DARK = 103, 106 | HUD_COLOUR_NET_PLAYER30_DARK = 104, 107 | HUD_COLOUR_NET_PLAYER31_DARK = 105, 108 | HUD_COLOUR_NET_PLAYER32_DARK = 106, 109 | HUD_COLOUR_BRONZE = 107, 110 | HUD_COLOUR_SILVER = 108, 111 | HUD_COLOUR_GOLD = 109, 112 | HUD_COLOUR_PLATINUM = 110, 113 | HUD_COLOUR_GANG1 = 111, 114 | HUD_COLOUR_GANG2 = 112, 115 | HUD_COLOUR_GANG3 = 113, 116 | HUD_COLOUR_GANG4 = 114, 117 | HUD_COLOUR_SAME_CREW = 115, 118 | HUD_COLOUR_FREEMODE = 116, 119 | HUD_COLOUR_PAUSE_BG = 117, 120 | HUD_COLOUR_FRIENDLY = 118, 121 | HUD_COLOUR_ENEMY = 119, 122 | HUD_COLOUR_LOCATION = 120, 123 | HUD_COLOUR_PICKUP = 121, 124 | HUD_COLOUR_PAUSE_SINGLEPLAYER = 122, 125 | HUD_COLOUR_FREEMODE_DARK = 123, 126 | HUD_COLOUR_INACTIVE_MISSION = 124, 127 | HUD_COLOUR_DAMAGE = 125, 128 | HUD_COLOUR_PINKLIGHT = 126, 129 | HUD_COLOUR_PM_MITEM_HIGHLIGHT = 127, 130 | HUD_COLOUR_SCRIPT_VARIABLE = 128, 131 | HUD_COLOUR_YOGA = 129, 132 | HUD_COLOUR_TENNIS = 130, 133 | HUD_COLOUR_GOLF = 131, 134 | HUD_COLOUR_SHOOTING_RANGE = 132, 135 | HUD_COLOUR_FLIGHT_SCHOOL = 133, 136 | HUD_COLOUR_NORTH_BLUE = 134, 137 | HUD_COLOUR_SOCIAL_CLUB = 135, 138 | HUD_COLOUR_PLATFORM_BLUE = 136, 139 | HUD_COLOUR_PLATFORM_GREEN = 137, 140 | HUD_COLOUR_PLATFORM_GREY = 138, 141 | HUD_COLOUR_FACEBOOK_BLUE = 139, 142 | HUD_COLOUR_INGAME_BG = 140, 143 | HUD_COLOUR_DARTS = 141, 144 | HUD_COLOUR_WAYPOINT = 142, 145 | HUD_COLOUR_MICHAEL = 143, 146 | HUD_COLOUR_FRANKLIN = 144, 147 | HUD_COLOUR_TREVOR = 145, 148 | HUD_COLOUR_GOLF_P1 = 146, 149 | HUD_COLOUR_GOLF_P2 = 147, 150 | HUD_COLOUR_GOLF_P3 = 148, 151 | HUD_COLOUR_GOLF_P4 = 149, 152 | HUD_COLOUR_WAYPOINTLIGHT = 150, 153 | HUD_COLOUR_WAYPOINTDARK = 151, 154 | HUD_COLOUR_PANEL_LIGHT = 152, 155 | HUD_COLOUR_MICHAEL_DARK = 153, 156 | HUD_COLOUR_FRANKLIN_DARK = 154, 157 | HUD_COLOUR_TREVOR_DARK = 155, 158 | HUD_COLOUR_OBJECTIVE_ROUTE = 156, 159 | HUD_COLOUR_PAUSEMAP_TINT = 157, 160 | HUD_COLOUR_PAUSE_DESELECT = 158, 161 | HUD_COLOUR_PM_WEAPONS_PURCHASABLE = 159, 162 | HUD_COLOUR_PM_WEAPONS_LOCKED = 160, 163 | HUD_COLOUR_END_SCREEN_BG = 161, 164 | HUD_COLOUR_CHOP = 162, 165 | HUD_COLOUR_PAUSEMAP_TINT_HALF = 163, 166 | HUD_COLOUR_NORTH_BLUE_OFFICIAL = 164, 167 | HUD_COLOUR_SCRIPT_VARIABLE_2 = 165, 168 | HUD_COLOUR_H = 166, 169 | HUD_COLOUR_HDARK = 167, 170 | HUD_COLOUR_T = 168, 171 | HUD_COLOUR_TDARK = 169, 172 | HUD_COLOUR_HSHARD = 170, 173 | HUD_COLOUR_CONTROLLER_MICHAEL = 171, 174 | HUD_COLOUR_CONTROLLER_FRANKLIN = 172, 175 | HUD_COLOUR_CONTROLLER_TREVOR = 173, 176 | HUD_COLOUR_CONTROLLER_CHOP = 174, 177 | HUD_COLOUR_VIDEO_EDITOR_VIDEO = 175, 178 | HUD_COLOUR_VIDEO_EDITOR_AUDIO = 176, 179 | HUD_COLOUR_VIDEO_EDITOR_TEXT = 177, 180 | HUD_COLOUR_HB_BLUE = 178, 181 | HUD_COLOUR_HB_YELLOW = 179, 182 | } 183 | 184 | export default HudColor; -------------------------------------------------------------------------------- /client/includes/NativeUI/items/UIMenuAutoListItem.ts: -------------------------------------------------------------------------------- 1 | import BadgeStyle from "../enums/BadgeStyle"; 2 | import Font from "../enums/Font"; 3 | import Alignment from "../enums/Alignment"; 4 | import ResText from "../modules/ResText"; 5 | import Sprite from "../modules/Sprite"; 6 | import Color from "../utils/Color"; 7 | import Point from "../utils/Point"; 8 | import Size from "../utils/Size"; 9 | import Screen from "../utils/Screen"; 10 | import UIMenuItem from "./UIMenuItem"; 11 | 12 | export default class UIMenuAutoListItem extends UIMenuItem { 13 | protected _itemText: ResText; 14 | protected _arrowLeft: Sprite; 15 | protected _arrowRight: Sprite; 16 | 17 | private _currentOffset: number = 0; 18 | private _leftMoveThreshold: number = 1; 19 | private _rightMoveThreshold: number = 1; 20 | private _lowerThreshold: number = 0; 21 | private _upperThreshold: number = 10; 22 | private _preCaptionText: string = ''; 23 | private _postCaptionText: string = ''; 24 | private _selectedValue: number; 25 | 26 | public get PreCaptionText() { 27 | return this._preCaptionText; 28 | } 29 | public set PreCaptionText(text: string) { 30 | if (!text) throw new Error("The pre caption text can't be null"); 31 | if (typeof text !== 'string') throw new Error("The pre caption text must be a string"); 32 | this._preCaptionText = text; 33 | this._currentOffset = Screen.GetTextWidth(this.PreCaptionText + this._selectedValue.toString() + this.PostCaptionText, this._itemText && this._itemText.Font ? this._itemText.Font : 0, 0.35); // this._itemText && this._itemText.scale ? this._itemText.scale : 0.35 34 | } 35 | 36 | public get PostCaptionText() { 37 | return this._postCaptionText; 38 | } 39 | public set PostCaptionText(text: string) { 40 | if (!text) throw new Error("The post caption text can't be null"); 41 | if (typeof text !== 'string') throw new Error("The post caption text must be a string"); 42 | this._postCaptionText = text; 43 | this._currentOffset = Screen.GetTextWidth(this.PreCaptionText + this._selectedValue.toString() + this.PostCaptionText, this._itemText && this._itemText.Font ? this._itemText.Font : 0, 0.35); // this._itemText && this._itemText.scale ? this._itemText.scale : 0.35 44 | } 45 | 46 | public get LeftMoveThreshold() { 47 | return this._leftMoveThreshold; 48 | } 49 | public set LeftMoveThreshold(value: number) { 50 | if (!value) throw new Error("The left threshold can't be null"); 51 | 52 | this._leftMoveThreshold = value; 53 | } 54 | 55 | public get RightMoveThreshold() { 56 | return this._rightMoveThreshold; 57 | } 58 | public set RightMoveThreshold(value: number) { 59 | if (!value) throw new Error("The right threshold can't be null"); 60 | 61 | this._rightMoveThreshold = value; 62 | } 63 | 64 | public get LowerThreshold() { 65 | return this._lowerThreshold; 66 | } 67 | public set LowerThreshold(value: number) { 68 | if (typeof value !== 'number' && !value) throw new Error("The lower threshold can't be null"); 69 | 70 | this._lowerThreshold = value; 71 | if (this.SelectedValue < value) { 72 | this.SelectedValue = value; 73 | } 74 | } 75 | 76 | public get UpperThreshold() { 77 | return this._upperThreshold; 78 | } 79 | public set UpperThreshold(value: number) { 80 | if (typeof value !== 'number' && !value) throw new Error("The upper threshold can't be null"); 81 | 82 | this._upperThreshold = value; 83 | if (this.SelectedValue > value) { 84 | this.SelectedValue = value; 85 | } 86 | } 87 | 88 | public get SelectedValue() { 89 | return this._selectedValue; 90 | } 91 | public set SelectedValue(value: number) { 92 | if (value < this._lowerThreshold || value > this._upperThreshold) throw new Error("The value can not be outside the lower or upper limits"); 93 | 94 | this._selectedValue = value; 95 | this._currentOffset = Screen.GetTextWidth(this.PreCaptionText + this._selectedValue.toString() + this.PostCaptionText, this._itemText && this._itemText.Font ? this._itemText.Font : 0, this._itemText && this._itemText.Scale ? this._itemText.Scale : 0.35); 96 | } 97 | 98 | constructor(text: string, description: string = "", lowerThreshold: number = 0, upperThreshold: number = 10, startValue: number = 0, data: any = null) { 99 | super(text, description, data); 100 | 101 | let y = 0; 102 | this.LowerThreshold = lowerThreshold; 103 | this.UpperThreshold = lowerThreshold > upperThreshold ? lowerThreshold : upperThreshold; 104 | this.SelectedValue = (startValue < lowerThreshold || startValue > upperThreshold) ? lowerThreshold : startValue; 105 | this._arrowLeft = new Sprite("commonmenu", "arrowleft", new Point(110, 105 + y), new Size(30, 30)); 106 | this._arrowRight = new Sprite("commonmenu", "arrowright", new Point(280, 105 + y), new Size(30, 30)); 107 | this._itemText = new ResText("", new Point(290, y + 104), 0.35, Color.White, Font.ChaletLondon, Alignment.Right); 108 | } 109 | 110 | public SetVerticalPosition(y: number) { 111 | this._arrowLeft.Pos = new Point(300 + this.Offset.X + this.Parent.WidthOffset, 147 + y + this.Offset.Y); 112 | this._arrowRight.Pos = new Point(400 + this.Offset.X + this.Parent.WidthOffset, 147 + y + this.Offset.Y); 113 | this._itemText.Pos = new Point(300 + this.Offset.X + this.Parent.WidthOffset, y + 147 + this.Offset.Y); 114 | super.SetVerticalPosition(y); 115 | } 116 | 117 | public SetRightLabel(text: string) { 118 | return this; 119 | } 120 | 121 | public SetRightBadge(badge: BadgeStyle) { 122 | return this; 123 | } 124 | 125 | public Draw() { 126 | super.Draw(); 127 | const offset = this._currentOffset; 128 | 129 | this._itemText.Color = this.Enabled 130 | ? this.Selected 131 | ? this.HighlightedForeColor 132 | : this.ForeColor 133 | : new Color(163, 159, 148); 134 | 135 | this._itemText.Caption = this.PreCaptionText + this._selectedValue + this.PostCaptionText; 136 | 137 | this._arrowLeft.Color = this.Enabled 138 | ? this.Selected 139 | ? this.HighlightedForeColor 140 | : this.ForeColor 141 | : new Color(163, 159, 148); 142 | this._arrowRight.Color = this.Enabled 143 | ? this.Selected 144 | ? this.HighlightedForeColor 145 | : this.ForeColor 146 | : new Color(163, 159, 148); 147 | 148 | this._arrowLeft.Pos = new Point(380 - offset + this.Offset.X + this.Parent.WidthOffset, this._arrowLeft.Pos.Y); 149 | 150 | if (this.Selected) { 151 | this._arrowLeft.Draw(); 152 | this._arrowRight.Draw(); 153 | this._itemText.Pos = new Point(405 + this.Offset.X + this.Parent.WidthOffset, this._itemText.Pos.Y); 154 | } else { 155 | this._itemText.Pos = new Point(420 + this.Offset.X + this.Parent.WidthOffset, this._itemText.Pos.Y); 156 | } 157 | this._itemText.Draw(); 158 | } 159 | } -------------------------------------------------------------------------------- /client/includes/NativeUI/enums/Control.ts: -------------------------------------------------------------------------------- 1 | enum Control { 2 | NextCamera, 3 | LookLeftRight, 4 | LookUpDown, 5 | LookUpOnly, 6 | LookDownOnly, 7 | LookLeftOnly, 8 | LookRightOnly, 9 | CinematicSlowMo, 10 | FlyUpDown, 11 | FlyLeftRight, 12 | ScriptedFlyZUp, 13 | ScriptedFlyZDown, 14 | WeaponWheelUpDown, 15 | WeaponWheelLeftRight, 16 | WeaponWheelNext, 17 | WeaponWheelPrev, 18 | SelectNextWeapon, 19 | SelectPrevWeapon, 20 | SkipCutscene, 21 | CharacterWheel, 22 | MultiplayerInfo, 23 | Sprint, 24 | Jump, 25 | Enter, 26 | Attack, 27 | Aim, 28 | LookBehind, 29 | Phone, 30 | SpecialAbility, 31 | SpecialAbilitySecondary, 32 | MoveLeftRight, 33 | MoveUpDown, 34 | MoveUpOnly, 35 | MoveDownOnly, 36 | MoveLeftOnly, 37 | MoveRightOnly, 38 | Duck, 39 | SelectWeapon, 40 | Pickup, 41 | SniperZoom, 42 | SniperZoomInOnly, 43 | SniperZoomOutOnly, 44 | SniperZoomInSecondary, 45 | SniperZoomOutSecondary, 46 | Cover, 47 | Reload, 48 | Talk, 49 | Detonate, 50 | HUDSpecial, 51 | Arrest, 52 | AccurateAim, 53 | Context, 54 | ContextSecondary, 55 | WeaponSpecial, 56 | WeaponSpecial2, 57 | Dive, 58 | DropWeapon, 59 | DropAmmo, 60 | ThrowGrenade, 61 | VehicleMoveLeftRight, 62 | VehicleMoveUpDown, 63 | VehicleMoveUpOnly, 64 | VehicleMoveDownOnly, 65 | VehicleMoveLeftOnly, 66 | VehicleMoveRightOnly, 67 | VehicleSpecial, 68 | VehicleGunLeftRight, 69 | VehicleGunUpDown, 70 | VehicleAim, 71 | VehicleAttack, 72 | VehicleAttack2, 73 | VehicleAccelerate, 74 | VehicleBrake, 75 | VehicleDuck, 76 | VehicleHeadlight, 77 | VehicleExit, 78 | VehicleHandbrake, 79 | VehicleHotwireLeft, 80 | VehicleHotwireRight, 81 | VehicleLookBehind, 82 | VehicleCinCam, 83 | VehicleNextRadio, 84 | VehiclePrevRadio, 85 | VehicleNextRadioTrack, 86 | VehiclePrevRadioTrack, 87 | VehicleRadioWheel, 88 | VehicleHorn, 89 | VehicleFlyThrottleUp, 90 | VehicleFlyThrottleDown, 91 | VehicleFlyYawLeft, 92 | VehicleFlyYawRight, 93 | VehiclePassengerAim, 94 | VehiclePassengerAttack, 95 | VehicleSpecialAbilityFranklin, 96 | VehicleStuntUpDown, 97 | VehicleCinematicUpDown, 98 | VehicleCinematicUpOnly, 99 | VehicleCinematicDownOnly, 100 | VehicleCinematicLeftRight, 101 | VehicleSelectNextWeapon, 102 | VehicleSelectPrevWeapon, 103 | VehicleRoof, 104 | VehicleJump, 105 | VehicleGrapplingHook, 106 | VehicleShuffle, 107 | VehicleDropProjectile, 108 | VehicleMouseControlOverride, 109 | VehicleFlyRollLeftRight, 110 | VehicleFlyRollLeftOnly, 111 | VehicleFlyRollRightOnly, 112 | VehicleFlyPitchUpDown, 113 | VehicleFlyPitchUpOnly, 114 | VehicleFlyPitchDownOnly, 115 | VehicleFlyUnderCarriage, 116 | VehicleFlyAttack, 117 | VehicleFlySelectNextWeapon, 118 | VehicleFlySelectPrevWeapon, 119 | VehicleFlySelectTargetLeft, 120 | VehicleFlySelectTargetRight, 121 | VehicleFlyVerticalFlightMode, 122 | VehicleFlyDuck, 123 | VehicleFlyAttackCamera, 124 | VehicleFlyMouseControlOverride, 125 | VehicleSubTurnLeftRight, 126 | VehicleSubTurnLeftOnly, 127 | VehicleSubTurnRightOnly, 128 | VehicleSubPitchUpDown, 129 | VehicleSubPitchUpOnly, 130 | VehicleSubPitchDownOnly, 131 | VehicleSubThrottleUp, 132 | VehicleSubThrottleDown, 133 | VehicleSubAscend, 134 | VehicleSubDescend, 135 | VehicleSubTurnHardLeft, 136 | VehicleSubTurnHardRight, 137 | VehicleSubMouseControlOverride, 138 | VehiclePushbikePedal, 139 | VehiclePushbikeSprint, 140 | VehiclePushbikeFrontBrake, 141 | VehiclePushbikeRearBrake, 142 | MeleeAttackLight, 143 | MeleeAttackHeavy, 144 | MeleeAttackAlternate, 145 | MeleeBlock, 146 | ParachuteDeploy, 147 | ParachuteDetach, 148 | ParachuteTurnLeftRight, 149 | ParachuteTurnLeftOnly, 150 | ParachuteTurnRightOnly, 151 | ParachutePitchUpDown, 152 | ParachutePitchUpOnly, 153 | ParachutePitchDownOnly, 154 | ParachuteBrakeLeft, 155 | ParachuteBrakeRight, 156 | ParachuteSmoke, 157 | ParachutePrecisionLanding, 158 | Map, 159 | SelectWeaponUnarmed, 160 | SelectWeaponMelee, 161 | SelectWeaponHandgun, 162 | SelectWeaponShotgun, 163 | SelectWeaponSmg, 164 | SelectWeaponAutoRifle, 165 | SelectWeaponSniper, 166 | SelectWeaponHeavy, 167 | SelectWeaponSpecial, 168 | SelectCharacterMichael, 169 | SelectCharacterFranklin, 170 | SelectCharacterTrevor, 171 | SelectCharacterMultiplayer, 172 | SaveReplayClip, 173 | SpecialAbilityPC, 174 | PhoneUp, 175 | PhoneDown, 176 | PhoneLeft, 177 | PhoneRight, 178 | PhoneSelect, 179 | PhoneCancel, 180 | PhoneOption, 181 | PhoneExtraOption, 182 | PhoneScrollForward, 183 | PhoneScrollBackward, 184 | PhoneCameraFocusLock, 185 | PhoneCameraGrid, 186 | PhoneCameraSelfie, 187 | PhoneCameraDOF, 188 | PhoneCameraExpression, 189 | FrontendDown, 190 | FrontendUp, 191 | FrontendLeft, 192 | FrontendRight, 193 | FrontendRdown, 194 | FrontendRup, 195 | FrontendRleft, 196 | FrontendRright, 197 | FrontendAxisX, 198 | FrontendAxisY, 199 | FrontendRightAxisX, 200 | FrontendRightAxisY, 201 | FrontendPause, 202 | FrontendPauseAlternate, 203 | FrontendAccept, 204 | FrontendCancel, 205 | FrontendX, 206 | FrontendY, 207 | FrontendLb, 208 | FrontendRb, 209 | FrontendLt, 210 | FrontendRt, 211 | FrontendLs, 212 | FrontendRs, 213 | FrontendLeaderboard, 214 | FrontendSocialClub, 215 | FrontendSocialClubSecondary, 216 | FrontendDelete, 217 | FrontendEndscreenAccept, 218 | FrontendEndscreenExpand, 219 | FrontendSelect, 220 | ScriptLeftAxisX, 221 | ScriptLeftAxisY, 222 | ScriptRightAxisX, 223 | ScriptRightAxisY, 224 | ScriptRUp, 225 | ScriptRDown, 226 | ScriptRLeft, 227 | ScriptRRight, 228 | ScriptLB, 229 | ScriptRB, 230 | ScriptLT, 231 | ScriptRT, 232 | ScriptLS, 233 | ScriptRS, 234 | ScriptPadUp, 235 | ScriptPadDown, 236 | ScriptPadLeft, 237 | ScriptPadRight, 238 | ScriptSelect, 239 | CursorAccept, 240 | CursorCancel, 241 | CursorX, 242 | CursorY, 243 | CursorScrollUp, 244 | CursorScrollDown, 245 | EnterCheatCode, 246 | InteractionMenu, 247 | MpTextChatAll, 248 | MpTextChatTeam, 249 | MpTextChatFriends, 250 | MpTextChatCrew, 251 | PushToTalk, 252 | CreatorLS, 253 | CreatorRS, 254 | CreatorLT, 255 | CreatorRT, 256 | CreatorMenuToggle, 257 | CreatorAccept, 258 | CreatorDelete, 259 | Attack2, 260 | RappelJump, 261 | RappelLongJump, 262 | RappelSmashWindow, 263 | PrevWeapon, 264 | NextWeapon, 265 | MeleeAttack1, 266 | MeleeAttack2, 267 | Whistle, 268 | MoveLeft, 269 | MoveRight, 270 | MoveUp, 271 | MoveDown, 272 | LookLeft, 273 | LookRight, 274 | LookUp, 275 | LookDown, 276 | SniperZoomIn, 277 | SniperZoomOut, 278 | SniperZoomInAlternate, 279 | SniperZoomOutAlternate, 280 | VehicleMoveLeft, 281 | VehicleMoveRight, 282 | VehicleMoveUp, 283 | VehicleMoveDown, 284 | VehicleGunLeft, 285 | VehicleGunRight, 286 | VehicleGunUp, 287 | VehicleGunDown, 288 | VehicleLookLeft, 289 | VehicleLookRight, 290 | ReplayStartStopRecording, 291 | ReplayStartStopRecordingSecondary, 292 | ScaledLookLeftRight, 293 | ScaledLookUpDown, 294 | ScaledLookUpOnly, 295 | ScaledLookDownOnly, 296 | ScaledLookLeftOnly, 297 | ScaledLookRightOnly, 298 | ReplayMarkerDelete, 299 | ReplayClipDelete, 300 | ReplayPause, 301 | ReplayRewind, 302 | ReplayFfwd, 303 | ReplayNewmarker, 304 | ReplayRecord, 305 | ReplayScreenshot, 306 | ReplayHidehud, 307 | ReplayStartpoint, 308 | ReplayEndpoint, 309 | ReplayAdvance, 310 | ReplayBack, 311 | ReplayTools, 312 | ReplayRestart, 313 | ReplayShowhotkey, 314 | ReplayCycleMarkerLeft, 315 | ReplayCycleMarkerRight, 316 | ReplayFOVIncrease, 317 | ReplayFOVDecrease, 318 | ReplayCameraUp, 319 | ReplayCameraDown, 320 | ReplaySave, 321 | ReplayToggletime, 322 | ReplayToggletips, 323 | ReplayPreview, 324 | ReplayToggleTimeline, 325 | ReplayTimelinePickupClip, 326 | ReplayTimelineDuplicateClip, 327 | ReplayTimelinePlaceClip, 328 | ReplayCtrl, 329 | ReplayTimelineSave, 330 | ReplayPreviewAudio, 331 | VehicleDriveLook, 332 | VehicleDriveLook2, 333 | VehicleFlyAttack2, 334 | RadioWheelUpDown, 335 | RadioWheelLeftRight, 336 | VehicleSlowMoUpDown, 337 | VehicleSlowMoUpOnly, 338 | VehicleSlowMoDownOnly, 339 | MapPointOfInterest, 340 | ReplaySnapmaticPhoto, 341 | VehicleCarJump, 342 | VehicleRocketBoost, 343 | VehicleParachute, 344 | VehicleBikeWings, 345 | VehicleFlyBombBay, 346 | VehicleFlyCounter, 347 | VehicleFlyTransform, 348 | } 349 | 350 | export default Control; -------------------------------------------------------------------------------- /client/includes/NativeUI/items/UIMenuItem.js: -------------------------------------------------------------------------------- 1 | import * as alt from 'alt-client'; 2 | import BadgeStyle from "../enums/BadgeStyle"; 3 | import Font from "../enums/Font"; 4 | import Alignment from "../enums/Alignment"; 5 | import ResRectangle from "../modules/ResRectangle"; 6 | import ResText from "../modules/ResText"; 7 | import Sprite from "../modules/Sprite"; 8 | import Color from "../utils/Color"; 9 | import Point from "../utils/Point"; 10 | import Size from "../utils/Size"; 11 | import UUIDV4 from "../utils/UUIDV4"; 12 | export default class UIMenuItem { 13 | constructor(text, description = "", data = null) { 14 | this.Id = UUIDV4(); 15 | this.BackColor = UIMenuItem.DefaultBackColor; 16 | this.HighlightedBackColor = UIMenuItem.DefaultHighlightedBackColor; 17 | this.ForeColor = UIMenuItem.DefaultForeColor; 18 | this.HighlightedForeColor = UIMenuItem.DefaultHighlightedForeColor; 19 | this.RightLabel = ""; 20 | this.LeftBadge = BadgeStyle.None; 21 | this.RightBadge = BadgeStyle.None; 22 | this.Enabled = true; 23 | this.Data = data; 24 | this._rectangle = new ResRectangle(new Point(0, 0), new Size(431, 38), new Color(150, 0, 0, 0)); 25 | this._text = new ResText(text, new Point(8, 0), 0.33, Color.WhiteSmoke, Font.ChaletLondon, Alignment.Left); 26 | this.Description = description; 27 | this._selectedSprite = new Sprite("commonmenu", "gradient_nav", new Point(0, 0), new Size(431, 38)); 28 | this._badgeLeft = new Sprite("commonmenu", "", new Point(0, 0), new Size(40, 40)); 29 | this._badgeRight = new Sprite("commonmenu", "", new Point(0, 0), new Size(40, 40)); 30 | this._labelText = new ResText("", new Point(0, 0), 0.35, Color.White, 0, Alignment.Right); 31 | } 32 | get Text() { 33 | return this._text.Caption; 34 | } 35 | set Text(text) { 36 | this._text.Caption = text; 37 | } 38 | get Description() { 39 | return this._description; 40 | } 41 | set Description(text) { 42 | this._description = text; 43 | if (this.hasOwnProperty('Parent')) { 44 | this.Parent.UpdateDescriptionCaption(); 45 | } 46 | } 47 | SetVerticalPosition(y) { 48 | this._rectangle.Pos = new Point(this.Offset.X, y + 144 + this.Offset.Y); 49 | this._selectedSprite.Pos = new Point(0 + this.Offset.X, y + 144 + this.Offset.Y); 50 | this._text.Pos = new Point(8 + this.Offset.X, y + 147 + this.Offset.Y); 51 | this._badgeLeft.Pos = new Point(0 + this.Offset.X, y + 142 + this.Offset.Y); 52 | this._badgeRight.Pos = new Point(385 + this.Offset.X, y + 142 + this.Offset.Y); 53 | this._labelText.Pos = new Point(420 + this.Offset.X, y + 148 + this.Offset.Y); 54 | } 55 | addEvent(event, ...args) { 56 | this._event = { event: event, args: args }; 57 | } 58 | fireEvent() { 59 | if (this._event) { 60 | alt.emit(this._event.event, ...this._event.args); 61 | } 62 | } 63 | Draw() { 64 | this._rectangle.Size = new Size(431 + this.Parent.WidthOffset, 38); 65 | this._selectedSprite.Size = new Size(431 + this.Parent.WidthOffset, 38); 66 | if (this.Hovered && !this.Selected) { 67 | this._rectangle.Color = new Color(255, 255, 255, 20); 68 | this._rectangle.Draw(); 69 | } 70 | this._selectedSprite.Color = this.Selected 71 | ? this.HighlightedBackColor 72 | : this.BackColor; 73 | this._selectedSprite.Draw(); 74 | this._text.Color = this.Enabled 75 | ? this.Selected 76 | ? this.HighlightedForeColor 77 | : this.ForeColor 78 | : new Color(163, 159, 148); 79 | if (this.LeftBadge != BadgeStyle.None) { 80 | this._text.Pos = new Point(35 + this.Offset.X, this._text.Pos.Y); 81 | this._badgeLeft.TextureDict = this.BadgeToSpriteLib(this.LeftBadge); 82 | this._badgeLeft.TextureName = this.BadgeToSpriteName(this.LeftBadge, this.Selected); 83 | this._badgeLeft.Color = this.IsBagdeWhiteSprite(this.LeftBadge) 84 | ? this.Enabled 85 | ? this.Selected 86 | ? this.HighlightedForeColor 87 | : this.ForeColor 88 | : new Color(163, 159, 148) 89 | : Color.White; 90 | this._badgeLeft.Draw(); 91 | } 92 | else { 93 | this._text.Pos = new Point(8 + this.Offset.X, this._text.Pos.Y); 94 | } 95 | if (this.RightBadge != BadgeStyle.None) { 96 | this._badgeRight.Pos = new Point(385 + this.Offset.X + this.Parent.WidthOffset, this._badgeRight.Pos.Y); 97 | this._badgeRight.TextureDict = this.BadgeToSpriteLib(this.RightBadge); 98 | this._badgeRight.TextureName = this.BadgeToSpriteName(this.RightBadge, this.Selected); 99 | this._badgeRight.Color = this.IsBagdeWhiteSprite(this.RightBadge) 100 | ? this.Enabled 101 | ? this.Selected 102 | ? this.HighlightedForeColor 103 | : this.ForeColor 104 | : new Color(163, 159, 148) 105 | : Color.White; 106 | this._badgeRight.Draw(); 107 | } 108 | if (this.RightLabel && this.RightLabel !== "") { 109 | this._labelText.Pos = new Point(420 + this.Offset.X + this.Parent.WidthOffset, this._labelText.Pos.Y); 110 | this._labelText.Caption = this.RightLabel; 111 | this._labelText.Color = this._text.Color = this.Enabled 112 | ? this.Selected 113 | ? this.HighlightedForeColor 114 | : this.ForeColor 115 | : new Color(163, 159, 148); 116 | this._labelText.Draw(); 117 | } 118 | this._text.Draw(); 119 | } 120 | SetLeftBadge(badge) { 121 | this.LeftBadge = badge; 122 | } 123 | SetRightBadge(badge) { 124 | this.RightBadge = badge; 125 | } 126 | SetRightLabel(text) { 127 | this.RightLabel = text; 128 | } 129 | BadgeToSpriteLib(badge) { 130 | switch (badge) { 131 | case BadgeStyle.Sale: 132 | return "mpshopsale"; 133 | case BadgeStyle.Audio1: 134 | case BadgeStyle.Audio2: 135 | case BadgeStyle.Audio3: 136 | case BadgeStyle.AudioInactive: 137 | case BadgeStyle.AudioMute: 138 | return "mpleaderboard"; 139 | default: 140 | return "commonmenu"; 141 | } 142 | } 143 | BadgeToSpriteName(badge, selected) { 144 | switch (badge) { 145 | case BadgeStyle.None: 146 | return ""; 147 | case BadgeStyle.BronzeMedal: 148 | return "mp_medal_bronze"; 149 | case BadgeStyle.GoldMedal: 150 | return "mp_medal_gold"; 151 | case BadgeStyle.SilverMedal: 152 | return "medal_silver"; 153 | case BadgeStyle.Alert: 154 | return "mp_alerttriangle"; 155 | case BadgeStyle.Crown: 156 | return "mp_hostcrown"; 157 | case BadgeStyle.Ammo: 158 | return selected ? "shop_ammo_icon_b" : "shop_ammo_icon_a"; 159 | case BadgeStyle.Armour: 160 | return selected ? "shop_armour_icon_b" : "shop_armour_icon_a"; 161 | case BadgeStyle.Barber: 162 | return selected ? "shop_barber_icon_b" : "shop_barber_icon_a"; 163 | case BadgeStyle.Clothes: 164 | return selected ? "shop_clothing_icon_b" : "shop_clothing_icon_a"; 165 | case BadgeStyle.Franklin: 166 | return selected ? "shop_franklin_icon_b" : "shop_franklin_icon_a"; 167 | case BadgeStyle.Bike: 168 | return selected ? "shop_garage_bike_icon_b" : "shop_garage_bike_icon_a"; 169 | case BadgeStyle.Car: 170 | return selected ? "shop_garage_icon_b" : "shop_garage_icon_a"; 171 | case BadgeStyle.Gun: 172 | return selected ? "shop_gunclub_icon_b" : "shop_gunclub_icon_a"; 173 | case BadgeStyle.Heart: 174 | return selected ? "shop_health_icon_b" : "shop_health_icon_a"; 175 | case BadgeStyle.Lock: 176 | return "shop_lock"; 177 | case BadgeStyle.Makeup: 178 | return selected ? "shop_makeup_icon_b" : "shop_makeup_icon_a"; 179 | case BadgeStyle.Mask: 180 | return selected ? "shop_mask_icon_b" : "shop_mask_icon_a"; 181 | case BadgeStyle.Michael: 182 | return selected ? "shop_michael_icon_b" : "shop_michael_icon_a"; 183 | case BadgeStyle.Star: 184 | return "shop_new_star"; 185 | case BadgeStyle.Tatoo: 186 | return selected ? "shop_tattoos_icon_b" : "shop_tattoos_icon_"; 187 | case BadgeStyle.Tick: 188 | return "shop_tick_icon"; 189 | case BadgeStyle.Trevor: 190 | return selected ? "shop_trevor_icon_b" : "shop_trevor_icon_a"; 191 | case BadgeStyle.Sale: 192 | return "saleicon"; 193 | case BadgeStyle.ArrowLeft: 194 | return "arrowleft"; 195 | case BadgeStyle.ArrowRight: 196 | return "arrowright"; 197 | case BadgeStyle.Audio1: 198 | return "leaderboard_audio_1"; 199 | case BadgeStyle.Audio2: 200 | return "leaderboard_audio_2"; 201 | case BadgeStyle.Audio3: 202 | return "leaderboard_audio_3"; 203 | case BadgeStyle.AudioInactive: 204 | return "leaderboard_audio_inactive"; 205 | case BadgeStyle.AudioMute: 206 | return "leaderboard_audio_mute"; 207 | default: 208 | return ""; 209 | } 210 | } 211 | IsBagdeWhiteSprite(badge) { 212 | switch (badge) { 213 | case BadgeStyle.Lock: 214 | case BadgeStyle.Tick: 215 | case BadgeStyle.Crown: 216 | return true; 217 | default: 218 | return false; 219 | } 220 | } 221 | BadgeToColor(badge, selected) { 222 | switch (badge) { 223 | case BadgeStyle.Lock: 224 | case BadgeStyle.Tick: 225 | case BadgeStyle.Crown: 226 | return selected 227 | ? new Color(255, 0, 0, 0) 228 | : new Color(255, 255, 255, 255); 229 | default: 230 | return new Color(255, 255, 255, 255); 231 | } 232 | } 233 | } 234 | UIMenuItem.DefaultBackColor = Color.Empty; 235 | UIMenuItem.DefaultHighlightedBackColor = Color.White; 236 | UIMenuItem.DefaultForeColor = Color.WhiteSmoke; 237 | UIMenuItem.DefaultHighlightedForeColor = Color.Black; 238 | -------------------------------------------------------------------------------- /client/includes/NativeUI/items/UIMenuItem.ts: -------------------------------------------------------------------------------- 1 | import * as alt from 'alt-client'; 2 | import BadgeStyle from "../enums/BadgeStyle"; 3 | import Font from "../enums/Font"; 4 | import Alignment from "../enums/Alignment"; 5 | import NativeUI from "../NativeUi"; 6 | import ResRectangle from "../modules/ResRectangle"; 7 | import ResText from "../modules/ResText"; 8 | import Sprite from "../modules/Sprite"; 9 | import Color from "../utils/Color"; 10 | import Point from "../utils/Point"; 11 | import Size from "../utils/Size"; 12 | import UUIDV4 from "../utils/UUIDV4"; 13 | 14 | export default class UIMenuItem { 15 | public readonly Id: string = UUIDV4(); 16 | 17 | public static readonly DefaultBackColor: Color = Color.Empty; 18 | public static readonly DefaultHighlightedBackColor: Color = Color.White; 19 | public static readonly DefaultForeColor: Color = Color.WhiteSmoke; 20 | public static readonly DefaultHighlightedForeColor: Color = Color.Black; 21 | 22 | private _event: { event: string; args: any[] }; 23 | 24 | protected _rectangle: ResRectangle; 25 | protected _text: ResText; 26 | protected _description: string; 27 | protected _selectedSprite: Sprite; 28 | protected _badgeLeft: Sprite; 29 | protected _badgeRight: Sprite; 30 | protected _labelText: ResText; 31 | 32 | public BackColor: Color = UIMenuItem.DefaultBackColor; 33 | public HighlightedBackColor: Color = UIMenuItem.DefaultHighlightedBackColor; 34 | 35 | public ForeColor: Color = UIMenuItem.DefaultForeColor; 36 | public HighlightedForeColor: Color = UIMenuItem.DefaultHighlightedForeColor; 37 | 38 | public Enabled: boolean; 39 | public Selected: boolean; 40 | public Hovered: boolean; 41 | public Data: any; 42 | 43 | public Offset: Point; 44 | public Parent: NativeUI; 45 | 46 | public get Text() { 47 | return this._text.Caption; 48 | } 49 | public set Text(text) { 50 | this._text.Caption = text; 51 | } 52 | 53 | public get Description() { 54 | return this._description; 55 | } 56 | public set Description(text) { 57 | this._description = text; 58 | if (this.hasOwnProperty('Parent')) { 59 | this.Parent.UpdateDescriptionCaption(); 60 | } 61 | } 62 | 63 | public RightLabel: string = ""; 64 | public LeftBadge: BadgeStyle = BadgeStyle.None; 65 | public RightBadge: BadgeStyle = BadgeStyle.None; 66 | 67 | constructor(text: string, description = "", data: any = null) { 68 | this.Enabled = true; 69 | this.Data = data; 70 | 71 | this._rectangle = new ResRectangle(new Point(0, 0), new Size(431, 38), new Color(150, 0, 0, 0)); 72 | this._text = new ResText(text, new Point(8, 0), 0.33, Color.WhiteSmoke, Font.ChaletLondon, Alignment.Left); 73 | this.Description = description; 74 | this._selectedSprite = new Sprite("commonmenu", "gradient_nav", new Point(0, 0), new Size(431, 38)); 75 | 76 | this._badgeLeft = new Sprite("commonmenu", "", new Point(0, 0), new Size(40, 40)); 77 | this._badgeRight = new Sprite("commonmenu", "", new Point(0, 0), new Size(40, 40)); 78 | 79 | this._labelText = new ResText("", new Point(0, 0), 0.35, Color.White, 0, Alignment.Right); 80 | } 81 | 82 | public SetVerticalPosition(y: number) { 83 | this._rectangle.Pos = new Point(this.Offset.X, y + 144 + this.Offset.Y); 84 | this._selectedSprite.Pos = new Point(0 + this.Offset.X, y + 144 + this.Offset.Y); 85 | this._text.Pos = new Point(8 + this.Offset.X, y + 147 + this.Offset.Y); 86 | 87 | this._badgeLeft.Pos = new Point(0 + this.Offset.X, y + 142 + this.Offset.Y); 88 | this._badgeRight.Pos = new Point(385 + this.Offset.X, y + 142 + this.Offset.Y); 89 | 90 | this._labelText.Pos = new Point(420 + this.Offset.X, y + 148 + this.Offset.Y); 91 | } 92 | 93 | public addEvent(event: string, ...args: any[]) { 94 | this._event = { event: event, args: args }; 95 | } 96 | 97 | public fireEvent() { 98 | if (this._event) { 99 | alt.emit(this._event.event, ...this._event.args); 100 | } 101 | } 102 | 103 | public Draw() { 104 | this._rectangle.Size = new Size(431 + this.Parent.WidthOffset, 38); 105 | this._selectedSprite.Size = new Size(431 + this.Parent.WidthOffset, 38); 106 | 107 | if (this.Hovered && !this.Selected) { 108 | this._rectangle.Color = new Color(255, 255, 255, 20); 109 | this._rectangle.Draw(); 110 | } 111 | 112 | this._selectedSprite.Color = this.Selected 113 | ? this.HighlightedBackColor 114 | : this.BackColor; 115 | this._selectedSprite.Draw(); 116 | 117 | this._text.Color = this.Enabled 118 | ? this.Selected 119 | ? this.HighlightedForeColor 120 | : this.ForeColor 121 | : new Color(163, 159, 148); 122 | 123 | if (this.LeftBadge != BadgeStyle.None) { 124 | this._text.Pos = new Point(35 + this.Offset.X, this._text.Pos.Y); 125 | this._badgeLeft.TextureDict = this.BadgeToSpriteLib(this.LeftBadge); 126 | this._badgeLeft.TextureName = this.BadgeToSpriteName(this.LeftBadge, this.Selected); 127 | this._badgeLeft.Color = this.IsBagdeWhiteSprite(this.LeftBadge) 128 | ? this.Enabled 129 | ? this.Selected 130 | ? this.HighlightedForeColor 131 | : this.ForeColor 132 | : new Color(163, 159, 148) 133 | : Color.White; 134 | this._badgeLeft.Draw(); 135 | } else { 136 | this._text.Pos = new Point(8 + this.Offset.X, this._text.Pos.Y); 137 | } 138 | 139 | if (this.RightBadge != BadgeStyle.None) { 140 | this._badgeRight.Pos = new Point(385 + this.Offset.X + this.Parent.WidthOffset, this._badgeRight.Pos.Y); 141 | this._badgeRight.TextureDict = this.BadgeToSpriteLib(this.RightBadge); 142 | this._badgeRight.TextureName = this.BadgeToSpriteName(this.RightBadge, this.Selected); 143 | this._badgeRight.Color = this.IsBagdeWhiteSprite(this.RightBadge) 144 | ? this.Enabled 145 | ? this.Selected 146 | ? this.HighlightedForeColor 147 | : this.ForeColor 148 | : new Color(163, 159, 148) 149 | : Color.White; 150 | this._badgeRight.Draw(); 151 | } 152 | 153 | if (this.RightLabel && this.RightLabel !== "") { 154 | this._labelText.Pos = new Point(420 + this.Offset.X + this.Parent.WidthOffset, this._labelText.Pos.Y); 155 | this._labelText.Caption = this.RightLabel; 156 | this._labelText.Color = this._text.Color = this.Enabled 157 | ? this.Selected 158 | ? this.HighlightedForeColor 159 | : this.ForeColor 160 | : new Color(163, 159, 148); 161 | this._labelText.Draw(); 162 | } 163 | this._text.Draw(); 164 | } 165 | 166 | public SetLeftBadge(badge: BadgeStyle) { 167 | this.LeftBadge = badge; 168 | } 169 | 170 | public SetRightBadge(badge: BadgeStyle) { 171 | this.RightBadge = badge; 172 | } 173 | 174 | public SetRightLabel(text: string) { 175 | this.RightLabel = text; 176 | } 177 | 178 | public BadgeToSpriteLib(badge: BadgeStyle) { 179 | switch (badge) { 180 | case BadgeStyle.Sale: 181 | return "mpshopsale"; 182 | case BadgeStyle.Audio1: 183 | case BadgeStyle.Audio2: 184 | case BadgeStyle.Audio3: 185 | case BadgeStyle.AudioInactive: 186 | case BadgeStyle.AudioMute: 187 | return "mpleaderboard"; 188 | default: 189 | return "commonmenu"; 190 | } 191 | } 192 | 193 | public BadgeToSpriteName(badge: BadgeStyle, selected: boolean) { 194 | switch (badge) { 195 | case BadgeStyle.None: 196 | return ""; 197 | case BadgeStyle.BronzeMedal: 198 | return "mp_medal_bronze"; 199 | case BadgeStyle.GoldMedal: 200 | return "mp_medal_gold"; 201 | case BadgeStyle.SilverMedal: 202 | return "medal_silver"; 203 | case BadgeStyle.Alert: 204 | return "mp_alerttriangle"; 205 | case BadgeStyle.Crown: 206 | return "mp_hostcrown"; 207 | case BadgeStyle.Ammo: 208 | return selected ? "shop_ammo_icon_b" : "shop_ammo_icon_a"; 209 | case BadgeStyle.Armour: 210 | return selected ? "shop_armour_icon_b" : "shop_armour_icon_a"; 211 | case BadgeStyle.Barber: 212 | return selected ? "shop_barber_icon_b" : "shop_barber_icon_a"; 213 | case BadgeStyle.Clothes: 214 | return selected ? "shop_clothing_icon_b" : "shop_clothing_icon_a"; 215 | case BadgeStyle.Franklin: 216 | return selected ? "shop_franklin_icon_b" : "shop_franklin_icon_a"; 217 | case BadgeStyle.Bike: 218 | return selected ? "shop_garage_bike_icon_b" : "shop_garage_bike_icon_a"; 219 | case BadgeStyle.Car: 220 | return selected ? "shop_garage_icon_b" : "shop_garage_icon_a"; 221 | case BadgeStyle.Gun: 222 | return selected ? "shop_gunclub_icon_b" : "shop_gunclub_icon_a"; 223 | case BadgeStyle.Heart: 224 | return selected ? "shop_health_icon_b" : "shop_health_icon_a"; 225 | case BadgeStyle.Lock: 226 | return "shop_lock"; 227 | case BadgeStyle.Makeup: 228 | return selected ? "shop_makeup_icon_b" : "shop_makeup_icon_a"; 229 | case BadgeStyle.Mask: 230 | return selected ? "shop_mask_icon_b" : "shop_mask_icon_a"; 231 | case BadgeStyle.Michael: 232 | return selected ? "shop_michael_icon_b" : "shop_michael_icon_a"; 233 | case BadgeStyle.Star: 234 | return "shop_new_star"; 235 | case BadgeStyle.Tatoo: 236 | return selected ? "shop_tattoos_icon_b" : "shop_tattoos_icon_"; 237 | case BadgeStyle.Tick: 238 | return "shop_tick_icon"; 239 | case BadgeStyle.Trevor: 240 | return selected ? "shop_trevor_icon_b" : "shop_trevor_icon_a"; 241 | case BadgeStyle.Sale: 242 | return "saleicon"; 243 | case BadgeStyle.ArrowLeft: 244 | return "arrowleft"; 245 | case BadgeStyle.ArrowRight: 246 | return "arrowright"; 247 | case BadgeStyle.Audio1: 248 | return "leaderboard_audio_1"; 249 | case BadgeStyle.Audio2: 250 | return "leaderboard_audio_2"; 251 | case BadgeStyle.Audio3: 252 | return "leaderboard_audio_3"; 253 | case BadgeStyle.AudioInactive: 254 | return "leaderboard_audio_inactive"; 255 | case BadgeStyle.AudioMute: 256 | return "leaderboard_audio_mute"; 257 | default: 258 | return ""; 259 | } 260 | } 261 | 262 | public IsBagdeWhiteSprite(badge: BadgeStyle) { 263 | switch (badge) { 264 | case BadgeStyle.Lock: 265 | case BadgeStyle.Tick: 266 | case BadgeStyle.Crown: 267 | return true; 268 | default: 269 | return false; 270 | } 271 | } 272 | 273 | public BadgeToColor(badge: BadgeStyle, selected: boolean): Color { 274 | switch (badge) { 275 | case BadgeStyle.Lock: 276 | case BadgeStyle.Tick: 277 | case BadgeStyle.Crown: 278 | return selected 279 | ? new Color(255, 0, 0, 0) 280 | : new Color(255, 255, 255, 255); 281 | default: 282 | return new Color(255, 255, 255, 255); 283 | } 284 | } 285 | } -------------------------------------------------------------------------------- /client/includes/NativeUI/enums/HudColor.js: -------------------------------------------------------------------------------- 1 | var HudColor; 2 | (function (HudColor) { 3 | HudColor[HudColor["HUD_COLOUR_PURE_WHITE"] = 0] = "HUD_COLOUR_PURE_WHITE"; 4 | HudColor[HudColor["HUD_COLOUR_WHITE"] = 1] = "HUD_COLOUR_WHITE"; 5 | HudColor[HudColor["HUD_COLOUR_BLACK"] = 2] = "HUD_COLOUR_BLACK"; 6 | HudColor[HudColor["HUD_COLOUR_GREY"] = 3] = "HUD_COLOUR_GREY"; 7 | HudColor[HudColor["HUD_COLOUR_GREYLIGHT"] = 4] = "HUD_COLOUR_GREYLIGHT"; 8 | HudColor[HudColor["HUD_COLOUR_GREYDARK"] = 5] = "HUD_COLOUR_GREYDARK"; 9 | HudColor[HudColor["HUD_COLOUR_RED"] = 6] = "HUD_COLOUR_RED"; 10 | HudColor[HudColor["HUD_COLOUR_REDLIGHT"] = 7] = "HUD_COLOUR_REDLIGHT"; 11 | HudColor[HudColor["HUD_COLOUR_REDDARK"] = 8] = "HUD_COLOUR_REDDARK"; 12 | HudColor[HudColor["HUD_COLOUR_BLUE"] = 9] = "HUD_COLOUR_BLUE"; 13 | HudColor[HudColor["HUD_COLOUR_BLUELIGHT"] = 10] = "HUD_COLOUR_BLUELIGHT"; 14 | HudColor[HudColor["HUD_COLOUR_BLUEDARK"] = 11] = "HUD_COLOUR_BLUEDARK"; 15 | HudColor[HudColor["HUD_COLOUR_YELLOW"] = 12] = "HUD_COLOUR_YELLOW"; 16 | HudColor[HudColor["HUD_COLOUR_YELLOWLIGHT"] = 13] = "HUD_COLOUR_YELLOWLIGHT"; 17 | HudColor[HudColor["HUD_COLOUR_YELLOWDARK"] = 14] = "HUD_COLOUR_YELLOWDARK"; 18 | HudColor[HudColor["HUD_COLOUR_ORANGE"] = 15] = "HUD_COLOUR_ORANGE"; 19 | HudColor[HudColor["HUD_COLOUR_ORANGELIGHT"] = 16] = "HUD_COLOUR_ORANGELIGHT"; 20 | HudColor[HudColor["HUD_COLOUR_ORANGEDARK"] = 17] = "HUD_COLOUR_ORANGEDARK"; 21 | HudColor[HudColor["HUD_COLOUR_GREEN"] = 18] = "HUD_COLOUR_GREEN"; 22 | HudColor[HudColor["HUD_COLOUR_GREENLIGHT"] = 19] = "HUD_COLOUR_GREENLIGHT"; 23 | HudColor[HudColor["HUD_COLOUR_GREENDARK"] = 20] = "HUD_COLOUR_GREENDARK"; 24 | HudColor[HudColor["HUD_COLOUR_PURPLE"] = 21] = "HUD_COLOUR_PURPLE"; 25 | HudColor[HudColor["HUD_COLOUR_PURPLELIGHT"] = 22] = "HUD_COLOUR_PURPLELIGHT"; 26 | HudColor[HudColor["HUD_COLOUR_PURPLEDARK"] = 23] = "HUD_COLOUR_PURPLEDARK"; 27 | HudColor[HudColor["HUD_COLOUR_PINK"] = 24] = "HUD_COLOUR_PINK"; 28 | HudColor[HudColor["HUD_COLOUR_RADAR_HEALTH"] = 25] = "HUD_COLOUR_RADAR_HEALTH"; 29 | HudColor[HudColor["HUD_COLOUR_RADAR_ARMOUR"] = 26] = "HUD_COLOUR_RADAR_ARMOUR"; 30 | HudColor[HudColor["HUD_COLOUR_RADAR_DAMAGE"] = 27] = "HUD_COLOUR_RADAR_DAMAGE"; 31 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER1"] = 28] = "HUD_COLOUR_NET_PLAYER1"; 32 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER2"] = 29] = "HUD_COLOUR_NET_PLAYER2"; 33 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER3"] = 30] = "HUD_COLOUR_NET_PLAYER3"; 34 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER4"] = 31] = "HUD_COLOUR_NET_PLAYER4"; 35 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER5"] = 32] = "HUD_COLOUR_NET_PLAYER5"; 36 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER6"] = 33] = "HUD_COLOUR_NET_PLAYER6"; 37 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER7"] = 34] = "HUD_COLOUR_NET_PLAYER7"; 38 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER8"] = 35] = "HUD_COLOUR_NET_PLAYER8"; 39 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER9"] = 36] = "HUD_COLOUR_NET_PLAYER9"; 40 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER10"] = 37] = "HUD_COLOUR_NET_PLAYER10"; 41 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER11"] = 38] = "HUD_COLOUR_NET_PLAYER11"; 42 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER12"] = 39] = "HUD_COLOUR_NET_PLAYER12"; 43 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER13"] = 40] = "HUD_COLOUR_NET_PLAYER13"; 44 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER14"] = 41] = "HUD_COLOUR_NET_PLAYER14"; 45 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER15"] = 42] = "HUD_COLOUR_NET_PLAYER15"; 46 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER16"] = 43] = "HUD_COLOUR_NET_PLAYER16"; 47 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER17"] = 44] = "HUD_COLOUR_NET_PLAYER17"; 48 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER18"] = 45] = "HUD_COLOUR_NET_PLAYER18"; 49 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER19"] = 46] = "HUD_COLOUR_NET_PLAYER19"; 50 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER20"] = 47] = "HUD_COLOUR_NET_PLAYER20"; 51 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER21"] = 48] = "HUD_COLOUR_NET_PLAYER21"; 52 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER22"] = 49] = "HUD_COLOUR_NET_PLAYER22"; 53 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER23"] = 50] = "HUD_COLOUR_NET_PLAYER23"; 54 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER24"] = 51] = "HUD_COLOUR_NET_PLAYER24"; 55 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER25"] = 52] = "HUD_COLOUR_NET_PLAYER25"; 56 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER26"] = 53] = "HUD_COLOUR_NET_PLAYER26"; 57 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER27"] = 54] = "HUD_COLOUR_NET_PLAYER27"; 58 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER28"] = 55] = "HUD_COLOUR_NET_PLAYER28"; 59 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER29"] = 56] = "HUD_COLOUR_NET_PLAYER29"; 60 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER30"] = 57] = "HUD_COLOUR_NET_PLAYER30"; 61 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER31"] = 58] = "HUD_COLOUR_NET_PLAYER31"; 62 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER32"] = 59] = "HUD_COLOUR_NET_PLAYER32"; 63 | HudColor[HudColor["HUD_COLOUR_SIMPLEBLIP_DEFAULT"] = 60] = "HUD_COLOUR_SIMPLEBLIP_DEFAULT"; 64 | HudColor[HudColor["HUD_COLOUR_MENU_BLUE"] = 61] = "HUD_COLOUR_MENU_BLUE"; 65 | HudColor[HudColor["HUD_COLOUR_MENU_GREY_LIGHT"] = 62] = "HUD_COLOUR_MENU_GREY_LIGHT"; 66 | HudColor[HudColor["HUD_COLOUR_MENU_BLUE_EXTRA_DARK"] = 63] = "HUD_COLOUR_MENU_BLUE_EXTRA_DARK"; 67 | HudColor[HudColor["HUD_COLOUR_MENU_YELLOW"] = 64] = "HUD_COLOUR_MENU_YELLOW"; 68 | HudColor[HudColor["HUD_COLOUR_MENU_YELLOW_DARK"] = 65] = "HUD_COLOUR_MENU_YELLOW_DARK"; 69 | HudColor[HudColor["HUD_COLOUR_MENU_GREEN"] = 66] = "HUD_COLOUR_MENU_GREEN"; 70 | HudColor[HudColor["HUD_COLOUR_MENU_GREY"] = 67] = "HUD_COLOUR_MENU_GREY"; 71 | HudColor[HudColor["HUD_COLOUR_MENU_GREY_DARK"] = 68] = "HUD_COLOUR_MENU_GREY_DARK"; 72 | HudColor[HudColor["HUD_COLOUR_MENU_HIGHLIGHT"] = 69] = "HUD_COLOUR_MENU_HIGHLIGHT"; 73 | HudColor[HudColor["HUD_COLOUR_MENU_STANDARD"] = 70] = "HUD_COLOUR_MENU_STANDARD"; 74 | HudColor[HudColor["HUD_COLOUR_MENU_DIMMED"] = 71] = "HUD_COLOUR_MENU_DIMMED"; 75 | HudColor[HudColor["HUD_COLOUR_MENU_EXTRA_DIMMED"] = 72] = "HUD_COLOUR_MENU_EXTRA_DIMMED"; 76 | HudColor[HudColor["HUD_COLOUR_BRIEF_TITLE"] = 73] = "HUD_COLOUR_BRIEF_TITLE"; 77 | HudColor[HudColor["HUD_COLOUR_MID_GREY_MP"] = 74] = "HUD_COLOUR_MID_GREY_MP"; 78 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER1_DARK"] = 75] = "HUD_COLOUR_NET_PLAYER1_DARK"; 79 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER2_DARK"] = 76] = "HUD_COLOUR_NET_PLAYER2_DARK"; 80 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER3_DARK"] = 77] = "HUD_COLOUR_NET_PLAYER3_DARK"; 81 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER4_DARK"] = 78] = "HUD_COLOUR_NET_PLAYER4_DARK"; 82 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER5_DARK"] = 79] = "HUD_COLOUR_NET_PLAYER5_DARK"; 83 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER6_DARK"] = 80] = "HUD_COLOUR_NET_PLAYER6_DARK"; 84 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER7_DARK"] = 81] = "HUD_COLOUR_NET_PLAYER7_DARK"; 85 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER8_DARK"] = 82] = "HUD_COLOUR_NET_PLAYER8_DARK"; 86 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER9_DARK"] = 83] = "HUD_COLOUR_NET_PLAYER9_DARK"; 87 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER10_DARK"] = 84] = "HUD_COLOUR_NET_PLAYER10_DARK"; 88 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER11_DARK"] = 85] = "HUD_COLOUR_NET_PLAYER11_DARK"; 89 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER12_DARK"] = 86] = "HUD_COLOUR_NET_PLAYER12_DARK"; 90 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER13_DARK"] = 87] = "HUD_COLOUR_NET_PLAYER13_DARK"; 91 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER14_DARK"] = 88] = "HUD_COLOUR_NET_PLAYER14_DARK"; 92 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER15_DARK"] = 89] = "HUD_COLOUR_NET_PLAYER15_DARK"; 93 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER16_DARK"] = 90] = "HUD_COLOUR_NET_PLAYER16_DARK"; 94 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER17_DARK"] = 91] = "HUD_COLOUR_NET_PLAYER17_DARK"; 95 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER18_DARK"] = 92] = "HUD_COLOUR_NET_PLAYER18_DARK"; 96 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER19_DARK"] = 93] = "HUD_COLOUR_NET_PLAYER19_DARK"; 97 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER20_DARK"] = 94] = "HUD_COLOUR_NET_PLAYER20_DARK"; 98 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER21_DARK"] = 95] = "HUD_COLOUR_NET_PLAYER21_DARK"; 99 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER22_DARK"] = 96] = "HUD_COLOUR_NET_PLAYER22_DARK"; 100 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER23_DARK"] = 97] = "HUD_COLOUR_NET_PLAYER23_DARK"; 101 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER24_DARK"] = 98] = "HUD_COLOUR_NET_PLAYER24_DARK"; 102 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER25_DARK"] = 99] = "HUD_COLOUR_NET_PLAYER25_DARK"; 103 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER26_DARK"] = 100] = "HUD_COLOUR_NET_PLAYER26_DARK"; 104 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER27_DARK"] = 101] = "HUD_COLOUR_NET_PLAYER27_DARK"; 105 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER28_DARK"] = 102] = "HUD_COLOUR_NET_PLAYER28_DARK"; 106 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER29_DARK"] = 103] = "HUD_COLOUR_NET_PLAYER29_DARK"; 107 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER30_DARK"] = 104] = "HUD_COLOUR_NET_PLAYER30_DARK"; 108 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER31_DARK"] = 105] = "HUD_COLOUR_NET_PLAYER31_DARK"; 109 | HudColor[HudColor["HUD_COLOUR_NET_PLAYER32_DARK"] = 106] = "HUD_COLOUR_NET_PLAYER32_DARK"; 110 | HudColor[HudColor["HUD_COLOUR_BRONZE"] = 107] = "HUD_COLOUR_BRONZE"; 111 | HudColor[HudColor["HUD_COLOUR_SILVER"] = 108] = "HUD_COLOUR_SILVER"; 112 | HudColor[HudColor["HUD_COLOUR_GOLD"] = 109] = "HUD_COLOUR_GOLD"; 113 | HudColor[HudColor["HUD_COLOUR_PLATINUM"] = 110] = "HUD_COLOUR_PLATINUM"; 114 | HudColor[HudColor["HUD_COLOUR_GANG1"] = 111] = "HUD_COLOUR_GANG1"; 115 | HudColor[HudColor["HUD_COLOUR_GANG2"] = 112] = "HUD_COLOUR_GANG2"; 116 | HudColor[HudColor["HUD_COLOUR_GANG3"] = 113] = "HUD_COLOUR_GANG3"; 117 | HudColor[HudColor["HUD_COLOUR_GANG4"] = 114] = "HUD_COLOUR_GANG4"; 118 | HudColor[HudColor["HUD_COLOUR_SAME_CREW"] = 115] = "HUD_COLOUR_SAME_CREW"; 119 | HudColor[HudColor["HUD_COLOUR_FREEMODE"] = 116] = "HUD_COLOUR_FREEMODE"; 120 | HudColor[HudColor["HUD_COLOUR_PAUSE_BG"] = 117] = "HUD_COLOUR_PAUSE_BG"; 121 | HudColor[HudColor["HUD_COLOUR_FRIENDLY"] = 118] = "HUD_COLOUR_FRIENDLY"; 122 | HudColor[HudColor["HUD_COLOUR_ENEMY"] = 119] = "HUD_COLOUR_ENEMY"; 123 | HudColor[HudColor["HUD_COLOUR_LOCATION"] = 120] = "HUD_COLOUR_LOCATION"; 124 | HudColor[HudColor["HUD_COLOUR_PICKUP"] = 121] = "HUD_COLOUR_PICKUP"; 125 | HudColor[HudColor["HUD_COLOUR_PAUSE_SINGLEPLAYER"] = 122] = "HUD_COLOUR_PAUSE_SINGLEPLAYER"; 126 | HudColor[HudColor["HUD_COLOUR_FREEMODE_DARK"] = 123] = "HUD_COLOUR_FREEMODE_DARK"; 127 | HudColor[HudColor["HUD_COLOUR_INACTIVE_MISSION"] = 124] = "HUD_COLOUR_INACTIVE_MISSION"; 128 | HudColor[HudColor["HUD_COLOUR_DAMAGE"] = 125] = "HUD_COLOUR_DAMAGE"; 129 | HudColor[HudColor["HUD_COLOUR_PINKLIGHT"] = 126] = "HUD_COLOUR_PINKLIGHT"; 130 | HudColor[HudColor["HUD_COLOUR_PM_MITEM_HIGHLIGHT"] = 127] = "HUD_COLOUR_PM_MITEM_HIGHLIGHT"; 131 | HudColor[HudColor["HUD_COLOUR_SCRIPT_VARIABLE"] = 128] = "HUD_COLOUR_SCRIPT_VARIABLE"; 132 | HudColor[HudColor["HUD_COLOUR_YOGA"] = 129] = "HUD_COLOUR_YOGA"; 133 | HudColor[HudColor["HUD_COLOUR_TENNIS"] = 130] = "HUD_COLOUR_TENNIS"; 134 | HudColor[HudColor["HUD_COLOUR_GOLF"] = 131] = "HUD_COLOUR_GOLF"; 135 | HudColor[HudColor["HUD_COLOUR_SHOOTING_RANGE"] = 132] = "HUD_COLOUR_SHOOTING_RANGE"; 136 | HudColor[HudColor["HUD_COLOUR_FLIGHT_SCHOOL"] = 133] = "HUD_COLOUR_FLIGHT_SCHOOL"; 137 | HudColor[HudColor["HUD_COLOUR_NORTH_BLUE"] = 134] = "HUD_COLOUR_NORTH_BLUE"; 138 | HudColor[HudColor["HUD_COLOUR_SOCIAL_CLUB"] = 135] = "HUD_COLOUR_SOCIAL_CLUB"; 139 | HudColor[HudColor["HUD_COLOUR_PLATFORM_BLUE"] = 136] = "HUD_COLOUR_PLATFORM_BLUE"; 140 | HudColor[HudColor["HUD_COLOUR_PLATFORM_GREEN"] = 137] = "HUD_COLOUR_PLATFORM_GREEN"; 141 | HudColor[HudColor["HUD_COLOUR_PLATFORM_GREY"] = 138] = "HUD_COLOUR_PLATFORM_GREY"; 142 | HudColor[HudColor["HUD_COLOUR_FACEBOOK_BLUE"] = 139] = "HUD_COLOUR_FACEBOOK_BLUE"; 143 | HudColor[HudColor["HUD_COLOUR_INGAME_BG"] = 140] = "HUD_COLOUR_INGAME_BG"; 144 | HudColor[HudColor["HUD_COLOUR_DARTS"] = 141] = "HUD_COLOUR_DARTS"; 145 | HudColor[HudColor["HUD_COLOUR_WAYPOINT"] = 142] = "HUD_COLOUR_WAYPOINT"; 146 | HudColor[HudColor["HUD_COLOUR_MICHAEL"] = 143] = "HUD_COLOUR_MICHAEL"; 147 | HudColor[HudColor["HUD_COLOUR_FRANKLIN"] = 144] = "HUD_COLOUR_FRANKLIN"; 148 | HudColor[HudColor["HUD_COLOUR_TREVOR"] = 145] = "HUD_COLOUR_TREVOR"; 149 | HudColor[HudColor["HUD_COLOUR_GOLF_P1"] = 146] = "HUD_COLOUR_GOLF_P1"; 150 | HudColor[HudColor["HUD_COLOUR_GOLF_P2"] = 147] = "HUD_COLOUR_GOLF_P2"; 151 | HudColor[HudColor["HUD_COLOUR_GOLF_P3"] = 148] = "HUD_COLOUR_GOLF_P3"; 152 | HudColor[HudColor["HUD_COLOUR_GOLF_P4"] = 149] = "HUD_COLOUR_GOLF_P4"; 153 | HudColor[HudColor["HUD_COLOUR_WAYPOINTLIGHT"] = 150] = "HUD_COLOUR_WAYPOINTLIGHT"; 154 | HudColor[HudColor["HUD_COLOUR_WAYPOINTDARK"] = 151] = "HUD_COLOUR_WAYPOINTDARK"; 155 | HudColor[HudColor["HUD_COLOUR_PANEL_LIGHT"] = 152] = "HUD_COLOUR_PANEL_LIGHT"; 156 | HudColor[HudColor["HUD_COLOUR_MICHAEL_DARK"] = 153] = "HUD_COLOUR_MICHAEL_DARK"; 157 | HudColor[HudColor["HUD_COLOUR_FRANKLIN_DARK"] = 154] = "HUD_COLOUR_FRANKLIN_DARK"; 158 | HudColor[HudColor["HUD_COLOUR_TREVOR_DARK"] = 155] = "HUD_COLOUR_TREVOR_DARK"; 159 | HudColor[HudColor["HUD_COLOUR_OBJECTIVE_ROUTE"] = 156] = "HUD_COLOUR_OBJECTIVE_ROUTE"; 160 | HudColor[HudColor["HUD_COLOUR_PAUSEMAP_TINT"] = 157] = "HUD_COLOUR_PAUSEMAP_TINT"; 161 | HudColor[HudColor["HUD_COLOUR_PAUSE_DESELECT"] = 158] = "HUD_COLOUR_PAUSE_DESELECT"; 162 | HudColor[HudColor["HUD_COLOUR_PM_WEAPONS_PURCHASABLE"] = 159] = "HUD_COLOUR_PM_WEAPONS_PURCHASABLE"; 163 | HudColor[HudColor["HUD_COLOUR_PM_WEAPONS_LOCKED"] = 160] = "HUD_COLOUR_PM_WEAPONS_LOCKED"; 164 | HudColor[HudColor["HUD_COLOUR_END_SCREEN_BG"] = 161] = "HUD_COLOUR_END_SCREEN_BG"; 165 | HudColor[HudColor["HUD_COLOUR_CHOP"] = 162] = "HUD_COLOUR_CHOP"; 166 | HudColor[HudColor["HUD_COLOUR_PAUSEMAP_TINT_HALF"] = 163] = "HUD_COLOUR_PAUSEMAP_TINT_HALF"; 167 | HudColor[HudColor["HUD_COLOUR_NORTH_BLUE_OFFICIAL"] = 164] = "HUD_COLOUR_NORTH_BLUE_OFFICIAL"; 168 | HudColor[HudColor["HUD_COLOUR_SCRIPT_VARIABLE_2"] = 165] = "HUD_COLOUR_SCRIPT_VARIABLE_2"; 169 | HudColor[HudColor["HUD_COLOUR_H"] = 166] = "HUD_COLOUR_H"; 170 | HudColor[HudColor["HUD_COLOUR_HDARK"] = 167] = "HUD_COLOUR_HDARK"; 171 | HudColor[HudColor["HUD_COLOUR_T"] = 168] = "HUD_COLOUR_T"; 172 | HudColor[HudColor["HUD_COLOUR_TDARK"] = 169] = "HUD_COLOUR_TDARK"; 173 | HudColor[HudColor["HUD_COLOUR_HSHARD"] = 170] = "HUD_COLOUR_HSHARD"; 174 | HudColor[HudColor["HUD_COLOUR_CONTROLLER_MICHAEL"] = 171] = "HUD_COLOUR_CONTROLLER_MICHAEL"; 175 | HudColor[HudColor["HUD_COLOUR_CONTROLLER_FRANKLIN"] = 172] = "HUD_COLOUR_CONTROLLER_FRANKLIN"; 176 | HudColor[HudColor["HUD_COLOUR_CONTROLLER_TREVOR"] = 173] = "HUD_COLOUR_CONTROLLER_TREVOR"; 177 | HudColor[HudColor["HUD_COLOUR_CONTROLLER_CHOP"] = 174] = "HUD_COLOUR_CONTROLLER_CHOP"; 178 | HudColor[HudColor["HUD_COLOUR_VIDEO_EDITOR_VIDEO"] = 175] = "HUD_COLOUR_VIDEO_EDITOR_VIDEO"; 179 | HudColor[HudColor["HUD_COLOUR_VIDEO_EDITOR_AUDIO"] = 176] = "HUD_COLOUR_VIDEO_EDITOR_AUDIO"; 180 | HudColor[HudColor["HUD_COLOUR_VIDEO_EDITOR_TEXT"] = 177] = "HUD_COLOUR_VIDEO_EDITOR_TEXT"; 181 | HudColor[HudColor["HUD_COLOUR_HB_BLUE"] = 178] = "HUD_COLOUR_HB_BLUE"; 182 | HudColor[HudColor["HUD_COLOUR_HB_YELLOW"] = 179] = "HUD_COLOUR_HB_YELLOW"; 183 | })(HudColor || (HudColor = {})); 184 | export default HudColor; 185 | -------------------------------------------------------------------------------- /client/client.js: -------------------------------------------------------------------------------- 1 | import * as alt from "alt-client"; 2 | import * as native from "natives"; 3 | import * as NativeUI from './includes/NativeUI/NativeUi'; 4 | 5 | //Save the Current Flatbed and Closest veh 6 | const currVehs = {}; 7 | 8 | //Menu Point 9 | const menuPoint = new NativeUI.Point(50,50); 10 | 11 | 12 | //Menus 13 | const mainMenu = new NativeUI.Menu("Trailer", "Trailer Menu", menuPoint); 14 | const doorsMenu = new NativeUI.Menu("Ramps", "Ramps Menu", menuPoint); 15 | const attachMenu = new NativeUI.Menu("Attach", "Attach Menu", menuPoint); 16 | 17 | const flatbedMenu = new NativeUI.Menu("Flatbed", "Flatbed Menu", menuPoint); 18 | const flatbedAttachMenu = new NativeUI.Menu("Flatbed", "Flatbed Menu", menuPoint); 19 | 20 | //MainMenu 21 | let doorsMenuItem = (new NativeUI.UIMenuItem("Ramp/Floor Menu", "Lower/Raise Ramp/Floor")); 22 | mainMenu.AddItem(doorsMenuItem); 23 | 24 | let attachMenuItem = (new NativeUI.UIMenuItem("Attach Menu", "Open Attach Menu")); 25 | mainMenu.AddItem(attachMenuItem); 26 | 27 | mainMenu.AddSubMenu(doorsMenu, doorsMenuItem); 28 | mainMenu.AddSubMenu(attachMenu, attachMenuItem); 29 | //RampMenu 30 | let rampItem = (new NativeUI.UIMenuItem("Ramp", "Lower/Raise Ramp")); 31 | doorsMenu.AddItem(rampItem); 32 | 33 | let upprItem = (new NativeUI.UIMenuItem("Floor", "Lower/Raise Floor")); 34 | doorsMenu.AddItem(upprItem); 35 | 36 | //AttachMenu 37 | let attachItem = (new NativeUI.UIMenuItem("Attach Lower", "Attach Vehicle at Lower Floor")); 38 | attachMenu.AddItem(attachItem); 39 | 40 | let attachUpprMidItem = (new NativeUI.UIMenuItem("Attach Upper Middle", "Attach Vehicle at Upper Middle")); 41 | attachMenu.AddItem(attachUpprMidItem); 42 | 43 | let attachUpprEndItem = (new NativeUI.UIMenuItem("Attach Upper End", "Attach Vehicle at Upper End")); 44 | attachMenu.AddItem(attachUpprEndItem); 45 | 46 | let detachItem = (new NativeUI.UIMenuItem("Detach", "Detach Vehicle")); 47 | attachMenu.AddItem(detachItem); 48 | 49 | let detachItem2 = (new NativeUI.UIMenuListItem( 50 | "Detach", 51 | "Detach Vehicle", 52 | new NativeUI.ItemsCollection(["Ground", "Truck Bed"]) 53 | )); 54 | 55 | 56 | //FlatbedMenu 57 | let getClosesItem = (new NativeUI.UIMenuItem("Attach", "Attach Vehicle")); 58 | flatbedMenu.AddItem(getClosesItem); 59 | 60 | //ItemClickHandlers 61 | doorsMenu.ItemSelect.on(item => { 62 | if (item == rampItem) { 63 | alt.emitServer('get:trailer'); 64 | alt.onServer('send:trailer', (closestVehicle) => { 65 | alt.emitServer('ramp', closestVehicle); 66 | }); 67 | } 68 | if (item == upprItem) { 69 | alt.emitServer('get:trailer2'); 70 | alt.onServer('send:trailer2', (closestVehicle) => { 71 | alt.emitServer('uppr', closestVehicle); 72 | }); 73 | } 74 | }); 75 | 76 | attachMenu.ItemSelect.on(item => { 77 | if (item == attachItem) { 78 | let veh = alt.Player.local.vehicle; 79 | alt.emitServer('get:trailer3'); 80 | alt.onServer('send:trailer3', (trailer) => { 81 | attach(veh, trailer); 82 | }); 83 | } 84 | if (item == attachUpprMidItem) { 85 | let veh = alt.Player.local.vehicle; 86 | alt.emitServer('get:trailer3'); 87 | alt.onServer('send:trailer3', (trailer) => { 88 | alt.emitServer('getDoorState', trailer, 0); 89 | alt.onServer('send:doorstate', (doorState) => { 90 | if(doorState == 0){ 91 | attachUpprMidUp(veh, trailer); 92 | } else if(doorState == 7){ 93 | attachUpprMidDown(veh, trailer); 94 | } 95 | }); 96 | }); 97 | } 98 | if (item == attachUpprEndItem) { 99 | let veh = alt.Player.local.vehicle; 100 | alt.emitServer('get:trailer3'); 101 | alt.onServer('send:trailer3', (trailer) => { 102 | alt.emitServer('getDoorState', trailer, 0); 103 | alt.onServer('send:doorstate', (doorState) => { 104 | if(doorState == 0){ 105 | attachUpprEndUp(veh, trailer); 106 | } else if(doorState == 7){ 107 | attachUpprEndDown(veh, trailer); 108 | } 109 | }); 110 | }); 111 | } 112 | if (item == detachItem) { 113 | let veh = alt.Player.local.vehicle; 114 | detach(veh) 115 | } 116 | }); 117 | 118 | flatbedMenu.ItemSelect.on(item => { 119 | if (item == getClosesItem) { 120 | let closestVehicle = getClosestVehicle(alt.Player.local); 121 | if(closestVehicle.model != alt.Player.local.vehicle){ 122 | currVehs.tow = closestVehicle; 123 | alt.emitServer('getNumberPlateText', closestVehicle); 124 | } 125 | } 126 | if (item instanceof NativeUI.UIMenuListItem) { 127 | if(item.SelectedItem.DisplayText == "Ground"){ 128 | detach2(false); 129 | flatbedMenuBuild(); 130 | } else if(item.SelectedItem.DisplayText == "Truck Bed"){ 131 | detach2(true); 132 | flatbedMenuBuild(); 133 | } 134 | } 135 | if (item instanceof NativeUI.UIMenuListItem) { 136 | if(item.SelectedItem.DisplayText == "Yes"){ 137 | flatbedAttachDo(); 138 | } else if(item.SelectedItem.DisplayText == "No"){ 139 | flatbedMenuBuild(); 140 | } 141 | } 142 | }); 143 | 144 | //Key Handles 145 | alt.on('keyup', (key) => { 146 | if(key === 71){ 147 | if(mainMenu.Visible || attachMenu.Visible || doorsMenu.Visible || flatbedMenu.Visible){ 148 | mainMenu.Close(); 149 | attachMenu.Close(); 150 | doorsMenu.Close(); 151 | flatbedMenu.Close(); 152 | } else if(!alt.Player.local.vehicle){ 153 | let closestVehicle = getClosestVehicle(alt.Player.local); 154 | let dist = distance(closestVehicle.pos, alt.Player.local.pos); 155 | if(closestVehicle.model == alt.hash('tr2') && dist <= 5){ 156 | mainMenu.Open(); 157 | alt.emitServer('send:trailer', closestVehicle); 158 | } 159 | } else if(alt.Player.local.vehicle && native.getEntityModel(alt.Player.local.vehicle.scriptID) == native.getHashKey('flatbed')){ 160 | alt.emitServer('flat:load'); 161 | } 162 | } 163 | if(key === 27){ 164 | if(mainMenu.Visible || attachMenu.Visible || doorsMenu.Visible || flatbedMenu.Visible){ 165 | mainMenu.Close(); 166 | attachMenu.Close(); 167 | doorsMenu.Close(); 168 | flatbedMenu.Close(); 169 | } 170 | } 171 | if(key === 70){ 172 | if(mainMenu.Visible || attachMenu.Visible || doorsMenu.Visible){ 173 | mainMenu.Close(); 174 | attachMenu.Close(); 175 | doorsMenu.Close(); 176 | } 177 | } 178 | }); 179 | 180 | //Server Side Triggers 181 | alt.onServer('flat:loadet', (serverFlats) => { 182 | let vehFound = false; 183 | serverFlats.forEach(e => { 184 | if(e.savedflat == alt.Player.local.vehicle){ 185 | flatbedMenu.Clear(); 186 | flatbedMenu.AddItem(detachItem2); 187 | flatbedMenu.Open(); 188 | currVehs.tow = e.savedtow; 189 | currVehs.flat = e.savedflat; 190 | vehFound = true; 191 | } 192 | }); 193 | if(!vehFound){ 194 | console.log("Du bist nicht auf Server gespeivhert"); 195 | flatbedMenuBuild(); 196 | currVehs.flat = alt.Player.local.vehicle; 197 | flatbedMenu.Open(); 198 | } 199 | }); 200 | 201 | alt.onServer('sendNumberPlateIndex', (veh, numberPlateText) => FlatbedAttach(veh, numberPlateText)); 202 | 203 | //Script Functions 204 | function attach (veh, trailer){ 205 | let bone = 18; 206 | let offset = { x: 0.0000, y: 6.5424, z: 0.2702 } 207 | let vehPos = native.getOffsetFromEntityGivenWorldCoords(trailer, veh.pos.x, veh.pos.y, veh.pos.z); 208 | let attachPos = {x: vehPos.x-offset.x, y: vehPos.y-offset.y, z: vehPos.z-offset.z} 209 | 210 | native.attachEntityToEntity(veh, trailer, bone, attachPos.x, attachPos.y, attachPos.z, 0, 0, 0, false, false, true, false, 20, true); 211 | } 212 | 213 | function attachUpprMidUp (veh, trailer){ 214 | let bone = 17; 215 | let offset = { x: 0.0000, y: 2.5, z: 2.4 } 216 | let vehPos = native.getOffsetFromEntityGivenWorldCoords(trailer, veh.pos.x, veh.pos.y, veh.pos.z); 217 | let attachPos = {x: vehPos.x-offset.x, y: vehPos.y-offset.y, z: vehPos.z-offset.z} 218 | 219 | native.attachEntityToEntity(veh, trailer, bone, attachPos.x, attachPos.y, attachPos.z, 0, 0, 0, false, false, true, false, 20, true); 220 | } 221 | 222 | function attachUpprEndUp (veh, trailer){ 223 | let bone = 17; 224 | let offset = {x: 0.0000, y: 2.5, z: 2.3} 225 | let vehPos = native.getOffsetFromEntityGivenWorldCoords(trailer, veh.pos.x, veh.pos.y, veh.pos.z); 226 | let attachPos = {x: vehPos.x-offset.x, y: vehPos.y-offset.y, z: vehPos.z-offset.z} 227 | 228 | native.attachEntityToEntity(veh, trailer, bone, attachPos.x, attachPos.y, attachPos.z, 0, 0, 0, false, false, true, false, 20, true); 229 | } 230 | 231 | function attachUpprMidDown (veh, trailer){ 232 | let bone = 17; 233 | let offset = { x: 0.0000, y: 2.5, z: 1.9 } 234 | let vehPos = native.getOffsetFromEntityGivenWorldCoords(trailer, veh.pos.x, veh.pos.y, veh.pos.z); 235 | let attachPos = {x: vehPos.x-offset.x, y: vehPos.y-offset.y, z: vehPos.z-offset.z} 236 | 237 | native.attachEntityToEntity(veh, trailer, bone, attachPos.x, attachPos.y, attachPos.z, 0, 0, 0, false, false, true, false, 20, true); 238 | } 239 | 240 | function attachUpprEndDown (veh, trailer){ 241 | let bone = 17; 242 | let offset = {x: 0.0000, y: 2.5, z: 0.8} 243 | let vehPos = native.getOffsetFromEntityGivenWorldCoords(trailer, veh.pos.x, veh.pos.y, veh.pos.z); 244 | let attachPos = {x: vehPos.x-offset.x, y: vehPos.y-offset.y, z: vehPos.z-offset.z} 245 | 246 | native.attachEntityToEntity(veh, trailer, bone, attachPos.x, attachPos.y, attachPos.z, 0, 0, 0, false, false, true, false, 20, true); 247 | } 248 | 249 | function detach (veh){ 250 | native.detachEntity(veh, true, true); 251 | } 252 | 253 | function detach2 (detachType) { 254 | if(detachType == false){ 255 | native.attachEntityToEntity(currVehs.tow, currVehs.flat, 20, -0.5, -13.0, 0.0, 0.0, 0.0, 0.0, false, false, true, false, 20, true); 256 | native.detachEntity(currVehs.tow, true, true); 257 | } else if(detachType == true){ 258 | native.detachEntity(currVehs.tow, true, true); 259 | } 260 | alt.emitServer('flat:del', currVehs.flat) 261 | currVehs.tow = undefined; 262 | } 263 | 264 | function FlatbedAttach (veh, numberPlateText){ 265 | flatbedMenu.Clear(); 266 | 267 | let attachVehicleItem = (new NativeUI.UIMenuListItem( 268 | `Attach ${numberPlateText}?`, 269 | `Attach vehicle with numberplate ${numberPlateText}?`, 270 | new NativeUI.ItemsCollection(["No", "Yes"]) 271 | )); 272 | flatbedMenu.AddItem(attachVehicleItem); 273 | } 274 | 275 | function flatbedAttachDo (){ 276 | native.attachEntityToEntity(currVehs.tow, currVehs.flat, 20, -0.5, -5.5, 1.0, 0.0, 0.0, 0.0, true, false, true, false, 10, true); 277 | 278 | alt.setTimeout(() => { 279 | native.detachEntity(currVehs.tow, true, true); 280 | alt.setTimeout(() => { 281 | let vehPos = native.getOffsetFromEntityGivenWorldCoords(currVehs.flat, currVehs.tow.pos.x, currVehs.tow.pos.y, currVehs.tow.pos.z); 282 | let attachPos = {x: vehPos.x, y: vehPos.y, z: vehPos.z} 283 | 284 | native.attachEntityToEntity(currVehs.tow, currVehs.flat, 20, -0.5, -5.5, attachPos.z, 0, 0, 0, false, false, true, false, 20, true); 285 | }, 1000); 286 | }, 100); 287 | 288 | flatbedMenuBuild(); 289 | flatbedMenu.Close(); 290 | alt.emitServer('flat:save', currVehs.tow, currVehs.flat); 291 | } 292 | 293 | function flatbedMenuBuild (){ 294 | flatbedMenu.Clear(); 295 | flatbedMenu.AddItem(getClosesItem); 296 | } 297 | 298 | //Distance Functions 299 | /** 300 | * Get all players in a certain range of a position. 301 | * @param {} pos 302 | * @param {} range 303 | * @param {} dimension=0 304 | * @returns {Array} 305 | */ 306 | export function getPlayersInRange(pos, range, dimension = 0) { 307 | if (pos === undefined || range === undefined) { 308 | throw new Error('GetPlayersInRange => pos or range is undefined'); 309 | } 310 | 311 | return alt.Player.all.filter(player => { 312 | return player.dimension === dimension && distance2d(pos, player.pos) <= range; 313 | }); 314 | } 315 | 316 | /** 317 | * Get the forward vector of a player. 318 | * @param {} rot 319 | * @returns {{x,y,z}} 320 | */ 321 | export function getForwardVectorServer(rot) { 322 | const z = -rot.z; 323 | const x = rot.x; 324 | const num = Math.abs(Math.cos(x)); 325 | return { 326 | x: -Math.sin(z) * num, 327 | y: Math.cos(z) * num, 328 | z: Math.sin(x) 329 | }; 330 | } 331 | 332 | /** 333 | * Get the distance from one vector to another. 334 | * Does take Z-Axis into consideration. 335 | * @param {} vector1 336 | * @param {} vector2 337 | * @returns {number} 338 | */ 339 | export function distance(vector1, vector2) { 340 | if (vector1 === undefined || vector2 === undefined) { 341 | throw new Error('AddVector => vector1 or vector2 is undefined'); 342 | } 343 | 344 | return Math.sqrt( 345 | Math.pow(vector1.x - vector2.x, 2) + Math.pow(vector1.y - vector2.y, 2) + Math.pow(vector1.z - vector2.z, 2) 346 | ); 347 | } 348 | 349 | /** 350 | * Get the distance from one vector to another. 351 | * Does not take Z-Axis into consideration. 352 | * @param {} vector1 353 | * @param {} vector2 354 | * @returns {{x,y,z}} 355 | */ 356 | export function distance2d(vector1, vector2) { 357 | if (vector1 === undefined || vector2 === undefined) { 358 | throw new Error('AddVector => vector1 or vector2 is undefined'); 359 | } 360 | 361 | return Math.sqrt(Math.pow(vector1.x - vector2.x, 2) + Math.pow(vector1.y - vector2.y, 2)); 362 | } 363 | 364 | /** 365 | * Check if a position is between two vectors. 366 | * @param {} pos 367 | * @param {} vector1 368 | * @param {} vector2 369 | * @returns {boolean} 370 | */ 371 | export function isBetween(pos, vector1, vector2) { 372 | const validX = pos.x > vector1.x && pos.x < vector2.x; 373 | const validY = pos.y > vector1.y && pos.y < vector2.y; 374 | return validX && validY ? true : false; 375 | } 376 | 377 | /** 378 | * Get a random position around a position. 379 | * @param {} position 380 | * @param {} range 381 | * @returns {{x,y,z}} 382 | */ 383 | export function randomPositionAround(position, range) { 384 | return { 385 | x: position.x + Math.random() * (range * 2) - range, 386 | y: position.y + Math.random() * (range * 2) - range, 387 | z: position.z 388 | }; 389 | } 390 | 391 | /** 392 | * Get the closest vector from a group of vectors. 393 | * @param {alt.Vector3} pos 394 | * @param {Array<{x,y,z}> | Array<{pos:alt.Vector3}} arrayOfPositions 395 | * @returns {Array} 396 | */ 397 | export function getClosestVectorFromGroup(pos, arrayOfPositions) { 398 | arrayOfPositions.sort((a, b) => { 399 | if (a.pos && b.pos) { 400 | return distance(pos, a.pos) - distance(pos, b.pos); 401 | } 402 | 403 | return distance(pos, a.pos) - distance(pos, b.pos); 404 | }); 405 | 406 | return arrayOfPositions[0]; 407 | } 408 | 409 | /** 410 | * Get the closest player to a player. 411 | * @param {} player 412 | * @returns {Array} 413 | */ 414 | export function getClosestPlayer(player) { 415 | return getClosestVectorFromGroup(player.pos, [...alt.Player.all]); 416 | } 417 | 418 | /** 419 | * Get the closest vehicle to a player. 420 | * @param {alt.Vector3} player 421 | * @returns {Array} 422 | */ 423 | export function getClosestVehicle(player) { 424 | return getClosestVectorFromGroup(player.pos, [...alt.Vehicle.all]); 425 | } -------------------------------------------------------------------------------- /client/includes/NativeUI/enums/Control.js: -------------------------------------------------------------------------------- 1 | var Control; 2 | (function (Control) { 3 | Control[Control["NextCamera"] = 0] = "NextCamera"; 4 | Control[Control["LookLeftRight"] = 1] = "LookLeftRight"; 5 | Control[Control["LookUpDown"] = 2] = "LookUpDown"; 6 | Control[Control["LookUpOnly"] = 3] = "LookUpOnly"; 7 | Control[Control["LookDownOnly"] = 4] = "LookDownOnly"; 8 | Control[Control["LookLeftOnly"] = 5] = "LookLeftOnly"; 9 | Control[Control["LookRightOnly"] = 6] = "LookRightOnly"; 10 | Control[Control["CinematicSlowMo"] = 7] = "CinematicSlowMo"; 11 | Control[Control["FlyUpDown"] = 8] = "FlyUpDown"; 12 | Control[Control["FlyLeftRight"] = 9] = "FlyLeftRight"; 13 | Control[Control["ScriptedFlyZUp"] = 10] = "ScriptedFlyZUp"; 14 | Control[Control["ScriptedFlyZDown"] = 11] = "ScriptedFlyZDown"; 15 | Control[Control["WeaponWheelUpDown"] = 12] = "WeaponWheelUpDown"; 16 | Control[Control["WeaponWheelLeftRight"] = 13] = "WeaponWheelLeftRight"; 17 | Control[Control["WeaponWheelNext"] = 14] = "WeaponWheelNext"; 18 | Control[Control["WeaponWheelPrev"] = 15] = "WeaponWheelPrev"; 19 | Control[Control["SelectNextWeapon"] = 16] = "SelectNextWeapon"; 20 | Control[Control["SelectPrevWeapon"] = 17] = "SelectPrevWeapon"; 21 | Control[Control["SkipCutscene"] = 18] = "SkipCutscene"; 22 | Control[Control["CharacterWheel"] = 19] = "CharacterWheel"; 23 | Control[Control["MultiplayerInfo"] = 20] = "MultiplayerInfo"; 24 | Control[Control["Sprint"] = 21] = "Sprint"; 25 | Control[Control["Jump"] = 22] = "Jump"; 26 | Control[Control["Enter"] = 23] = "Enter"; 27 | Control[Control["Attack"] = 24] = "Attack"; 28 | Control[Control["Aim"] = 25] = "Aim"; 29 | Control[Control["LookBehind"] = 26] = "LookBehind"; 30 | Control[Control["Phone"] = 27] = "Phone"; 31 | Control[Control["SpecialAbility"] = 28] = "SpecialAbility"; 32 | Control[Control["SpecialAbilitySecondary"] = 29] = "SpecialAbilitySecondary"; 33 | Control[Control["MoveLeftRight"] = 30] = "MoveLeftRight"; 34 | Control[Control["MoveUpDown"] = 31] = "MoveUpDown"; 35 | Control[Control["MoveUpOnly"] = 32] = "MoveUpOnly"; 36 | Control[Control["MoveDownOnly"] = 33] = "MoveDownOnly"; 37 | Control[Control["MoveLeftOnly"] = 34] = "MoveLeftOnly"; 38 | Control[Control["MoveRightOnly"] = 35] = "MoveRightOnly"; 39 | Control[Control["Duck"] = 36] = "Duck"; 40 | Control[Control["SelectWeapon"] = 37] = "SelectWeapon"; 41 | Control[Control["Pickup"] = 38] = "Pickup"; 42 | Control[Control["SniperZoom"] = 39] = "SniperZoom"; 43 | Control[Control["SniperZoomInOnly"] = 40] = "SniperZoomInOnly"; 44 | Control[Control["SniperZoomOutOnly"] = 41] = "SniperZoomOutOnly"; 45 | Control[Control["SniperZoomInSecondary"] = 42] = "SniperZoomInSecondary"; 46 | Control[Control["SniperZoomOutSecondary"] = 43] = "SniperZoomOutSecondary"; 47 | Control[Control["Cover"] = 44] = "Cover"; 48 | Control[Control["Reload"] = 45] = "Reload"; 49 | Control[Control["Talk"] = 46] = "Talk"; 50 | Control[Control["Detonate"] = 47] = "Detonate"; 51 | Control[Control["HUDSpecial"] = 48] = "HUDSpecial"; 52 | Control[Control["Arrest"] = 49] = "Arrest"; 53 | Control[Control["AccurateAim"] = 50] = "AccurateAim"; 54 | Control[Control["Context"] = 51] = "Context"; 55 | Control[Control["ContextSecondary"] = 52] = "ContextSecondary"; 56 | Control[Control["WeaponSpecial"] = 53] = "WeaponSpecial"; 57 | Control[Control["WeaponSpecial2"] = 54] = "WeaponSpecial2"; 58 | Control[Control["Dive"] = 55] = "Dive"; 59 | Control[Control["DropWeapon"] = 56] = "DropWeapon"; 60 | Control[Control["DropAmmo"] = 57] = "DropAmmo"; 61 | Control[Control["ThrowGrenade"] = 58] = "ThrowGrenade"; 62 | Control[Control["VehicleMoveLeftRight"] = 59] = "VehicleMoveLeftRight"; 63 | Control[Control["VehicleMoveUpDown"] = 60] = "VehicleMoveUpDown"; 64 | Control[Control["VehicleMoveUpOnly"] = 61] = "VehicleMoveUpOnly"; 65 | Control[Control["VehicleMoveDownOnly"] = 62] = "VehicleMoveDownOnly"; 66 | Control[Control["VehicleMoveLeftOnly"] = 63] = "VehicleMoveLeftOnly"; 67 | Control[Control["VehicleMoveRightOnly"] = 64] = "VehicleMoveRightOnly"; 68 | Control[Control["VehicleSpecial"] = 65] = "VehicleSpecial"; 69 | Control[Control["VehicleGunLeftRight"] = 66] = "VehicleGunLeftRight"; 70 | Control[Control["VehicleGunUpDown"] = 67] = "VehicleGunUpDown"; 71 | Control[Control["VehicleAim"] = 68] = "VehicleAim"; 72 | Control[Control["VehicleAttack"] = 69] = "VehicleAttack"; 73 | Control[Control["VehicleAttack2"] = 70] = "VehicleAttack2"; 74 | Control[Control["VehicleAccelerate"] = 71] = "VehicleAccelerate"; 75 | Control[Control["VehicleBrake"] = 72] = "VehicleBrake"; 76 | Control[Control["VehicleDuck"] = 73] = "VehicleDuck"; 77 | Control[Control["VehicleHeadlight"] = 74] = "VehicleHeadlight"; 78 | Control[Control["VehicleExit"] = 75] = "VehicleExit"; 79 | Control[Control["VehicleHandbrake"] = 76] = "VehicleHandbrake"; 80 | Control[Control["VehicleHotwireLeft"] = 77] = "VehicleHotwireLeft"; 81 | Control[Control["VehicleHotwireRight"] = 78] = "VehicleHotwireRight"; 82 | Control[Control["VehicleLookBehind"] = 79] = "VehicleLookBehind"; 83 | Control[Control["VehicleCinCam"] = 80] = "VehicleCinCam"; 84 | Control[Control["VehicleNextRadio"] = 81] = "VehicleNextRadio"; 85 | Control[Control["VehiclePrevRadio"] = 82] = "VehiclePrevRadio"; 86 | Control[Control["VehicleNextRadioTrack"] = 83] = "VehicleNextRadioTrack"; 87 | Control[Control["VehiclePrevRadioTrack"] = 84] = "VehiclePrevRadioTrack"; 88 | Control[Control["VehicleRadioWheel"] = 85] = "VehicleRadioWheel"; 89 | Control[Control["VehicleHorn"] = 86] = "VehicleHorn"; 90 | Control[Control["VehicleFlyThrottleUp"] = 87] = "VehicleFlyThrottleUp"; 91 | Control[Control["VehicleFlyThrottleDown"] = 88] = "VehicleFlyThrottleDown"; 92 | Control[Control["VehicleFlyYawLeft"] = 89] = "VehicleFlyYawLeft"; 93 | Control[Control["VehicleFlyYawRight"] = 90] = "VehicleFlyYawRight"; 94 | Control[Control["VehiclePassengerAim"] = 91] = "VehiclePassengerAim"; 95 | Control[Control["VehiclePassengerAttack"] = 92] = "VehiclePassengerAttack"; 96 | Control[Control["VehicleSpecialAbilityFranklin"] = 93] = "VehicleSpecialAbilityFranklin"; 97 | Control[Control["VehicleStuntUpDown"] = 94] = "VehicleStuntUpDown"; 98 | Control[Control["VehicleCinematicUpDown"] = 95] = "VehicleCinematicUpDown"; 99 | Control[Control["VehicleCinematicUpOnly"] = 96] = "VehicleCinematicUpOnly"; 100 | Control[Control["VehicleCinematicDownOnly"] = 97] = "VehicleCinematicDownOnly"; 101 | Control[Control["VehicleCinematicLeftRight"] = 98] = "VehicleCinematicLeftRight"; 102 | Control[Control["VehicleSelectNextWeapon"] = 99] = "VehicleSelectNextWeapon"; 103 | Control[Control["VehicleSelectPrevWeapon"] = 100] = "VehicleSelectPrevWeapon"; 104 | Control[Control["VehicleRoof"] = 101] = "VehicleRoof"; 105 | Control[Control["VehicleJump"] = 102] = "VehicleJump"; 106 | Control[Control["VehicleGrapplingHook"] = 103] = "VehicleGrapplingHook"; 107 | Control[Control["VehicleShuffle"] = 104] = "VehicleShuffle"; 108 | Control[Control["VehicleDropProjectile"] = 105] = "VehicleDropProjectile"; 109 | Control[Control["VehicleMouseControlOverride"] = 106] = "VehicleMouseControlOverride"; 110 | Control[Control["VehicleFlyRollLeftRight"] = 107] = "VehicleFlyRollLeftRight"; 111 | Control[Control["VehicleFlyRollLeftOnly"] = 108] = "VehicleFlyRollLeftOnly"; 112 | Control[Control["VehicleFlyRollRightOnly"] = 109] = "VehicleFlyRollRightOnly"; 113 | Control[Control["VehicleFlyPitchUpDown"] = 110] = "VehicleFlyPitchUpDown"; 114 | Control[Control["VehicleFlyPitchUpOnly"] = 111] = "VehicleFlyPitchUpOnly"; 115 | Control[Control["VehicleFlyPitchDownOnly"] = 112] = "VehicleFlyPitchDownOnly"; 116 | Control[Control["VehicleFlyUnderCarriage"] = 113] = "VehicleFlyUnderCarriage"; 117 | Control[Control["VehicleFlyAttack"] = 114] = "VehicleFlyAttack"; 118 | Control[Control["VehicleFlySelectNextWeapon"] = 115] = "VehicleFlySelectNextWeapon"; 119 | Control[Control["VehicleFlySelectPrevWeapon"] = 116] = "VehicleFlySelectPrevWeapon"; 120 | Control[Control["VehicleFlySelectTargetLeft"] = 117] = "VehicleFlySelectTargetLeft"; 121 | Control[Control["VehicleFlySelectTargetRight"] = 118] = "VehicleFlySelectTargetRight"; 122 | Control[Control["VehicleFlyVerticalFlightMode"] = 119] = "VehicleFlyVerticalFlightMode"; 123 | Control[Control["VehicleFlyDuck"] = 120] = "VehicleFlyDuck"; 124 | Control[Control["VehicleFlyAttackCamera"] = 121] = "VehicleFlyAttackCamera"; 125 | Control[Control["VehicleFlyMouseControlOverride"] = 122] = "VehicleFlyMouseControlOverride"; 126 | Control[Control["VehicleSubTurnLeftRight"] = 123] = "VehicleSubTurnLeftRight"; 127 | Control[Control["VehicleSubTurnLeftOnly"] = 124] = "VehicleSubTurnLeftOnly"; 128 | Control[Control["VehicleSubTurnRightOnly"] = 125] = "VehicleSubTurnRightOnly"; 129 | Control[Control["VehicleSubPitchUpDown"] = 126] = "VehicleSubPitchUpDown"; 130 | Control[Control["VehicleSubPitchUpOnly"] = 127] = "VehicleSubPitchUpOnly"; 131 | Control[Control["VehicleSubPitchDownOnly"] = 128] = "VehicleSubPitchDownOnly"; 132 | Control[Control["VehicleSubThrottleUp"] = 129] = "VehicleSubThrottleUp"; 133 | Control[Control["VehicleSubThrottleDown"] = 130] = "VehicleSubThrottleDown"; 134 | Control[Control["VehicleSubAscend"] = 131] = "VehicleSubAscend"; 135 | Control[Control["VehicleSubDescend"] = 132] = "VehicleSubDescend"; 136 | Control[Control["VehicleSubTurnHardLeft"] = 133] = "VehicleSubTurnHardLeft"; 137 | Control[Control["VehicleSubTurnHardRight"] = 134] = "VehicleSubTurnHardRight"; 138 | Control[Control["VehicleSubMouseControlOverride"] = 135] = "VehicleSubMouseControlOverride"; 139 | Control[Control["VehiclePushbikePedal"] = 136] = "VehiclePushbikePedal"; 140 | Control[Control["VehiclePushbikeSprint"] = 137] = "VehiclePushbikeSprint"; 141 | Control[Control["VehiclePushbikeFrontBrake"] = 138] = "VehiclePushbikeFrontBrake"; 142 | Control[Control["VehiclePushbikeRearBrake"] = 139] = "VehiclePushbikeRearBrake"; 143 | Control[Control["MeleeAttackLight"] = 140] = "MeleeAttackLight"; 144 | Control[Control["MeleeAttackHeavy"] = 141] = "MeleeAttackHeavy"; 145 | Control[Control["MeleeAttackAlternate"] = 142] = "MeleeAttackAlternate"; 146 | Control[Control["MeleeBlock"] = 143] = "MeleeBlock"; 147 | Control[Control["ParachuteDeploy"] = 144] = "ParachuteDeploy"; 148 | Control[Control["ParachuteDetach"] = 145] = "ParachuteDetach"; 149 | Control[Control["ParachuteTurnLeftRight"] = 146] = "ParachuteTurnLeftRight"; 150 | Control[Control["ParachuteTurnLeftOnly"] = 147] = "ParachuteTurnLeftOnly"; 151 | Control[Control["ParachuteTurnRightOnly"] = 148] = "ParachuteTurnRightOnly"; 152 | Control[Control["ParachutePitchUpDown"] = 149] = "ParachutePitchUpDown"; 153 | Control[Control["ParachutePitchUpOnly"] = 150] = "ParachutePitchUpOnly"; 154 | Control[Control["ParachutePitchDownOnly"] = 151] = "ParachutePitchDownOnly"; 155 | Control[Control["ParachuteBrakeLeft"] = 152] = "ParachuteBrakeLeft"; 156 | Control[Control["ParachuteBrakeRight"] = 153] = "ParachuteBrakeRight"; 157 | Control[Control["ParachuteSmoke"] = 154] = "ParachuteSmoke"; 158 | Control[Control["ParachutePrecisionLanding"] = 155] = "ParachutePrecisionLanding"; 159 | Control[Control["Map"] = 156] = "Map"; 160 | Control[Control["SelectWeaponUnarmed"] = 157] = "SelectWeaponUnarmed"; 161 | Control[Control["SelectWeaponMelee"] = 158] = "SelectWeaponMelee"; 162 | Control[Control["SelectWeaponHandgun"] = 159] = "SelectWeaponHandgun"; 163 | Control[Control["SelectWeaponShotgun"] = 160] = "SelectWeaponShotgun"; 164 | Control[Control["SelectWeaponSmg"] = 161] = "SelectWeaponSmg"; 165 | Control[Control["SelectWeaponAutoRifle"] = 162] = "SelectWeaponAutoRifle"; 166 | Control[Control["SelectWeaponSniper"] = 163] = "SelectWeaponSniper"; 167 | Control[Control["SelectWeaponHeavy"] = 164] = "SelectWeaponHeavy"; 168 | Control[Control["SelectWeaponSpecial"] = 165] = "SelectWeaponSpecial"; 169 | Control[Control["SelectCharacterMichael"] = 166] = "SelectCharacterMichael"; 170 | Control[Control["SelectCharacterFranklin"] = 167] = "SelectCharacterFranklin"; 171 | Control[Control["SelectCharacterTrevor"] = 168] = "SelectCharacterTrevor"; 172 | Control[Control["SelectCharacterMultiplayer"] = 169] = "SelectCharacterMultiplayer"; 173 | Control[Control["SaveReplayClip"] = 170] = "SaveReplayClip"; 174 | Control[Control["SpecialAbilityPC"] = 171] = "SpecialAbilityPC"; 175 | Control[Control["PhoneUp"] = 172] = "PhoneUp"; 176 | Control[Control["PhoneDown"] = 173] = "PhoneDown"; 177 | Control[Control["PhoneLeft"] = 174] = "PhoneLeft"; 178 | Control[Control["PhoneRight"] = 175] = "PhoneRight"; 179 | Control[Control["PhoneSelect"] = 176] = "PhoneSelect"; 180 | Control[Control["PhoneCancel"] = 177] = "PhoneCancel"; 181 | Control[Control["PhoneOption"] = 178] = "PhoneOption"; 182 | Control[Control["PhoneExtraOption"] = 179] = "PhoneExtraOption"; 183 | Control[Control["PhoneScrollForward"] = 180] = "PhoneScrollForward"; 184 | Control[Control["PhoneScrollBackward"] = 181] = "PhoneScrollBackward"; 185 | Control[Control["PhoneCameraFocusLock"] = 182] = "PhoneCameraFocusLock"; 186 | Control[Control["PhoneCameraGrid"] = 183] = "PhoneCameraGrid"; 187 | Control[Control["PhoneCameraSelfie"] = 184] = "PhoneCameraSelfie"; 188 | Control[Control["PhoneCameraDOF"] = 185] = "PhoneCameraDOF"; 189 | Control[Control["PhoneCameraExpression"] = 186] = "PhoneCameraExpression"; 190 | Control[Control["FrontendDown"] = 187] = "FrontendDown"; 191 | Control[Control["FrontendUp"] = 188] = "FrontendUp"; 192 | Control[Control["FrontendLeft"] = 189] = "FrontendLeft"; 193 | Control[Control["FrontendRight"] = 190] = "FrontendRight"; 194 | Control[Control["FrontendRdown"] = 191] = "FrontendRdown"; 195 | Control[Control["FrontendRup"] = 192] = "FrontendRup"; 196 | Control[Control["FrontendRleft"] = 193] = "FrontendRleft"; 197 | Control[Control["FrontendRright"] = 194] = "FrontendRright"; 198 | Control[Control["FrontendAxisX"] = 195] = "FrontendAxisX"; 199 | Control[Control["FrontendAxisY"] = 196] = "FrontendAxisY"; 200 | Control[Control["FrontendRightAxisX"] = 197] = "FrontendRightAxisX"; 201 | Control[Control["FrontendRightAxisY"] = 198] = "FrontendRightAxisY"; 202 | Control[Control["FrontendPause"] = 199] = "FrontendPause"; 203 | Control[Control["FrontendPauseAlternate"] = 200] = "FrontendPauseAlternate"; 204 | Control[Control["FrontendAccept"] = 201] = "FrontendAccept"; 205 | Control[Control["FrontendCancel"] = 202] = "FrontendCancel"; 206 | Control[Control["FrontendX"] = 203] = "FrontendX"; 207 | Control[Control["FrontendY"] = 204] = "FrontendY"; 208 | Control[Control["FrontendLb"] = 205] = "FrontendLb"; 209 | Control[Control["FrontendRb"] = 206] = "FrontendRb"; 210 | Control[Control["FrontendLt"] = 207] = "FrontendLt"; 211 | Control[Control["FrontendRt"] = 208] = "FrontendRt"; 212 | Control[Control["FrontendLs"] = 209] = "FrontendLs"; 213 | Control[Control["FrontendRs"] = 210] = "FrontendRs"; 214 | Control[Control["FrontendLeaderboard"] = 211] = "FrontendLeaderboard"; 215 | Control[Control["FrontendSocialClub"] = 212] = "FrontendSocialClub"; 216 | Control[Control["FrontendSocialClubSecondary"] = 213] = "FrontendSocialClubSecondary"; 217 | Control[Control["FrontendDelete"] = 214] = "FrontendDelete"; 218 | Control[Control["FrontendEndscreenAccept"] = 215] = "FrontendEndscreenAccept"; 219 | Control[Control["FrontendEndscreenExpand"] = 216] = "FrontendEndscreenExpand"; 220 | Control[Control["FrontendSelect"] = 217] = "FrontendSelect"; 221 | Control[Control["ScriptLeftAxisX"] = 218] = "ScriptLeftAxisX"; 222 | Control[Control["ScriptLeftAxisY"] = 219] = "ScriptLeftAxisY"; 223 | Control[Control["ScriptRightAxisX"] = 220] = "ScriptRightAxisX"; 224 | Control[Control["ScriptRightAxisY"] = 221] = "ScriptRightAxisY"; 225 | Control[Control["ScriptRUp"] = 222] = "ScriptRUp"; 226 | Control[Control["ScriptRDown"] = 223] = "ScriptRDown"; 227 | Control[Control["ScriptRLeft"] = 224] = "ScriptRLeft"; 228 | Control[Control["ScriptRRight"] = 225] = "ScriptRRight"; 229 | Control[Control["ScriptLB"] = 226] = "ScriptLB"; 230 | Control[Control["ScriptRB"] = 227] = "ScriptRB"; 231 | Control[Control["ScriptLT"] = 228] = "ScriptLT"; 232 | Control[Control["ScriptRT"] = 229] = "ScriptRT"; 233 | Control[Control["ScriptLS"] = 230] = "ScriptLS"; 234 | Control[Control["ScriptRS"] = 231] = "ScriptRS"; 235 | Control[Control["ScriptPadUp"] = 232] = "ScriptPadUp"; 236 | Control[Control["ScriptPadDown"] = 233] = "ScriptPadDown"; 237 | Control[Control["ScriptPadLeft"] = 234] = "ScriptPadLeft"; 238 | Control[Control["ScriptPadRight"] = 235] = "ScriptPadRight"; 239 | Control[Control["ScriptSelect"] = 236] = "ScriptSelect"; 240 | Control[Control["CursorAccept"] = 237] = "CursorAccept"; 241 | Control[Control["CursorCancel"] = 238] = "CursorCancel"; 242 | Control[Control["CursorX"] = 239] = "CursorX"; 243 | Control[Control["CursorY"] = 240] = "CursorY"; 244 | Control[Control["CursorScrollUp"] = 241] = "CursorScrollUp"; 245 | Control[Control["CursorScrollDown"] = 242] = "CursorScrollDown"; 246 | Control[Control["EnterCheatCode"] = 243] = "EnterCheatCode"; 247 | Control[Control["InteractionMenu"] = 244] = "InteractionMenu"; 248 | Control[Control["MpTextChatAll"] = 245] = "MpTextChatAll"; 249 | Control[Control["MpTextChatTeam"] = 246] = "MpTextChatTeam"; 250 | Control[Control["MpTextChatFriends"] = 247] = "MpTextChatFriends"; 251 | Control[Control["MpTextChatCrew"] = 248] = "MpTextChatCrew"; 252 | Control[Control["PushToTalk"] = 249] = "PushToTalk"; 253 | Control[Control["CreatorLS"] = 250] = "CreatorLS"; 254 | Control[Control["CreatorRS"] = 251] = "CreatorRS"; 255 | Control[Control["CreatorLT"] = 252] = "CreatorLT"; 256 | Control[Control["CreatorRT"] = 253] = "CreatorRT"; 257 | Control[Control["CreatorMenuToggle"] = 254] = "CreatorMenuToggle"; 258 | Control[Control["CreatorAccept"] = 255] = "CreatorAccept"; 259 | Control[Control["CreatorDelete"] = 256] = "CreatorDelete"; 260 | Control[Control["Attack2"] = 257] = "Attack2"; 261 | Control[Control["RappelJump"] = 258] = "RappelJump"; 262 | Control[Control["RappelLongJump"] = 259] = "RappelLongJump"; 263 | Control[Control["RappelSmashWindow"] = 260] = "RappelSmashWindow"; 264 | Control[Control["PrevWeapon"] = 261] = "PrevWeapon"; 265 | Control[Control["NextWeapon"] = 262] = "NextWeapon"; 266 | Control[Control["MeleeAttack1"] = 263] = "MeleeAttack1"; 267 | Control[Control["MeleeAttack2"] = 264] = "MeleeAttack2"; 268 | Control[Control["Whistle"] = 265] = "Whistle"; 269 | Control[Control["MoveLeft"] = 266] = "MoveLeft"; 270 | Control[Control["MoveRight"] = 267] = "MoveRight"; 271 | Control[Control["MoveUp"] = 268] = "MoveUp"; 272 | Control[Control["MoveDown"] = 269] = "MoveDown"; 273 | Control[Control["LookLeft"] = 270] = "LookLeft"; 274 | Control[Control["LookRight"] = 271] = "LookRight"; 275 | Control[Control["LookUp"] = 272] = "LookUp"; 276 | Control[Control["LookDown"] = 273] = "LookDown"; 277 | Control[Control["SniperZoomIn"] = 274] = "SniperZoomIn"; 278 | Control[Control["SniperZoomOut"] = 275] = "SniperZoomOut"; 279 | Control[Control["SniperZoomInAlternate"] = 276] = "SniperZoomInAlternate"; 280 | Control[Control["SniperZoomOutAlternate"] = 277] = "SniperZoomOutAlternate"; 281 | Control[Control["VehicleMoveLeft"] = 278] = "VehicleMoveLeft"; 282 | Control[Control["VehicleMoveRight"] = 279] = "VehicleMoveRight"; 283 | Control[Control["VehicleMoveUp"] = 280] = "VehicleMoveUp"; 284 | Control[Control["VehicleMoveDown"] = 281] = "VehicleMoveDown"; 285 | Control[Control["VehicleGunLeft"] = 282] = "VehicleGunLeft"; 286 | Control[Control["VehicleGunRight"] = 283] = "VehicleGunRight"; 287 | Control[Control["VehicleGunUp"] = 284] = "VehicleGunUp"; 288 | Control[Control["VehicleGunDown"] = 285] = "VehicleGunDown"; 289 | Control[Control["VehicleLookLeft"] = 286] = "VehicleLookLeft"; 290 | Control[Control["VehicleLookRight"] = 287] = "VehicleLookRight"; 291 | Control[Control["ReplayStartStopRecording"] = 288] = "ReplayStartStopRecording"; 292 | Control[Control["ReplayStartStopRecordingSecondary"] = 289] = "ReplayStartStopRecordingSecondary"; 293 | Control[Control["ScaledLookLeftRight"] = 290] = "ScaledLookLeftRight"; 294 | Control[Control["ScaledLookUpDown"] = 291] = "ScaledLookUpDown"; 295 | Control[Control["ScaledLookUpOnly"] = 292] = "ScaledLookUpOnly"; 296 | Control[Control["ScaledLookDownOnly"] = 293] = "ScaledLookDownOnly"; 297 | Control[Control["ScaledLookLeftOnly"] = 294] = "ScaledLookLeftOnly"; 298 | Control[Control["ScaledLookRightOnly"] = 295] = "ScaledLookRightOnly"; 299 | Control[Control["ReplayMarkerDelete"] = 296] = "ReplayMarkerDelete"; 300 | Control[Control["ReplayClipDelete"] = 297] = "ReplayClipDelete"; 301 | Control[Control["ReplayPause"] = 298] = "ReplayPause"; 302 | Control[Control["ReplayRewind"] = 299] = "ReplayRewind"; 303 | Control[Control["ReplayFfwd"] = 300] = "ReplayFfwd"; 304 | Control[Control["ReplayNewmarker"] = 301] = "ReplayNewmarker"; 305 | Control[Control["ReplayRecord"] = 302] = "ReplayRecord"; 306 | Control[Control["ReplayScreenshot"] = 303] = "ReplayScreenshot"; 307 | Control[Control["ReplayHidehud"] = 304] = "ReplayHidehud"; 308 | Control[Control["ReplayStartpoint"] = 305] = "ReplayStartpoint"; 309 | Control[Control["ReplayEndpoint"] = 306] = "ReplayEndpoint"; 310 | Control[Control["ReplayAdvance"] = 307] = "ReplayAdvance"; 311 | Control[Control["ReplayBack"] = 308] = "ReplayBack"; 312 | Control[Control["ReplayTools"] = 309] = "ReplayTools"; 313 | Control[Control["ReplayRestart"] = 310] = "ReplayRestart"; 314 | Control[Control["ReplayShowhotkey"] = 311] = "ReplayShowhotkey"; 315 | Control[Control["ReplayCycleMarkerLeft"] = 312] = "ReplayCycleMarkerLeft"; 316 | Control[Control["ReplayCycleMarkerRight"] = 313] = "ReplayCycleMarkerRight"; 317 | Control[Control["ReplayFOVIncrease"] = 314] = "ReplayFOVIncrease"; 318 | Control[Control["ReplayFOVDecrease"] = 315] = "ReplayFOVDecrease"; 319 | Control[Control["ReplayCameraUp"] = 316] = "ReplayCameraUp"; 320 | Control[Control["ReplayCameraDown"] = 317] = "ReplayCameraDown"; 321 | Control[Control["ReplaySave"] = 318] = "ReplaySave"; 322 | Control[Control["ReplayToggletime"] = 319] = "ReplayToggletime"; 323 | Control[Control["ReplayToggletips"] = 320] = "ReplayToggletips"; 324 | Control[Control["ReplayPreview"] = 321] = "ReplayPreview"; 325 | Control[Control["ReplayToggleTimeline"] = 322] = "ReplayToggleTimeline"; 326 | Control[Control["ReplayTimelinePickupClip"] = 323] = "ReplayTimelinePickupClip"; 327 | Control[Control["ReplayTimelineDuplicateClip"] = 324] = "ReplayTimelineDuplicateClip"; 328 | Control[Control["ReplayTimelinePlaceClip"] = 325] = "ReplayTimelinePlaceClip"; 329 | Control[Control["ReplayCtrl"] = 326] = "ReplayCtrl"; 330 | Control[Control["ReplayTimelineSave"] = 327] = "ReplayTimelineSave"; 331 | Control[Control["ReplayPreviewAudio"] = 328] = "ReplayPreviewAudio"; 332 | Control[Control["VehicleDriveLook"] = 329] = "VehicleDriveLook"; 333 | Control[Control["VehicleDriveLook2"] = 330] = "VehicleDriveLook2"; 334 | Control[Control["VehicleFlyAttack2"] = 331] = "VehicleFlyAttack2"; 335 | Control[Control["RadioWheelUpDown"] = 332] = "RadioWheelUpDown"; 336 | Control[Control["RadioWheelLeftRight"] = 333] = "RadioWheelLeftRight"; 337 | Control[Control["VehicleSlowMoUpDown"] = 334] = "VehicleSlowMoUpDown"; 338 | Control[Control["VehicleSlowMoUpOnly"] = 335] = "VehicleSlowMoUpOnly"; 339 | Control[Control["VehicleSlowMoDownOnly"] = 336] = "VehicleSlowMoDownOnly"; 340 | Control[Control["MapPointOfInterest"] = 337] = "MapPointOfInterest"; 341 | Control[Control["ReplaySnapmaticPhoto"] = 338] = "ReplaySnapmaticPhoto"; 342 | Control[Control["VehicleCarJump"] = 339] = "VehicleCarJump"; 343 | Control[Control["VehicleRocketBoost"] = 340] = "VehicleRocketBoost"; 344 | Control[Control["VehicleParachute"] = 341] = "VehicleParachute"; 345 | Control[Control["VehicleBikeWings"] = 342] = "VehicleBikeWings"; 346 | Control[Control["VehicleFlyBombBay"] = 343] = "VehicleFlyBombBay"; 347 | Control[Control["VehicleFlyCounter"] = 344] = "VehicleFlyCounter"; 348 | Control[Control["VehicleFlyTransform"] = 345] = "VehicleFlyTransform"; 349 | })(Control || (Control = {})); 350 | export default Control; 351 | --------------------------------------------------------------------------------