Add PlaneSchool & DrivingSchool licenses
This commit is contained in:
@@ -90,7 +90,9 @@ namespace ReallifeGamemode.Database.Entities
|
|||||||
|
|
||||||
public int PaydayTimer { get; set; } = 60;
|
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;
|
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>("Dead");
|
||||||
|
|
||||||
|
b.Property<bool>("DriverLicenseVehicle");
|
||||||
|
|
||||||
b.Property<string>("Email")
|
b.Property<string>("Email")
|
||||||
.HasMaxLength(64);
|
.HasMaxLength(64);
|
||||||
|
|
||||||
@@ -914,6 +916,8 @@ namespace ReallifeGamemode.Database.Migrations
|
|||||||
|
|
||||||
b.Property<int?>("FactionRankId");
|
b.Property<int?>("FactionRankId");
|
||||||
|
|
||||||
|
b.Property<bool>("FlyingLicensePlane");
|
||||||
|
|
||||||
b.Property<int?>("GroupId");
|
b.Property<int?>("GroupId");
|
||||||
|
|
||||||
b.Property<int>("GroupRank");
|
b.Property<int>("GroupRank");
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using ReallifeGamemode.Server.Services;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
using ReallifeGamemode.Database.Entities;
|
using ReallifeGamemode.Database.Entities;
|
||||||
|
using ReallifeGamemode.Database.Models;
|
||||||
|
|
||||||
namespace ReallifeGamemode.Server.DrivingSchool
|
namespace ReallifeGamemode.Server.DrivingSchool
|
||||||
{
|
{
|
||||||
@@ -171,22 +172,35 @@ namespace ReallifeGamemode.Server.DrivingSchool
|
|||||||
{
|
{
|
||||||
ChatService.SendMessage(user, "Parke gleich seitlich ein");
|
ChatService.SendMessage(user, "Parke gleich seitlich ein");
|
||||||
}
|
}
|
||||||
else if (checkpoint == 25)
|
/* else if (checkpoint == 25)
|
||||||
{
|
|
||||||
bool parked = false;
|
|
||||||
float rotation;
|
|
||||||
|
|
||||||
while (!parked)
|
|
||||||
{
|
{
|
||||||
rotation = user.Vehicle.Rotation.Z;
|
bool parked = false;
|
||||||
if (rotation >= 333.913 && rotation <= 354.6108)
|
float rotation;
|
||||||
|
|
||||||
|
while (!parked)
|
||||||
{
|
{
|
||||||
ChatService.SendMessage(user, "Perfekt!");
|
rotation = user.Vehicle.Rotation.Z;
|
||||||
parked = true;
|
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")]
|
[Command("ld", "~m~Benutzung: ~s~/lt")]
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ using ReallifeGamemode.Server.Util;
|
|||||||
using ReallifeGamemode.Server.Services;
|
using ReallifeGamemode.Server.Services;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
|
using ReallifeGamemode.Database.Entities;
|
||||||
|
using ReallifeGamemode.Database.Models;
|
||||||
|
|
||||||
namespace ReallifeGamemode.Server.DrivingSchool
|
namespace ReallifeGamemode.Server.DrivingSchool
|
||||||
{
|
{
|
||||||
@@ -60,12 +62,16 @@ namespace ReallifeGamemode.Server.DrivingSchool
|
|||||||
}
|
}
|
||||||
|
|
||||||
[RemoteEvent("startplaneSchool")]
|
[RemoteEvent("startplaneSchool")]
|
||||||
public void StartplaneSchool(Client user)
|
public void StartplaneSchool(Client client)
|
||||||
{
|
{
|
||||||
ChatService.SendMessage(user, "Du hast die Flugscheinprüfung gestartet.");
|
User user = client.GetUser();
|
||||||
ChatService.SendMessage(user, "Steige nun in eines der Flugzeuge ein.");
|
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")]
|
[RemoteEvent("timerCheckVehicle1")]
|
||||||
@@ -100,11 +106,16 @@ namespace ReallifeGamemode.Server.DrivingSchool
|
|||||||
else if (checkpoint == 15)
|
else if (checkpoint == 15)
|
||||||
{
|
{
|
||||||
ChatService.SendMessage(user, "Du hast deinen Flugschein bestanden.");
|
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