beifahrer fahrer waypoint
This commit is contained in:
@@ -1,5 +1,24 @@
|
|||||||
export default function waypointUtil() {
|
export default function waypointUtil() {
|
||||||
mp.events.add("SERVER:Util_setWaypoint", (x, y) => {
|
|
||||||
|
let x_saved: number;
|
||||||
|
let y_saved: number;
|
||||||
|
let z_saved: number;
|
||||||
|
|
||||||
|
mp.events.add("SERVER:Util_setWaypoint", (x, y, z) => {
|
||||||
mp.game.ui.setNewWaypoint(x, y);
|
mp.game.ui.setNewWaypoint(x, y);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
mp.events.add("playerCreateWaypoint", (position) => {
|
||||||
|
x_saved = position.x;
|
||||||
|
y_saved = position.y;
|
||||||
|
z_saved = position.z;
|
||||||
|
mp.events.callRemote("SERVER:waypointToDriver", position.x, position.y);
|
||||||
|
});
|
||||||
|
|
||||||
|
mp.events.add("gotoWaypoint", () => {
|
||||||
|
mp.gui.chat.push("xyz: " + x_saved + " " + y_saved + " " + z_saved);
|
||||||
|
mp.players.local.position = new mp.Vector3(x_saved, y_saved, z_saved);
|
||||||
|
|
||||||
|
//coord.z = mp.game.gameplay.getGroundZFor3dCoord(coord.x, coord.y, i * 50, 0, false); // try calcualte Z
|
||||||
|
});
|
||||||
}
|
}
|
||||||
43
ReallifeGamemode.Server/Events/Waypoint.cs
Normal file
43
ReallifeGamemode.Server/Events/Waypoint.cs
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using GTANetworkAPI;
|
||||||
|
using ReallifeGamemode.Database.Entities;
|
||||||
|
using ReallifeGamemode.Server.Services;
|
||||||
|
using ReallifeGamemode.Services;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Server.Events
|
||||||
|
{
|
||||||
|
class Waypoint : Script
|
||||||
|
{
|
||||||
|
[RemoteEvent("SERVER:waypointToDriver")]
|
||||||
|
public void setWaypointToDriver(Player player, float x, float y)
|
||||||
|
{
|
||||||
|
if (!player.IsInVehicle)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.VehicleSeat == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ChatService.Broadcast("a");
|
||||||
|
|
||||||
|
Entity entity = NAPI.Vehicle.GetVehicleDriver(player.Vehicle);
|
||||||
|
Player target = PlayerService.GetPlayerByNameOrId(entity.Value.ToString());
|
||||||
|
|
||||||
|
|
||||||
|
ChatService.Broadcast("b");
|
||||||
|
|
||||||
|
if (target == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ChatService.Broadcast("c");
|
||||||
|
|
||||||
|
target.TriggerEvent("SERVER:Util_setWaypoint", x, y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user