add introduction at noobspawn

This commit is contained in:
michael.reiswich
2021-01-18 15:36:33 +01:00
parent f52c813514
commit f18c47c530
9 changed files with 291 additions and 1 deletions

View File

@@ -0,0 +1,46 @@
using GTANetworkAPI;
using Newtonsoft.Json;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Finance;
using ReallifeGamemode.Services;
using System;
/**
* @overview Life of German Reallife - Managers Interaction (InteractionManager.cs)
* @author MichaPlays
* @copyright (c) 2008 - 2021 Life of German
*/
namespace ReallifeGamemode.Server.newbie
{
class Introduction : Script
{
private static TextLabel informationLabel;
private static Marker marker;
private static ColShape _colShape;
public static Vector3 Position { get; }
public static void Setup()
{
informationLabel = NAPI.TextLabel.CreateTextLabel("Einführung", new Vector3(-1025.57, -2732.15, 13.75), 20.0f, 1.3f, 0, new Color(255, 255, 255));
marker = NAPI.Marker.CreateMarker(MarkerType.VerticalCylinder, new Vector3(-1025.57, -2732.15, 12.75), new Vector3(), new Vector3(), 2f, new Color(107, 0, 0));
_colShape = NAPI.ColShape.CreateSphereColShape(new Vector3(-1025.57, -2732.15, 13.75), 2f);
_colShape.OnEntityEnterColShape += EntityEnterBankColShape;
_colShape.OnEntityExitColShape += EntityExitBankColShape;
}
private static void EntityEnterBankColShape(ColShape colShape, Player client)
{
if (client.IsInVehicle || !client.IsLoggedIn()) return;
client.TriggerEvent("showIntroduction");
}
private static void EntityExitBankColShape(ColShape colShape, Player client)
{
client.TriggerEvent("removeIntroduction");
}
}
}