Add PlaneSchool & DrivingSchool licenses
This commit is contained in:
@@ -90,7 +90,9 @@ namespace ReallifeGamemode.Database.Entities
|
||||
|
||||
public int PaydayTimer { get; set; } = 60;
|
||||
|
||||
public bool DriverLicenseVehicle { get; set; }
|
||||
public bool DriverLicenseVehicle { get; set; } = false;
|
||||
|
||||
public bool FlyingLicensePlane { get; set; } = false;
|
||||
|
||||
public bool IsAdmin(AdminLevel level) => AdminLevel >= level;
|
||||
|
||||
|
||||
1343
ReallifeGamemode.Database/Migrations/20191030183018_DriverLicenseVehicle.Designer.cs
generated
Normal file
1343
ReallifeGamemode.Database/Migrations/20191030183018_DriverLicenseVehicle.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,23 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ReallifeGamemode.Database.Migrations
|
||||
{
|
||||
public partial class DriverLicenseVehicle : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "DriverLicenseVehicle",
|
||||
table: "Users",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DriverLicenseVehicle",
|
||||
table: "Users");
|
||||
}
|
||||
}
|
||||
}
|
||||
1345
ReallifeGamemode.Database/Migrations/20191030203114_FlyingLicensePlane.Designer.cs
generated
Normal file
1345
ReallifeGamemode.Database/Migrations/20191030203114_FlyingLicensePlane.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,23 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ReallifeGamemode.Database.Migrations
|
||||
{
|
||||
public partial class FlyingLicensePlane : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "FlyingLicensePlane",
|
||||
table: "Users",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "FlyingLicensePlane",
|
||||
table: "Users");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -905,6 +905,8 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
|
||||
b.Property<bool>("Dead");
|
||||
|
||||
b.Property<bool>("DriverLicenseVehicle");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(64);
|
||||
|
||||
@@ -914,6 +916,8 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
|
||||
b.Property<int?>("FactionRankId");
|
||||
|
||||
b.Property<bool>("FlyingLicensePlane");
|
||||
|
||||
b.Property<int?>("GroupId");
|
||||
|
||||
b.Property<int>("GroupRank");
|
||||
|
||||
@@ -7,6 +7,7 @@ using ReallifeGamemode.Server.Services;
|
||||
using System.Linq;
|
||||
using GTANetworkAPI;
|
||||
using ReallifeGamemode.Database.Entities;
|
||||
using ReallifeGamemode.Database.Models;
|
||||
|
||||
namespace ReallifeGamemode.Server.DrivingSchool
|
||||
{
|
||||
@@ -171,22 +172,35 @@ namespace ReallifeGamemode.Server.DrivingSchool
|
||||
{
|
||||
ChatService.SendMessage(user, "Parke gleich seitlich ein");
|
||||
}
|
||||
else if (checkpoint == 25)
|
||||
{
|
||||
bool parked = false;
|
||||
float rotation;
|
||||
|
||||
while (!parked)
|
||||
/* else if (checkpoint == 25)
|
||||
{
|
||||
rotation = user.Vehicle.Rotation.Z;
|
||||
if (rotation >= 333.913 && rotation <= 354.6108)
|
||||
bool parked = false;
|
||||
float rotation;
|
||||
|
||||
while (!parked)
|
||||
{
|
||||
ChatService.SendMessage(user, "Perfekt!");
|
||||
parked = true;
|
||||
rotation = user.Vehicle.Rotation.Z;
|
||||
if (rotation >= 333.913 && rotation <= 354.6108)
|
||||
{
|
||||
ChatService.SendMessage(user, "Perfekt!");
|
||||
parked = true;
|
||||
}
|
||||
System.Threading.Thread.Sleep(100);
|
||||
}
|
||||
System.Threading.Thread.Sleep(100);
|
||||
}*/
|
||||
else if (checkpoint == 26)
|
||||
{
|
||||
ChatService.SendMessage(user, "Bestanden!");
|
||||
User spieler = user.GetUser();
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
User drivingUser = dbContext.Users.Where(u => u.Id == spieler.Id).FirstOrDefault();
|
||||
drivingUser.DriverLicenseVehicle = true;
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
//veh & client tp
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[Command("ld", "~m~Benutzung: ~s~/lt")]
|
||||
|
||||
@@ -6,6 +6,8 @@ using ReallifeGamemode.Server.Util;
|
||||
using ReallifeGamemode.Server.Services;
|
||||
using System.Linq;
|
||||
using GTANetworkAPI;
|
||||
using ReallifeGamemode.Database.Entities;
|
||||
using ReallifeGamemode.Database.Models;
|
||||
|
||||
namespace ReallifeGamemode.Server.DrivingSchool
|
||||
{
|
||||
@@ -60,12 +62,16 @@ namespace ReallifeGamemode.Server.DrivingSchool
|
||||
}
|
||||
|
||||
[RemoteEvent("startplaneSchool")]
|
||||
public void StartplaneSchool(Client user)
|
||||
public void StartplaneSchool(Client client)
|
||||
{
|
||||
ChatService.SendMessage(user, "Du hast die Flugscheinprüfung gestartet.");
|
||||
ChatService.SendMessage(user, "Steige nun in eines der Flugzeuge ein.");
|
||||
User user = client.GetUser();
|
||||
if (user.FlyingLicensePlane)
|
||||
return;
|
||||
|
||||
user.TriggerEvent("waitPlayerEntersVehicle1");
|
||||
ChatService.SendMessage(client, "Du hast die Flugscheinprüfung gestartet.");
|
||||
ChatService.SendMessage(client, "Steige nun in eines der Flugzeuge ein.");
|
||||
|
||||
client.TriggerEvent("waitPlayerEntersVehicle1");
|
||||
}
|
||||
|
||||
[RemoteEvent("timerCheckVehicle1")]
|
||||
@@ -100,11 +106,16 @@ namespace ReallifeGamemode.Server.DrivingSchool
|
||||
else if (checkpoint == 15)
|
||||
{
|
||||
ChatService.SendMessage(user, "Du hast deinen Flugschein bestanden.");
|
||||
|
||||
|
||||
User spieler = user.GetUser();
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
User drivingUser = dbContext.Users.Where(u => u.Id == spieler.Id).FirstOrDefault();
|
||||
drivingUser.FlyingLicensePlane = true;
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
user.Position = new Vector3(-1083.96, -2476.96, 13.07);
|
||||
/*user.Vehicle.Position = new Vector3(); Hier die Funktion zum Fahrzeug respawnen */
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user