38 lines
1.0 KiB
C#
38 lines
1.0 KiB
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.TriggerEvent("BN_ShowWithPicture", "Abgetaucht", "Lester", "Du hast erfolgreich ein Wanted ~y~abgetaucht", "CHAR_LESTER", 1, true);
|
|
user.Wanteds -= 1;
|
|
if (user.Wanteds == 0)
|
|
{
|
|
ChatService.HQMessage(player.Name + " konnte solange abtauchen, sodass er nicht mehr gesucht wird.");
|
|
user.SetBlipAndNametagColor();
|
|
}
|
|
dbContext.SaveChanges();
|
|
}
|
|
}
|
|
}
|