Begin script abstraction

This commit is contained in:
hydrant
2020-02-29 14:50:10 +01:00
parent 447dd2eabc
commit 37f499a446
48 changed files with 2201 additions and 49 deletions

View File

@@ -8,6 +8,11 @@ using ReallifeGamemode.Server.Util;
using ReallifeGamemode.Server.Wanted;
using ReallifeGamemode.Server.DrivingSchool;
using ReallifeGamemode.Server.WeaponDeal;
using ReallifeGamemode.Server.Core.API;
using ReallifeGamemode.Server.Core.RageMP;
using ReallifeGamemode.Server.Core.Events;
using System.Collections.Generic;
using ReallifeGamemode.Server.Common;
using ReallifeGamemode.Server.Job;
/**
@@ -25,9 +30,16 @@ namespace ReallifeGamemode.Server
public static readonly CultureInfo SERVER_CULTURE = new CultureInfo("de-DE");
private EventHandler eventHandler;
[ServerEvent(Event.ResourceStart)]
public void OnResourceStart()
{
IAPI apiInstance = new RageAPI();
eventHandler = new EventHandler(apiInstance);
new Core.Main(apiInstance, eventHandler);
NAPI.Server.SetGlobalServerChat(false);
NAPI.Server.SetCommandErrorMessage("~r~[FEHLER]~s~ Dieser Command existiert nicht.");
@@ -83,9 +95,13 @@ namespace ReallifeGamemode.Server
Jail.JailTimer();
Economy.PaydayTimer();
WeaponDealManager.WeaponDealTimer();
}
[RemoteEvent("CLIENT:Event")]
public void OnClientEvent(Player player, string dataStr)
{
var data = dataStr.DeserializeJson<List<object>>();
eventHandler.HandleEvent(new RagePlayer(player), data);
}
}
}