added aduty system + added ChatService.BroadcastDutyAdmin + fixes in report system + added paaqos busdriver job
This commit is contained in:
120
ReallifeGamemode.Server/Job/BusDriver/Commands.cs
Normal file
120
ReallifeGamemode.Server/Job/BusDriver/Commands.cs
Normal file
@@ -0,0 +1,120 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
|
||||
namespace ReallifeGamemode.Server.Job.BusDriver
|
||||
{
|
||||
public class Commands : Script
|
||||
{
|
||||
public static List<Vector3> NewPositions = new List<Vector3>();
|
||||
|
||||
[Command("job", "~r~Verwende: ~w~ /job [JobName]")]
|
||||
public void CMD_Job(Client player, string JobName)
|
||||
{
|
||||
if (player.HasData("BusJob"))
|
||||
{
|
||||
NAPI.Notification.SendNotificationToPlayer(player, "Du hast schon einen Job!");
|
||||
}
|
||||
if (!player.HasData("BusJob") && (JobName == "Busfahrer"))
|
||||
{
|
||||
player.SetData("BusJob", true);
|
||||
NAPI.Notification.SendNotificationToPlayer(player, "Du hast den Job Busfahrer angenommen");
|
||||
}
|
||||
}
|
||||
|
||||
[Command("jobs")]
|
||||
public void CMD_Jobs(Client player)
|
||||
{
|
||||
NAPI.Chat.SendChatMessageToPlayer(player, "Jobs: Busfahrer");
|
||||
}
|
||||
|
||||
[Command("quitjob")]
|
||||
public void CMD_QuitJob(Client player)
|
||||
{
|
||||
player.ResetData("BusJob");
|
||||
NAPI.Notification.SendNotificationToPlayer(player, "Du hast deinen Job gekündigt");
|
||||
}
|
||||
|
||||
[Command("stopjob")]
|
||||
public void CMD_StopJob(Client player)
|
||||
{
|
||||
if (!player.HasData("BusJobAn")) // Wenn Spieler keinen Job angefangen hat
|
||||
{
|
||||
NAPI.Notification.SendNotificationToPlayer(player, "Du hast keinen Job begonnen");
|
||||
return;
|
||||
}
|
||||
else if (player.HasData("BusJobAn")) // Wenn Spieler Job angefangen hat
|
||||
{
|
||||
NAPI.Notification.SendNotificationToPlayer(player, "Du hast deinen Job beendet. Deinen Lohn erhälst du am Payday.");
|
||||
player.ResetData("BusJobAn");
|
||||
player.TriggerEvent("clear_all_blips");
|
||||
}
|
||||
}
|
||||
|
||||
[Command("startjob")]
|
||||
public void CMD_AddPosition(Client client, string route, float size)
|
||||
{
|
||||
if (route == "1" && client.HasData("BusJob"))
|
||||
{
|
||||
NAPI.Notification.SendNotificationToPlayer(client, "Du hast die Route 1 ausgewählt, fahre jetzt die Haltestellen ab.");
|
||||
client.SetData("BusJobAn", true);
|
||||
NewPositions.Add(new Vector3(308.0671, -762.0952, 29.21954));
|
||||
NewPositions.Add(new Vector3(-105.5951, -1684.548, 29.23948));
|
||||
NewPositions.Add(new Vector3(-1056.246, -2552.576, 13.66063));
|
||||
NewPositions.Add(new Vector3(200.3088, -1978.828, 19.3329));
|
||||
NewPositions.Add(new Vector3(358.6138, -1785.821, 28.92113));
|
||||
NewPositions.Add(new Vector3(281.8594, -1462.503, 29.13148));
|
||||
NewPositions.Add(new Vector3(77.72239, -1212.086, 29.12294));
|
||||
NewPositions.Add(new Vector3(218.1398, -850.9549, 30.16619));
|
||||
JobInfo jobInfo = new JobInfo();
|
||||
foreach (Vector3 vector in NewPositions)
|
||||
{
|
||||
jobInfo.AddObjective(vector, size);
|
||||
}
|
||||
jobInfo.StartJob(client);
|
||||
NewPositions = new List<Vector3>();
|
||||
}
|
||||
else if (route == "2" && client.HasData("BusJob"))
|
||||
{
|
||||
NAPI.Notification.SendNotificationToPlayer(client, "Du hast die Route 2 ausgewählt, fahre jetzt die Haltestellen ab.");
|
||||
client.SetData("BusJobAn", true);
|
||||
NewPositions.Add(new Vector3(403.4488, -786.5514, 29.2046));
|
||||
NewPositions.Add(new Vector3(351.5793, -1064.582, 29.40059));
|
||||
NewPositions.Add(new Vector3(787.6898, -1364.566, 26.41318));
|
||||
NewPositions.Add(new Vector3(942.0541, -1447.974, 31.14204));
|
||||
NewPositions.Add(new Vector3(866.8322, -997.5225, 30.48207));
|
||||
NewPositions.Add(new Vector3(785.4254, -781.3905, 26.33277));
|
||||
NewPositions.Add(new Vector3(235.0964, -857.1152, 29.74256));
|
||||
JobInfo jobInfo = new JobInfo();
|
||||
foreach (Vector3 vector in NewPositions)
|
||||
{
|
||||
jobInfo.AddObjective(vector, size);
|
||||
}
|
||||
jobInfo.StartJob(client);
|
||||
NewPositions = new List<Vector3>();
|
||||
}
|
||||
/*else if (route == "3" && client.HasData("BusJob")) // Platzhalter für weitere Routen
|
||||
{
|
||||
NAPI.Notification.SendNotificationToPlayer(client, "Du hast die Route 3 ausgewählt, fahre jetzt die Haltestellen ab.");
|
||||
client.SetData("BusJobAn", true);
|
||||
NewPositions.Add(new Vector3(306.163, -767.4735, 29.20587));
|
||||
NewPositions.Add(new Vector3(76.55303, -1468.593, 29.23081));
|
||||
NewPositions.Add(new Vector3(-105.5951, -1684.548, 29.23948));
|
||||
NewPositions.Add(new Vector3(-1056.246, -2552.576, 13.66063));
|
||||
NewPositions.Add(new Vector3(200.3088, -1978.828, 19.3329));
|
||||
NewPositions.Add(new Vector3(358.6138, -1785.821, 28.92113));
|
||||
NewPositions.Add(new Vector3(281.8594, -1462.503, 29.13148));
|
||||
NewPositions.Add(new Vector3(77.72239, -1212.086, 29.12294));
|
||||
NewPositions.Add(new Vector3(218.1398, -850.9549, 30.16619));
|
||||
JobInfo jobInfo = new JobInfo();
|
||||
foreach (Vector3 vector in NewPositions)
|
||||
{
|
||||
jobInfo.AddObjective(vector, size);
|
||||
}
|
||||
jobInfo.StartJob(client);
|
||||
NewPositions = new List<Vector3>();
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
22
ReallifeGamemode.Server/Job/BusDriver/Events.cs
Normal file
22
ReallifeGamemode.Server/Job/BusDriver/Events.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
|
||||
namespace ReallifeGamemode.Server.Job.BusDriver
|
||||
{
|
||||
public class Events : Script
|
||||
{
|
||||
// Client Events
|
||||
|
||||
[RemoteEvent("marker_completed")]
|
||||
public void RemoteEvent_MarkerCompleted(Client client)
|
||||
{
|
||||
if (!client.HasData("Job"))
|
||||
return;
|
||||
|
||||
JobInfo jobInfo = client.GetData("Job");
|
||||
jobInfo.CheckObjective(client);
|
||||
}
|
||||
}
|
||||
}
|
||||
40
ReallifeGamemode.Server/Job/BusDriver/JobBlips.cs
Normal file
40
ReallifeGamemode.Server/Job/BusDriver/JobBlips.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
|
||||
namespace ReallifeGamemode.Server.Job.BusDriver
|
||||
{
|
||||
public class JobBlips : Script
|
||||
{
|
||||
// Route 1
|
||||
Blip Blip = NAPI.Blip.CreateBlip(513, new Vector3(308.0671, -762.0952, 29.21954), 1, 4, "Haltestelle(R1)", 255, 0, true);
|
||||
Blip Blip2 = NAPI.Blip.CreateBlip(513, new Vector3(-105.5951, -1684.548, 29.23948), 1, 4, "Haltestelle(R1)", 255, 0, true);
|
||||
Blip Blip3 = NAPI.Blip.CreateBlip(513, new Vector3(-1056.246, -2552.576, 13.66063), 1, 4, "Haltestelle(R1)", 255, 0, true);
|
||||
Blip Blip4 = NAPI.Blip.CreateBlip(513, new Vector3(200.3088, -1978.828, 19.3329), 1, 4, "Haltestelle(R1)", 255, 0, true);
|
||||
Blip Blip5 = NAPI.Blip.CreateBlip(513, new Vector3(358.6138, -1785.821, 28.92113), 1, 4, "Haltestelle(R1)", 255, 0, true);
|
||||
Blip Blip6 = NAPI.Blip.CreateBlip(513, new Vector3(281.8594, -1462.503, 29.13148), 1, 4, "Haltestelle(R1)", 255, 0, true);
|
||||
Blip Blip7 = NAPI.Blip.CreateBlip(513, new Vector3(77.72239, -1212.086, 29.12294), 1, 4, "Haltestelle(R1)", 255, 0, true);
|
||||
Blip Blip8 = NAPI.Blip.CreateBlip(513, new Vector3(218.1398, -850.9549, 30.16619), 1, 4, "Haltestelle(R1)", 255, 0, true);
|
||||
|
||||
//Route 2
|
||||
Blip Blip9 = NAPI.Blip.CreateBlip(513, new Vector3(403.4488, -786.5514, 29.2046), 1, 27, "Haltestelle(R2)", 255, 0, true);
|
||||
Blip Blip11 = NAPI.Blip.CreateBlip(513, new Vector3(787.6898, -1364.566, 26.41318), 1, 27, "Haltestelle(R2)", 255, 0, true);
|
||||
Blip Blip12 = NAPI.Blip.CreateBlip(513, new Vector3(942.0541, -1447.974, 31.14204), 1, 27, "Haltestelle(R2)", 255, 0, true);
|
||||
Blip Blip13 = NAPI.Blip.CreateBlip(513, new Vector3(866.8322, -997.5225, 30.48207), 1, 27, "Haltestelle(R2)", 255, 0, true);
|
||||
Blip Blip14 = NAPI.Blip.CreateBlip(513, new Vector3(785.4254, -781.3905, 26.33277), 1, 27, "Haltestelle(R2)", 255, 0, true);
|
||||
Blip Blip15 = NAPI.Blip.CreateBlip(513, new Vector3(351.5793, -1064.582, 29.40059), 1, 27, "Haltestelle(R2)", 255, 0, true);
|
||||
Blip Blip16 = NAPI.Blip.CreateBlip(513, new Vector3(235.0964, -857.1152, 29.74256), 1, 27, "Haltestelle(R2)", 255, 0, true);
|
||||
|
||||
// Route 3 // Platzhalter weitere Blips Routen
|
||||
/*Blip Blip17 = NAPI.Blip.CreateBlip(513, new Vector3(306.163, -767.4735, 29.20587), 1, 49, "Haltestelle(R3)", 255, 0, true);
|
||||
Blip Blip18 = NAPI.Blip.CreateBlip(513, new Vector3(76.55303, -1468.593, 29.23081), 1, 49, "Haltestelle(R3)", 255, 0, true);
|
||||
Blip Blip19 = NAPI.Blip.CreateBlip(513, new Vector3(-105.5951, -1684.548, 29.23948), 1, 49, "Haltestelle(R3)", 255, 0, true);
|
||||
Blip Blip20 = NAPI.Blip.CreateBlip(513, new Vector3(-1056.246, -2552.576, 13.66063), 1, 49, "Haltestelle(R3)", 255, 0, true);
|
||||
Blip Blip21 = NAPI.Blip.CreateBlip(513, new Vector3(200.3088, -1978.828, 19.3329), 1, 49, "Haltestelle(R3)", 255, 0, true);
|
||||
Blip Blip22 = NAPI.Blip.CreateBlip(513, new Vector3(358.6138, -1785.821, 28.92113), 1, 49, "Haltestelle(R3)", 255, 0, true);
|
||||
Blip Blip23 = NAPI.Blip.CreateBlip(513, new Vector3(281.8594, -1462.503, 29.13148), 1, 49, "Haltestelle(R3)", 255, 0, true);
|
||||
Blip Blip24 = NAPI.Blip.CreateBlip(513, new Vector3(77.72239, -1212.086, 29.12294), 1, 49, "Haltestelle(R3)", 255, 0, true);
|
||||
Blip Blip25 = NAPI.Blip.CreateBlip(513, new Vector3(218.1398, -850.9549, 30.16619), 1, 49, "Haltestelle(R3)", 255, 0, true);*/
|
||||
}
|
||||
}
|
||||
58
ReallifeGamemode.Server/Job/BusDriver/JobInfoCheckPoints.cs
Normal file
58
ReallifeGamemode.Server/Job/BusDriver/JobInfoCheckPoints.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
|
||||
namespace ReallifeGamemode.Server.Job.BusDriver
|
||||
{
|
||||
public class JobInfo
|
||||
{
|
||||
public Queue<ObjectiveInfo> Objectives = new Queue<ObjectiveInfo>();
|
||||
public Client Owner { get; set; }
|
||||
|
||||
|
||||
public void AddObjective(Vector3 position, float size)
|
||||
{
|
||||
ObjectiveInfo objectiveInfo = new ObjectiveInfo();
|
||||
objectiveInfo.Position = position;
|
||||
objectiveInfo.Size = size;
|
||||
|
||||
Objectives.Enqueue(objectiveInfo);
|
||||
}
|
||||
|
||||
public void StartJob(Client client)
|
||||
{
|
||||
Owner = client;
|
||||
NextObjective(client);
|
||||
|
||||
client.SetData("Job", this);
|
||||
}
|
||||
|
||||
public void NextObjective(Client client)
|
||||
{
|
||||
ObjectiveInfo next_objective = Objectives.Peek();
|
||||
client.TriggerEvent("load_objective", next_objective.Position, next_objective.Size);
|
||||
}
|
||||
|
||||
public void CheckObjective(Client client)
|
||||
{
|
||||
ObjectiveInfo current_objective = Objectives.Peek();
|
||||
|
||||
if (!current_objective.IsInObjective(client))
|
||||
return;
|
||||
|
||||
Objectives.Dequeue();
|
||||
|
||||
if (Objectives.Count == 0)
|
||||
{
|
||||
client.SendNotification("Du hast alle ~r~Haltestellen ~w~ abgefahren.");
|
||||
client.SendNotification("Fahre zurück zum Busbahnhof und bringe deinen Bus zurück.");
|
||||
client.TriggerEvent("clear_all_markers");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
NextObjective(client);
|
||||
}
|
||||
}
|
||||
}
|
||||
18
ReallifeGamemode.Server/Job/BusDriver/ObjectiveInfo.cs
Normal file
18
ReallifeGamemode.Server/Job/BusDriver/ObjectiveInfo.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
|
||||
namespace ReallifeGamemode.Server.Job.BusDriver
|
||||
{
|
||||
public class ObjectiveInfo
|
||||
{
|
||||
public Vector3 Position { get; set; }
|
||||
public float Size { get; set; }
|
||||
|
||||
public bool IsInObjective(Client client)
|
||||
{
|
||||
return (client.Position.DistanceTo2D(Position) <= Size) ? true : false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user