mp.events.add('playerEnterColshape', async (player, colshape) => {
await player.call('setInteract',[JSON.stringify(colshape)]);
if(colshape.isParking && colshape.otherNumber){
await player.setVariable('parkingNumberColshape',colshape.otherNumber);
console.log(player.getVariable('parkingNumberColshape'));
}
if(colshape.isVehRent && colshape.otherNumber){
await player.setVariable('rentNumberColshape',colshape.otherNumber);
}
});
mp.events.add('interact',async (player,col) => {
console.log('colshape')
let colshape = JSON.parse(col);
if( colshape.isRent){
if (player.money >= 50){
if(!player.isRent){
playerRentStart(player,"faggio");
player.money -= 50;
await player.call('notify',[`Вы потратили 50 $`,3000,2]);
mp.db.query("UPDATE `accounts` SET `money` = ? WHERE username = ?",[player.money,player.name]);
await player.call("moneyUpD",[player.money]);
await player.setVariable('money',player.money);
}else{
await player.call('notify',[`У вас уже есть арендованый транспорт`,3000,0]);
}
}else{
await player.call('notify',[`У вас недостаточно денег`,3000,0]);
}
}
else if(colshape.isNJob){
await player.call('showNewJob');
// player.outputChatBox("!{#00ab11}Скоро...");
}
else if(colshape.isDalnoJob){
console.log(player.getVariable('isWork'));
if(!player.getVariable('isWork')){
let veh = mp.vehicles.new(mp.joaat('mule'),new mp.Vector3(-238.25372314453125, 6237.83203125, 31.449007034301758),{});
await player.putIntoVehicle(veh,0);
await player.setVariable('dalnoVeh',veh);
await player.setVariable('isWork',true);
player.jobBalance = 0;
veh.heading = 90;
await player.call('truck:startJob');
// player.wayToD.routeFor(mp.players.local,69,1);
// colshapeDalno = mp.colshapes.newSphere(3500.5029296875, 3678.830322265625, 33.159141540527344, 4);
// colshapeDalno.isDalnoJobState1 = true;
}else{
// player.outputChatBox(`!{#a89700}Вы уже начали работу`);
await player.setVariable('isWork',false);
if(player.jobBalance){
player.money += player.jobBalance;
await player.call('truck:endJob');
await player.call('moneyUpD',[player.money]);
await player.call('notify',[`Рабочая смена окончена, вы получили ${player.jobBalance}$`,3000,2]);
mp.db.query("UPDATE `accounts` SET `money` = ? WHERE username = ?",[player.money,player.name]);
}
// player.call('notify',["Вы уже начали работу",3000,0]);
}
}
})