Feature/save system
This commit is contained in:
47
Server/Managers/LoadManager.cs
Normal file
47
Server/Managers/LoadManager.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
using reallife_gamemode.Model;
|
||||
using reallife_gamemode.Server.Entities;
|
||||
|
||||
/**
|
||||
* @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()
|
||||
{
|
||||
//LOAD ALL BLIPS
|
||||
using (var loadBlips = new DatabaseContext())
|
||||
{
|
||||
foreach (Saves.SavedBlip b in loadBlips.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
//LOAD ALL VEHICLES
|
||||
using (var loadVehicles = new DatabaseContext())
|
||||
{
|
||||
foreach (Saves.SavedVehicle v in loadVehicles.Vehicles)
|
||||
{
|
||||
if (v.Active == true)
|
||||
{
|
||||
NAPI.Vehicle.CreateVehicle((uint) v.Model, new Vector3(v.PositionX, v.PositionY, v.PositionZ), v.Heading, (int)(v.PrimaryColor),
|
||||
v.SecondaryColor, v.NumberPlate, v.Alpha, v.Locked, v.Engine = false, v.Dimension);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user