Fix Handmoney | Fix ATM checkin / checkout

This commit is contained in:
VegaZ
2019-05-08 19:33:12 +02:00
parent bbd40c329c
commit 2c63278aa3
3 changed files with 48 additions and 61 deletions

View File

@@ -8,16 +8,16 @@ export default function handMoney() {
mp.events.add("SERVER:SET_HANDMONEY", (amount) => {
difference = currentMoney - amount;
if (difference != 0 && currentMoney != null) {
showMoneyChange = 1000;
showMoneyChange = 600;
}
currentMoney += amount;
currentMoney = amount;
});
mp.events.add("render", () => {
if (currentMoney != null) {
var numberFormat = moneyFormat(currentMoney);
var numberFormat = moneyFormat(Math.abs(currentMoney));
if (currentMoney >= 0) {
mp.game.graphics.drawText("+$" + numberFormat, [0.96, 0.1],
mp.game.graphics.drawText("$" + numberFormat, [0.95, 0.1],
{
font: 7,
color: [115, 186, 131, 255],
@@ -27,7 +27,7 @@ export default function handMoney() {
})
}
else {
mp.game.graphics.drawText("-$" + numberFormat, [0.96, 0.1],
mp.game.graphics.drawText("-$" + numberFormat, [0.95, 0.1],
{
font: 7,
color: [255, 0, 45, 255],
@@ -39,11 +39,12 @@ export default function handMoney() {
if (showMoneyChange > 0) {
showMoneyChange--;
if (difference > 0) {
var alpha = 255;
if (showMoneyChange <= 70) {
alpha = (showMoneyChange * (255 / 70)) | 0;
}
mp.game.graphics.drawText("- $" + moneyFormat(difference), [0.96, 0.145], {
mp.game.graphics.drawText("-$" + moneyFormat(Math.abs(difference)), [0.95, 0.145], {
font: 7,
color: [255, 0, 45, alpha],
scale: [0.65, 0.65],
@@ -51,13 +52,12 @@ export default function handMoney() {
centre: true
})
} else {
var nDef = difference * -1;
} else {
var alpha = 255;
if (showMoneyChange <= 70) {
alpha = (showMoneyChange * (255 / 70)) | 0;
}
mp.game.graphics.drawText("+ $" + moneyFormat(nDef), [0.96, 0.145], {
mp.game.graphics.drawText("+$" + moneyFormat(Math.abs(difference)), [0.95, 0.145], {
font: 7,
color: [115, 186, 131, alpha],
scale: [0.65, 0.65],

View File

@@ -22,25 +22,7 @@
mp.events.add("CEF:atmAction", (site, inputField1, inputField2) => {
switch (site) {
//GELD EINZAHLEN in1
case 0:
mp.events.callRemote("CLIENT:ATM_MANAGER:ATM_ACTION", site, inputField1, inputField2);
break;
//GELD AUSZAHLEN in1
case 1:
mp.events.callRemote("CLIENT:ATM_MAN:CHECK_BALANCE", inputField1);
break;
case 2:
break;
}
});
mp.events.add("SERVER:WORLD_INTERACTION:UPDATE_HANDMONEY", (balance) => {
mp.events.call("SERVER:SET_HANDMONEY", balance); //GEHT NACH HANDMONEY.TS
mp.events.callRemote("CLIENT:ATM_MANAGER:ATM_ACTION", site, inputField1, inputField2);
});
mp.events.add("SERVER:WORLD_INTERACTION:ATM_ERROR", (errorId, p2) => {