test carwash
This commit is contained in:
@@ -286,6 +286,9 @@ notification();
|
||||
import rentCar from './util/rentcar';
|
||||
rentCar(globalData);
|
||||
|
||||
import Carwash from './util/carwash';
|
||||
Carwash(globalData);
|
||||
|
||||
require('./Gui/policedepartment');
|
||||
require('./Gui/helptext');
|
||||
require('./admin/spectate');
|
||||
|
||||
16
ReallifeGamemode.Client/util/carwash.ts
Normal file
16
ReallifeGamemode.Client/util/carwash.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
export default function Carwash(globalData: IGlobalData) {
|
||||
|
||||
mp.events.add('washcar', () => {
|
||||
let vehicle = mp.players.local.vehicle;
|
||||
|
||||
vehicle.setDirtLevel(0);
|
||||
});
|
||||
|
||||
mp.events.add('entityStreamIn', (entity) => {
|
||||
if (entity.type !== 'vehicle' || !entity.hasVariable('dirtLevel')) {
|
||||
return;
|
||||
}
|
||||
const dirtLevel = entity.getVariable('dirtLevel') || 0;
|
||||
entity.setDirtLevel(parseFloat(dirtLevel));
|
||||
});
|
||||
}
|
||||
@@ -4025,6 +4025,12 @@ namespace ReallifeGamemode.Server.Commands
|
||||
}
|
||||
}
|
||||
|
||||
[Command("washcar", "~m~Benutzung: ~s~/washcar")]
|
||||
public void washcar(Player player)
|
||||
{
|
||||
player.TriggerEvent("washcar");
|
||||
}
|
||||
|
||||
[Command("makeadmin", "~m~Benutzung: ~s~/makeadmin [Name] [Adminlevel]")]
|
||||
public void CmdAdminMakeadmin(Player player, string name, int rank)
|
||||
{
|
||||
|
||||
@@ -7,6 +7,9 @@ using ReallifeGamemode.Server.Shop.Friseur;
|
||||
using ReallifeGamemode.Server.Util;
|
||||
using ReallifeGamemode.Server.Extensions;
|
||||
using ReallifeGamemode.Server.Shop.Ammunation;
|
||||
using ReallifeGamemode.Database.Entities;
|
||||
using ReallifeGamemode.Database.Models;
|
||||
|
||||
|
||||
namespace ReallifeGamemode.Server.Managers
|
||||
{
|
||||
@@ -34,6 +37,9 @@ namespace ReallifeGamemode.Server.Managers
|
||||
|
||||
public static List<RentcarPoint> rentcarPoints = new List<RentcarPoint>();
|
||||
|
||||
public static List<CarwashPoint> carwashPoints = new List<CarwashPoint>();
|
||||
|
||||
|
||||
public static Vector3 eventportPosition;
|
||||
public static bool eventportActive = false;
|
||||
|
||||
@@ -347,9 +353,55 @@ namespace ReallifeGamemode.Server.Managers
|
||||
|
||||
NAPI.Blip.CreateBlip(88, new Vector3(point.Position.X, point.Position.Y, point.Position.Z), (float)0.7, 59, "Fahrzeugverleih", 255, 200, true, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion RentCar
|
||||
|
||||
#region Carwash
|
||||
|
||||
CarwashPoint Carwash = new CarwashPoint()
|
||||
{
|
||||
Position = new Vector3(26.37, -1391.99, 29.36)
|
||||
};
|
||||
|
||||
CarwashPoint Carwash2 = new CarwashPoint()
|
||||
{
|
||||
Position = new Vector3(111, 111, 29.32)
|
||||
};
|
||||
|
||||
carwashPoints.Add(Carwash);
|
||||
carwashPoints.Add(Carwash2);
|
||||
|
||||
foreach (CarwashPoint point in carwashPoints)
|
||||
{
|
||||
|
||||
NAPI.Marker.CreateMarker(1, new Vector3(point.Position.X, point.Position.Y, point.Position.Z - 2), new Vector3(point.Position.X, point.Position.Y, point.Position.Z + 1),
|
||||
new Vector3(0, 0, 0), 5.5f, new Color(255, 255, 255, 50), false, 0);
|
||||
NAPI.TextLabel.CreateTextLabel("~y~Autowaschanlage", point.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
|
||||
NAPI.Blip.CreateBlip(100, new Vector3(point.Position.X, point.Position.Y, point.Position.Z), (float)0.7, 0, "´Carwash", 255, 200, true, 0, 0);
|
||||
|
||||
Vector3 pos = point.Position;
|
||||
ColShape colShape = NAPI.ColShape.CreateSphereColShape(pos, 5, 0);
|
||||
|
||||
colShape.OnEntityEnterColShape += (cs, c) =>
|
||||
{
|
||||
if (!c.IsInVehicle) return;
|
||||
|
||||
c.TriggerEvent("washcar");
|
||||
using (var dbcontext = new DatabaseContext())
|
||||
{
|
||||
User u = c.GetUser(dbcontext);
|
||||
u.BankAccount.Balance -= 100;
|
||||
dbcontext.SaveChanges();
|
||||
}
|
||||
c.SendNotification("Die Autowäsche hat dich ~g~$~w~100 gekostet.");
|
||||
};
|
||||
}
|
||||
|
||||
#endregion Carwash
|
||||
|
||||
}
|
||||
|
||||
|
||||
[RemoteEvent("sendClientToStage")]
|
||||
public void ElevatorSendToStage(Player player, string level)
|
||||
{
|
||||
@@ -486,3 +538,8 @@ public class RentcarPoint
|
||||
public Vector3 Position { get; set; }
|
||||
}
|
||||
|
||||
public class CarwashPoint
|
||||
{
|
||||
public Vector3 Position { get; set; }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user