Commit f78ee319 authored by Test's avatar Test

update client server interaction

parent efee20e3
This diff is collapsed.
......@@ -2,6 +2,7 @@
<meta charset="utf-8">
<link rel="stylesheet" href="paint.css">
<script src="../../../vue.js"></script>
<script src="jscolor.js"></script>
<body>
<div id="app">
<div class="b3-close" id="close-button" @click="exit">X</div>
......@@ -10,20 +11,30 @@
</body>
</html>
<script>
const app = new Vue({
el: '#app',
data: {
titleText: "Paint Bay",
prime: service.primeColor,
second: service.secondaryColor,
},
methods: {
changeCamRotation: function() {
mp.trigger("cChangeHeading", this.camRotation);
},
setPaint: function() {
const paint = {
primary: this.prime,
secondary: this.second,
}
mp.trigger("cMisc-CallServerEvent", "sAutoShop-SetPaint", JSON.stringify(paint));
this.exit()
},
exit: function() {
mp.trigger("cCloseCefAndDestroyCam");
},
}
}
})
</script>
\ No newline at end of file
......@@ -2,14 +2,14 @@
const misc = require('../cMisc');
const player = mp.players.local;
const vehicle = player.vehicle
mp.events.add(
{
"cAutoShop-ShowPaintMenu" : () => {
"cAutoShop-ShowPaintMenu" : (service) => {
misc.prepareToCef();
misc.openCef("package://RP/Browsers/Business/AutoShop/Paint/paint.html");
//misc.injectCef(inject);
misc.injectCef(service);
misc.createPointedCam(103.13, 6626.423, 32.828, 0, 0, 0, 80, 102.738, 6623.627, 31.829)
// setTimeout(function(){
// misc.destroyCam();
......@@ -26,7 +26,16 @@ mp.events.add(
},3000)
},
"cAutoShop-SetVehicleColor" : (col1, col2) => vehicle.setColours(col1, col2)
"cAutoShop-ShowDevMenu" : () => {
misc.prepareToCef()
misc.openCef("package://RP/Browsers/Business/AutoShop/Paint/paint.html")
},
"cMisc-CallServerEvent" : (eventName, id, price) => mp.events.callRemote(eventName, id, price),
//"cAutoShop-SetVehicleColor" : (col1, col2) => vehicle.setColours(col1, col2)
});
// RAGE Object Declarations
......
......@@ -16,7 +16,11 @@ class VehicleSingleton {
},
"playerEnterVehicle" : (player, vehicle, seat) => {
if (seat === -1) player.call("cVehicle-setFuel", [vehicle.fuel, vehicle.fuelRate]);
if (seat === -1) {
player.call("cVehicle-setFuel", [vehicle.fuel, vehicle.fuelRate])
}else {
return
}
},
"playerExitVehicle" : (player, vehicle, seat) => {
......@@ -95,7 +99,7 @@ class VehicleSingleton {
ownerId: 0,
whoCanOpen: JSON.stringify([player.guid]),
factionName: '',
numberPlate: 'SCUMBAG',
numberPlate: 'SCUMBAG1',
// numberPlate: this.generateRandomNumberPlate(),
primaryColor: color1,
secondaryColor: color2,
......
......@@ -27,6 +27,19 @@ class service {
constructor() {
this.garage = ''
this.service = ''
this.primeColor = ''
this.secondaryColor = ''
this.mod = ''
this.engine = ''
this.horn = ''
this.breaks = ''
this.transmission = ''
this.suspension = ''
this.turbo = ''
this.xenon = ''
this.tint = ''
this.plate = ''
this.boost = ''
}
}
// Menu Class. Tracks what Menu to deliver based on which garage slot the users car is in.
......@@ -51,6 +64,16 @@ function colShapeEntered(player, shape){
// Car is registered into the garage service
if (shape == colshapeMechanic) {
if (player.vehicle) {
service.engine = player.vehicle.getMod(11)
service.horn = player.vehicle.getMod(14)
service.breaks = player.vehicle.getMod(12)
service.transmission = player.vehicle.getMod(13)
service.suspension = player.vehicle.getMod(15)
service.turbo = player.vehicle.getMod(18)
service.xenon = player.vehicle.getMod(22)
service.tint = player.vehicle.getMod(46)
service.plate = player.vehicle.getMod(62)
service.boost = player.vehicle.getMod(40)
player.notify(`Get out and see the mechanic.`)
service.garage = 'ingarage'
}
......@@ -58,6 +81,9 @@ function colShapeEntered(player, shape){
// Car is registered into the paint service
if (shape == colshapePaint) {
if (player.vehicle) {
// Collect details of the vehicle in the garage
service.primeColor = player.vehicle.getColorRGB(0)
service.secondaryColor = player.vehicle.getColorRGB(1)
player.notify(`Get out and see the mechanic.`)
service.garage = 'inpaint'
}
......@@ -103,11 +129,14 @@ mp.events.add("playerExitColshape", colShapeExited)
mp.events.add({"sKeys-E" : (player) => {
if (colshapeloc.location == 'menuactive') {
if (menu.paint == true) {
player.call("cAutoShop-ShowPaintMenu")
player.call("cAutoShop-ShowPaintMenu", service)
}
if (menu.garage == true) {
else if (menu.garage == true) {
//player.notify(`Those custom parts aren't in yet.`)
player.call("cAutoShop-ShowMechanicMenu")
player.call("cAutoShop-ShowMechanicMenu", service)
}
else {
player.call("cAutoShop-ShowDevMenu")
}
}
else {
......
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