renewed and improved busdriver job system, paaqo is not amused
This commit is contained in:
@@ -10,7 +10,8 @@ export default function checkpointHandle(globalData: GlobalData) {
|
|||||||
var inCheckpoint = false;
|
var inCheckpoint = false;
|
||||||
|
|
||||||
mp.events.add('setCheckPoint', (position, player) => {
|
mp.events.add('setCheckPoint', (position, player) => {
|
||||||
mp.gui.chat.push("exec");
|
mp.gui.chat.push("jaha");
|
||||||
|
inCheckpoint = false;
|
||||||
posCp = position;
|
posCp = position;
|
||||||
Player = player;
|
Player = player;
|
||||||
activeCheckpoint = mp.markers.new(1, posCp, 3.0, {
|
activeCheckpoint = mp.markers.new(1, posCp, 3.0, {
|
||||||
@@ -19,6 +20,8 @@ export default function checkpointHandle(globalData: GlobalData) {
|
|||||||
dimension: 0
|
dimension: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//mp.events.call("SERVER:Util_setWaypoint", posCp.X, posCp.Z);
|
||||||
|
mp.game.ui.setNewWaypoint(posCp.x, posCp.y);
|
||||||
myVar = setInterval(myTimer, 100);
|
myVar = setInterval(myTimer, 100);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -26,7 +29,10 @@ export default function checkpointHandle(globalData: GlobalData) {
|
|||||||
let dist = mp.game.gameplay.getDistanceBetweenCoords(Player.position.x, Player.position.y, 0, posCp.x, posCp.y, 0, false);
|
let dist = mp.game.gameplay.getDistanceBetweenCoords(Player.position.x, Player.position.y, 0, posCp.x, posCp.y, 0, false);
|
||||||
|
|
||||||
if (dist <= 2 && !inCheckpoint) {
|
if (dist <= 2 && !inCheckpoint) {
|
||||||
|
mp.game.audio.playSoundFrontend(1, "Beep_Red", "DLC_HEIST_HACKING_SNAKE_SOUNDS", true);
|
||||||
inCheckpoint = true;
|
inCheckpoint = true;
|
||||||
|
activeCheckpoint.visible = false;
|
||||||
|
clearInterval(myVar);
|
||||||
mp.events.callRemote("playerInCheckpoint");
|
mp.events.callRemote("playerInCheckpoint");
|
||||||
} else if (dist > 2) {
|
} else if (dist > 2) {
|
||||||
inCheckpoint = false;
|
inCheckpoint = false;
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using GTANetworkAPI;
|
||||||
|
using ReallifeGamemode.Server.Util;
|
||||||
|
|
||||||
namespace ReallifeGamemode.Server.Job
|
namespace ReallifeGamemode.Server.Job
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using ReallifeGamemode.Server.Util;
|
||||||
|
using System.Collections;
|
||||||
|
|
||||||
namespace ReallifeGamemode.Server.Job
|
namespace ReallifeGamemode.Server.Job
|
||||||
{
|
{
|
||||||
@@ -35,6 +37,16 @@ namespace ReallifeGamemode.Server.Job
|
|||||||
ChatService.SendMessage(player, $"~y~[JOB]~s~ Du hast deinen Job ~o~{this.Name}~s~ gestartet.");
|
ChatService.SendMessage(player, $"~y~[JOB]~s~ Du hast deinen Job ~o~{this.Name}~s~ gestartet.");
|
||||||
|
|
||||||
JobStart?.Invoke(player);
|
JobStart?.Invoke(player);
|
||||||
|
|
||||||
|
List<Vector3> list = new List<Vector3>();
|
||||||
|
list.Add(new Vector3(-105.5951, -1684.548, 29.23948));
|
||||||
|
list.Add(new Vector3(-1056.246, -2552.576, 13.66063));
|
||||||
|
list.Add(new Vector3(200.3088, -1978.828, 19.3329));
|
||||||
|
list.Add(new Vector3(358.6138, -1785.821, 28.92113));
|
||||||
|
list.Add(new Vector3(281.8594, -1462.503, 29.13148));
|
||||||
|
list.Add(new Vector3(77.72239, -1212.086, 29.12294));
|
||||||
|
list.Add(new Vector3(218.1398, -850.9549, 30.16619));
|
||||||
|
CheckPointHandle.startCheckPointRoute(player, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StopJob(Client player, bool quit = false)
|
public void StopJob(Client player, bool quit = false)
|
||||||
|
|||||||
@@ -8,28 +8,68 @@ using ReallifeGamemode.Server.Models;
|
|||||||
using ReallifeGamemode.Server.Services;
|
using ReallifeGamemode.Server.Services;
|
||||||
using ReallifeGamemode.Server.Util;
|
using ReallifeGamemode.Server.Util;
|
||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Linq;
|
||||||
namespace ReallifeGamemode.Server.Util
|
namespace ReallifeGamemode.Server.Util
|
||||||
{
|
{
|
||||||
class CheckPointHandle : Script
|
public class CheckPointHandle : Script
|
||||||
{
|
{
|
||||||
[Command("cp", "~m~Benutzung: ~s~/cp")]
|
public static List<checkPointListForPlayer> listHandle = new List<checkPointListForPlayer>();
|
||||||
public void CmdCp(Client player)
|
public static void startCheckPointRoute(Client player, List<Vector3> nListCps)
|
||||||
{
|
{
|
||||||
if (!player.IsLoggedIn()) return;
|
checkPointListForPlayer playerHandle = new checkPointListForPlayer(player, nListCps);
|
||||||
|
listHandle.Add(playerHandle);
|
||||||
|
|
||||||
Vector3 cp = player.Position;
|
playerHandle.startRoute();
|
||||||
|
|
||||||
cp.X += 10;
|
|
||||||
player.TriggerEvent("setCheckPoint", cp, player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[RemoteEvent("playerInCheckpoint")]
|
[RemoteEvent("playerInCheckpoint")]
|
||||||
public void enteredCheckpoints(Client user)
|
public void playerInCheckpoint(Client user)
|
||||||
{
|
{
|
||||||
ChatService.SendMessage(user, "ja");
|
ChatService.Broadcast("neuer cp");
|
||||||
Vector3 newCp = new Vector3(400, 680, 29);
|
checkPointListForPlayer temp = null;
|
||||||
user.TriggerEvent("setCheckpoint", newCp, user);
|
for (int a = 0; a < listHandle.Count; a++)
|
||||||
|
{
|
||||||
|
temp = listHandle[a];
|
||||||
|
if (temp.player == user)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
temp.nextCheckpoint();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class checkPointListForPlayer
|
||||||
|
{
|
||||||
|
public List<Vector3> list = new List<Vector3>();
|
||||||
|
public Client player;
|
||||||
|
|
||||||
|
Vector3 checkPoint;
|
||||||
|
Boolean done;
|
||||||
|
int checkPointsDone = 0;
|
||||||
|
|
||||||
|
public checkPointListForPlayer(Client nPlayer, List<Vector3> nList)
|
||||||
|
{
|
||||||
|
this.player = nPlayer;
|
||||||
|
this.list = nList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void startRoute()
|
||||||
|
{
|
||||||
|
player.TriggerEvent("setCheckPoint", this.list.ElementAt(0), player);
|
||||||
|
}
|
||||||
|
public void nextCheckpoint()
|
||||||
|
{
|
||||||
|
this.checkPointsDone++;
|
||||||
|
if (this.list.Count > checkPointsDone)
|
||||||
|
{
|
||||||
|
Vector3 nextCp = list.ElementAt(checkPointsDone);
|
||||||
|
ChatService.SendMessage(this.player, "cp set at " + nextCp.ToString());
|
||||||
|
this.player.TriggerEvent("setCheckPoint", nextCp, player);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user