38 lines
1004 B
C#
38 lines
1004 B
C#
/***
|
|
@overview Life of German - Wanted (Wanted.cs)
|
|
@author kookroach
|
|
@copyright (c) 2008 - 2019 Life of German
|
|
*/
|
|
|
|
using System.Collections.Generic;
|
|
using GTANetworkAPI;
|
|
using ReallifeGamemode.Database.Entities;
|
|
using ReallifeGamemode.Database.Models;
|
|
using ReallifeGamemode.Server.Extensions;
|
|
using ReallifeGamemode.Server.Services;
|
|
|
|
namespace ReallifeGamemode.Server.Wanted
|
|
{
|
|
public class WantedEscapeTimer : Script
|
|
{
|
|
[RemoteEvent("CLIENT:EscapeWanted")]
|
|
public void WantedEscape(Player player)
|
|
{
|
|
using var dbContext = new DatabaseContext();
|
|
User user = player.GetUser(dbContext);
|
|
|
|
if (user.Wanteds <= 0)
|
|
return;
|
|
|
|
player.SendChatMessage("~y~Du hast erfolgreich einen Wanted abgetaucht.");
|
|
user.Wanteds -= 1;
|
|
if (user.Wanteds == 0)
|
|
{
|
|
ChatService.HQMessage(player.Name + " konnte solange abtauchen, sodass er nicht mehr gesucht wird.");
|
|
user.SetBlipAndNametagColor();
|
|
}
|
|
dbContext.SaveChanges();
|
|
}
|
|
}
|
|
}
|