55 lines
1.9 KiB
C#
55 lines
1.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using GTANetworkAPI;
|
|
using reallife_gamemode.Model;
|
|
using reallife_gamemode.Server.Entities;
|
|
using reallife_gamemode.Server.Extensions;
|
|
|
|
/**
|
|
* @overview Life of German Reallife - Managers LoadManager (LoadManager.cs)
|
|
* @author VegaZ
|
|
* @copyright (c) 2008 - 2018 Life of German
|
|
*/
|
|
|
|
namespace reallife_gamemode.Server.Managers
|
|
{
|
|
public class LoadManager : Script
|
|
{
|
|
|
|
[ServerEvent(Event.ResourceStart)]
|
|
public void OnResourceStart()
|
|
{
|
|
using (var loadData = new DatabaseContext())
|
|
{
|
|
foreach (Saves.SavedBlip b in loadData.Blips)
|
|
{
|
|
if(b.Active == true)
|
|
{
|
|
NAPI.Blip.CreateBlip((uint) b.Sprite, new Vector3(b.PositionX, b.PositionY, b.PositionZ), b.Scale,
|
|
b.Color, b.Name, b.Alpha, b.DrawDistance, b.ShortRange, (short) b.Rotation, b.Dimension);
|
|
}
|
|
}
|
|
|
|
foreach(ServerVehicle veh in loadData.ServerVehicles)
|
|
{
|
|
if (!veh.Active) continue;
|
|
|
|
Vehicle current = veh.Spawn();
|
|
TuningManager.ApplyTuningToServerVehicle(veh);
|
|
|
|
if (veh is ShopVehicle shopV)
|
|
{
|
|
string displayName = NAPI.Vehicle.GetVehicleDisplayName(shopV.Model);
|
|
NAPI.Vehicle.SetVehicleEngineHealth(current, 0);
|
|
var tLabel = NAPI.TextLabel.CreateTextLabel(displayName + " | " + shopV.Price.ToMoneyString(), new Vector3(shopV.PositionX, shopV.PositionY, shopV.PositionZ + 1.5), 10, 1, 0, new Color(255, 255, 255), false);
|
|
tLabel.AttachTo(current, "chassis", new Vector3(0, 0, 1.5), new Vector3(0, 0, 0));
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|