Commit 31a8365b authored by Test's avatar Test

Remove service class. Create service object.

parent a1f680b9
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="mechanic.css">
<script>
function getMods() {
mp.trigger("cAutoShop-GetModClass" => {
alert(service.engine)
})
}
</script>
<script src="../vue.js"></script>
</head>
<body>
<div id="app">
<div id="service">
<div class="b3-close" id="close-button" @click="exit">X</div>
<div class="b3-service" id="sp0-button" @click="sp0">No Spoiler</div>
<div class="b3-service" id="sp1-button" @click="sp1">Spoiler 1</div>
<div class="b3-service" id="sp2-button" @click="sp2">Spoiler 2</div>
<div class="b3-service" id="sp3-button" @click="sp3">Spoiler 3</div>
<div class="b1-service">
<div>
<div class="b1-summ">{{ garage }}</div>
<div class="b1-summ-info">{{ service }}</div>
</div>
<div>
<div class="b1-summ">{{ primeColor }}</div>
<div class="b1-summ-info">{{ secondaryColor }}</div>
</div>
<div>
<div class="b1-summ">{{ mod }}</div>
<div class="b1-summ-info">{{ engine }}</div>
</div>
<div v-if="fine">
<div class="b1-summ">{{ horn }}</div>
<div class="b1-summ-info">{{ breaks }}</div>
</div>
</div>
</div>
</body>
</html>
......@@ -16,19 +43,37 @@
<script>
const app = new Vue({
el: '#app',
el: '#service',
data: {
garage: '',
service: '',
primeColor: -1,
secondaryColor: -1,
mod: -1,
engine: -1,
horn: -1,
breaks: -1,
transmission: -1,
suspension: -1,
turbo: -1,
xenon: -1,
tint: -1,
plate: -1,
boost: -1,
spoiler: -1,
fbumper: -1,
rbumper: -1,
skirt: -1,
armor: -1,
hydraulics: -1,
wheels: -1
},
methods: {
changeCamRotation: function() {
mp.trigger("cChangeHeading", this.camRotation);
},
exit: function() {
mp.trigger("cCloseCefAndDestroyCam");
},
sp0: function() {
mp.trigger("cAutoShop-CallServerEvent", sAutoShop-Mod, 0, -1);
mp.trigger("cAutoShop-CallServerEvent", z-Mod, 0, -1);
},
sp1: function() {
mp.trigger("cAutoShop-CallServerEvent", sAutoShop-Mod, 0, 0);
......@@ -36,5 +81,9 @@ const app = new Vue({
sp2: function() {
mp.trigger("cAutoShop-CallServerEvent", sAutoShop-Mod, 0, 1);
},
exit: function() {
mp.trigger("cCloseCefAndDestroyCam");
}
}
});
</script>
\ No newline at end of file
......@@ -16,10 +16,10 @@ mp.events.add(
// },3000)
},
"cAutoShop-ShowMechanicMenu" : () => {
"cAutoShop-ShowMechanicMenu" : (execute) => {
misc.prepareToCef();
misc.openCef("package://RP/Browsers/Business/AutoShop/Mechanic/mechanic.html");
//misc.injectCef(inject);
misc.injectCef(execute);
misc.createPointedCam(110.48, 6631.676, 31.787, 0, 0, 0, 80, 109.888, 6626.924, 31.787)
//setTimeout(function(){
// misc.destroyCam();
......@@ -31,10 +31,11 @@ mp.events.add(
misc.openCef("package://RP/Browsers/Business/AutoShop/Paint/paint.html")
},
"cAutoShop-CallServerEvent" : (eventName, a, b) => mp.events.callRemote(eventName, a, b),
"cAutoShop-CallServerEvent" : (eventName, a, b) => {
mp.events.callRemote(eventName, a, b)
},
"cAutoShop-GetModClass" : () => mp.events.callRemote(getMods)
//"cAutoShop-SetVehicleColor" : (col1, col2) => vehicle.setColours(col1, col2)
});
......
......@@ -23,26 +23,30 @@ mp.blips.new(524, new mp.Vector3(111.08, 6626.702, 31.444),
scale: 0.75,
})
// Service Class. Tracks where your car is.
class service {
constructor() {
this.garage = ''
this.service = ''
this.primeColor = -1
this.secondaryColor = -1
this.mod = -1
this.engine = -1
this.horn = -1
this.breaks = -1
this.transmission = -1
this.suspension = -1
this.turbo = -1
this.xenon = -1
this.tint = -1
this.plate = -1
this.boost = -1
}
let service = {
garage: '',
service: '',
primeColor: -1,
secondaryColor: -1,
mod: -1,
engine: -1,
horn: -1,
breaks: -1,
transmission: -1,
suspension: -1,
turbo: -1,
xenon: -1,
tint: -1,
plate: -1,
boost: -1,
spoiler: -1,
fbumper: -1,
rbumper: -1,
skirt: -1,
armor: -1,
hydraulics: -1,
wheels: -1
}
// Menu Class. Tracks what Menu to deliver based on which garage slot the users car is in.
class menu {
constructor() {
this.garage = false
......@@ -125,12 +129,24 @@ function colShapeExited(player, shape) {
}
}
// Get Current Service Class
function getCurrentService() {
let garageservice = JSON.stringify(service)
return garageservice
}
// RAGE Event Declarations
mp.events.add("playerEnterColshape", colShapeEntered)
mp.events.add("playerExitColshape", colShapeExited)
mp.events.add("getMods", getCurrentService)
mp.events.add({
"sAutoShop-Mod" : ( a, b ) => {
player.vehicle.setMod(parseInt(a), parseInt(b))
mp.vehicles.forEachInRange(new mp.Vector3(111.08, 6626.702, 31.444), 3,
(vehicle) => {
vehicle.setMod(a,b)
}
);
}
})
mp.events.add({"sKeys-E" : (player) => {
......@@ -140,9 +156,8 @@ mp.events.add({"sKeys-E" : (player) => {
}
else if (menu.garage == true) {
//player.notify(`Those custom parts aren't in yet.`)
const servicevehicle = mp.vehicles.forEachInRange(111.08, 6626.702, 31.444, 2, 0, 70);
player.notify(`${ servicevehicle }`)
player.call("cAutoShop-ShowMechanicMenu")
const execute = JSON.stringify(service)
player.call("cAutoShop-ShowMechanicMenu", execute)
}
else {
player.call("cAutoShop-ShowDevMenu")
......@@ -157,10 +172,21 @@ mp.events.add({"sKeys-E" : (player) => {
mp.events.addCommand('mod', (player, fullText, a , b) => {
player.vehicle.setMod(parseInt(a), parseInt(b));
});
mp.events.addCommand('getmod', (player, fullText, a) => {
let modgot = player.vehicle.getMod(parseInt(a));
player.notify(`${modgot}`)
});
mp.events.addCommand('modtest', () => {
mp.vehicles.forEachInRange(new mp.Vector3(111.08, 6626.702, 31.444), 3,
(vehicle) => {
vehicle.setMod(0,1)
}
);
})
mp.events.addCommand('modcar', ( fulltext, a , b ) => {
mp.vehicles.forEachInRange(new mp.Vector3(111.08, 6626.702, 31.444), 3,
(vehicle) => {
vehicle.setMod(parseInt(a), parseInt(b))
}
);
})
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment