Almost finish ClothSystem (Save/Load)
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
using Newtonsoft.Json;
|
||||
using reallife_gamemode.Model;
|
||||
using reallife_gamemode.Server.Entities;
|
||||
using reallife_gamemode.Server.Extensions;
|
||||
using reallife_gamemode.Server.Managers;
|
||||
using reallife_gamemode.Server.Saves;
|
||||
@@ -58,6 +61,30 @@ namespace reallife_gamemode.Server.Events
|
||||
break;
|
||||
}
|
||||
player.NametagColor = nameTagColor;
|
||||
using (var context = new DatabaseContext())
|
||||
{
|
||||
List<CharacterCloth> clothes = context.CharacterClothes.ToList().FindAll(u => u.UserId == user.Id);
|
||||
|
||||
foreach(var cloth in clothes)
|
||||
{
|
||||
if(cloth.SlotType == 0)
|
||||
{
|
||||
player.SetClothes(cloth.SlotId, cloth.ClothId, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(cloth.ClothId != -1)
|
||||
{
|
||||
player.SetAccessories(cloth.SlotId, cloth.ClothId, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.ClearAccessory(cloth.SlotId);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -65,6 +92,11 @@ namespace reallife_gamemode.Server.Events
|
||||
player.SendNotification("Du bist nun ~r~außer Dienst.");
|
||||
NAPI.ClientEvent.TriggerClientEventForAll("updateDutyMedics", false);
|
||||
player.NametagColor = new Color(255, 255, 255);
|
||||
|
||||
player.ClearAccessory(0);
|
||||
//Gespeicherte Props laden lassen
|
||||
player.SetDefaultClothes();
|
||||
//Gespeicherte Klamotten laden lassen
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,6 +133,7 @@ namespace reallife_gamemode.Server.Events
|
||||
string[] legs;
|
||||
string[] shoes;
|
||||
|
||||
//TODO in Datenbank auslagern
|
||||
if(user.GetCharacter().Gender == false) //Wenn männlich
|
||||
{
|
||||
hats = new string[] { "Keinen", "5", "12", "39", "46", "123", "124", "125"};
|
||||
|
||||
Reference in New Issue
Block a user