samen kaufen und hanf -> joint
This commit is contained in:
File diff suppressed because it is too large
Load Diff
67
ReallifeGamemode.Client/drugs/hanf.ts
Normal file
67
ReallifeGamemode.Client/drugs/hanf.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
import { Menu, Point, UIMenuSliderItem, UIMenuItem, Color, UIMenuListItem, ItemsCollection } from "../libs/NativeUI";
|
||||
import { createMenuItem } from "../util";
|
||||
import moneyformat from "../moneyformat";
|
||||
import { getAnimFromId } from "../util/animationSync";
|
||||
import { getCreatedPedByName } from "../Ped/PedCreator";
|
||||
|
||||
export default function hanfSystem(globalData: IGlobalData) {
|
||||
mp.events.add("SERVER:Hanf_BuySeed", price => {
|
||||
if (globalData.InMenu || globalData.InChat) {
|
||||
return;
|
||||
}
|
||||
|
||||
globalData.InMenu = true;
|
||||
|
||||
var menu = new Menu("Samen kaufen", "Kaufe dir Hanfsamen", new Point(50, 50));
|
||||
|
||||
var seedsToBuy = 0;
|
||||
|
||||
var countItems = [...Array(50).keys()].map(x => x + 1);
|
||||
|
||||
var soloPriceItem = createMenuItem("Einzelpreis", "Preis pro Samen", item => {
|
||||
item.SetRightLabel("$" + moneyformat(price));
|
||||
});
|
||||
menu.AddItem(soloPriceItem);
|
||||
|
||||
var countItem = new UIMenuListItem("Anzahl", "Wähle die Anzahl der Samen aus", new ItemsCollection(countItems), 0);
|
||||
menu.AddItem(countItem);
|
||||
|
||||
var buyItem = new UIMenuItem("Kaufen", "Kaufe die Samen");
|
||||
buyItem.BackColor = new Color(0, 100, 0);
|
||||
buyItem.HighlightedBackColor = new Color(0, 150, 0);
|
||||
menu.AddItem(buyItem);
|
||||
|
||||
var completePriceItem = new UIMenuItem("Gesamtpreis", "Preis für alle Samen");
|
||||
menu.AddItem(completePriceItem);
|
||||
|
||||
menu.ListChange.on((item, index) => {
|
||||
if (item === countItem) {
|
||||
seedsToBuy = Number(countItem.SelectedValue);
|
||||
completePriceItem.SetRightLabel("$" + moneyformat(seedsToBuy * price));
|
||||
}
|
||||
});
|
||||
|
||||
menu.ItemSelect.on((item, index) => {
|
||||
if (item === buyItem) {
|
||||
mp.events.callRemote("CLIENT:Hanf_BuySeeds", seedsToBuy);
|
||||
menu.Close();
|
||||
}
|
||||
});
|
||||
|
||||
menu.MenuClose.on(() => {
|
||||
globalData.InMenu = false;
|
||||
});
|
||||
|
||||
menu.Open();
|
||||
});
|
||||
|
||||
mp.events.add("SERVER:Hanf_PlayManufacturerAnim", animId => {
|
||||
var anim = getAnimFromId(animId);
|
||||
var npc = getCreatedPedByName("hanf_verarbeiter_typ");
|
||||
npc.taskPlayAnim(anim.dict, anim.name, 1, 0, 1000 * 10, 1, 0, !1, !1, !1);
|
||||
setTimeout(() => {
|
||||
npc.stopAnim(anim.name, anim.dict, 3);
|
||||
npc.stopAnimTask(anim.dict, anim.name, 3);
|
||||
}, 1000 * 10);
|
||||
});
|
||||
}
|
||||
@@ -295,6 +295,9 @@ rentCar(globalData);
|
||||
import Carwash from './util/carwash';
|
||||
Carwash(globalData);
|
||||
|
||||
import hanfSystem from './drugs/hanf';
|
||||
hanfSystem(globalData);
|
||||
|
||||
require('./Gui/policedepartment');
|
||||
require('./Gui/helptext');
|
||||
require('./admin/spectate');
|
||||
|
||||
@@ -1,5 +1,42 @@
|
||||
import { debug } from "util";
|
||||
|
||||
const animationSyncData =
|
||||
{
|
||||
animations: [],
|
||||
|
||||
register: function (name, animDict, animName, duration, loop, flag, endless) {
|
||||
let id = mp.game.joaat(name);
|
||||
|
||||
if (!this.animations.hasOwnProperty(id)) {
|
||||
this.animations[id] =
|
||||
{
|
||||
id: id,
|
||||
name: name,
|
||||
animDict: animDict,
|
||||
animName: animName,
|
||||
duration: duration,
|
||||
loop: loop,
|
||||
flag: flag,
|
||||
endless: endless
|
||||
};
|
||||
} else {
|
||||
mp.game.graphics.notify("Animation Sync Error: ~r~Duplicate Entry");
|
||||
}
|
||||
},
|
||||
|
||||
getAnimFromId: function (name: string): { dict: string, name: string } {
|
||||
var anim = this.animations[mp.game.joaat(name)];
|
||||
return {
|
||||
dict: anim.animDict,
|
||||
name: anim.animName
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export function getAnimFromId(name: string) {
|
||||
return animationSyncData.getAnimFromId(name);
|
||||
}
|
||||
|
||||
export default function animationSync() {
|
||||
let blockInput = false;
|
||||
let animationBreakTimer;
|
||||
@@ -12,37 +49,13 @@ export default function animationSync() {
|
||||
animationSyncData.register("getUncuff", "mp_arresting", "b_uncuff", 5500, false, 0, false);
|
||||
animationSyncData.register("hup", "mp_am_hold_up", "handsup_base", -1, true, 50, true);
|
||||
animationSyncData.register("carryBox", "anim@heists@box_carry@", "idle", -1, true, 50, true);
|
||||
animationSyncData.register("manufacturJoint", "anim@mp_snowball", "pickup_snowball", 1000 * 10, false, 1, false);
|
||||
});
|
||||
|
||||
const animationBreakMessage = [
|
||||
{ animName: "Cuffed", msg: "Handschellen gebrochen." }
|
||||
];
|
||||
|
||||
const animationSyncData =
|
||||
{
|
||||
animations: [],
|
||||
|
||||
register: function (name, animDict, animName, duration, loop, flag, endless) {
|
||||
let id = mp.game.joaat(name);
|
||||
|
||||
if (!this.animations.hasOwnProperty(id)) {
|
||||
this.animations[id] =
|
||||
{
|
||||
id: id,
|
||||
name: name,
|
||||
animDict: animDict,
|
||||
animName: animName,
|
||||
duration: duration,
|
||||
loop: loop,
|
||||
flag: flag,
|
||||
endless: endless
|
||||
};
|
||||
} else {
|
||||
mp.game.graphics.notify("Animation Sync Error: ~r~Duplicate Entry");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
mp.events.add("entityStreamIn", (entity) => {
|
||||
if (entity.type === "player" && entity.animationData) {
|
||||
@@ -90,6 +103,7 @@ export default function animationSync() {
|
||||
clearTimeout(animationBreakTimer);
|
||||
animationBreakTimer = null;
|
||||
}
|
||||
|
||||
if (string == null) {
|
||||
blockInput = false;
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user