change stuff with objects
This commit is contained in:
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 7.0 KiB |
@@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
namespace ReallifeGamemode.Server.Inventory.Interfaces
|
namespace ReallifeGamemode.Server.Inventory.Interfaces
|
||||||
{
|
{
|
||||||
public interface IUsableItem : IItem, IDroppableItem
|
public interface IUsableItem : IItem, IDroppableItem //marker Interface
|
||||||
{
|
{
|
||||||
void Use(UserItem uItem);
|
bool Use(UserItem uItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,38 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using GTANetworkAPI;
|
||||||
|
using ReallifeGamemode.Database.Entities;
|
||||||
|
using ReallifeGamemode.Server.Extensions;
|
||||||
|
using ReallifeGamemode.Server.Managers;
|
||||||
|
|
||||||
namespace ReallifeGamemode.Server.Inventory.Items
|
namespace ReallifeGamemode.Server.Inventory.Items
|
||||||
{
|
{
|
||||||
class Apfel : FoodItem
|
internal class Apfel : ConsumableItem
|
||||||
{
|
{
|
||||||
public override int Id => 101;
|
public override int Id => 101;
|
||||||
public override string Name => "Apfel";
|
public override string Name => "Apfel";
|
||||||
public override string Description => "Ein Apfel";
|
public override string Description => "Ein Apfel";
|
||||||
public override int Gewicht => 10;
|
public override int Gewicht => 200;
|
||||||
public override string Einheit => "g";
|
public override string Einheit => "g";
|
||||||
public override int HpAmount => 10;
|
public override int HpAmount => 10;
|
||||||
public override uint Object => 2240524752;
|
public override uint Object => 2240524752;
|
||||||
public override int Price => 20;
|
public override int Price => 20;
|
||||||
|
public override float Cooldown => 5000;
|
||||||
|
|
||||||
|
public override void Consume(UserItem uItem)
|
||||||
|
{
|
||||||
|
Player player = uItem.GetUser().Player;
|
||||||
|
|
||||||
|
int amountToAdd = HpAmount;
|
||||||
|
if (player.Health + amountToAdd > 100)
|
||||||
|
{
|
||||||
|
amountToAdd = 100 - player.Health;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.SafeSetHealth(player.Health + amountToAdd);
|
||||||
|
player.SendNotification("Du hast einen ~y~" + Name + " ~s~gegessen.", false);
|
||||||
|
InventoryManager.RemoveUserItem(player.GetUser(), uItem, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,39 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using GTANetworkAPI;
|
||||||
|
using ReallifeGamemode.Database.Entities;
|
||||||
|
using ReallifeGamemode.Server.Extensions;
|
||||||
|
using ReallifeGamemode.Server.Managers;
|
||||||
|
|
||||||
namespace ReallifeGamemode.Server.Inventory.Items
|
namespace ReallifeGamemode.Server.Inventory.Items
|
||||||
{
|
{
|
||||||
class AChips : FoodItem
|
internal class AChips : ConsumableItem
|
||||||
{
|
{
|
||||||
public override int Id => 104;
|
public override int Id => 104;
|
||||||
public override string Name => "Aviates Chips";
|
public override string Name => "aviates Chips";
|
||||||
public override string Description => "aviate liebt sie.";
|
public override string Description => "aviate liebt sie.";
|
||||||
public override int Gewicht => 10;
|
public override int Gewicht => 200;
|
||||||
public override string Einheit => "g";
|
public override string Einheit => "g";
|
||||||
public override int HpAmount => 10;
|
public override int HpAmount => 10;
|
||||||
public override uint Object => 2240524752;
|
public override uint Object => 2240524752;
|
||||||
public override int Price => 20;
|
public override int Price => 1000;
|
||||||
|
|
||||||
|
public override float Cooldown => 5000;
|
||||||
|
|
||||||
|
public override void Consume(UserItem uItem)
|
||||||
|
{
|
||||||
|
Player player = uItem.GetUser().Player;
|
||||||
|
|
||||||
|
int amountToAdd = HpAmount;
|
||||||
|
if (player.Health + amountToAdd > 100)
|
||||||
|
{
|
||||||
|
amountToAdd = 100 - player.Health;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.SafeSetHealth(player.Health + amountToAdd);
|
||||||
|
player.SendNotification("Du hast ~y~" + Name + " ~s~gegessen.", false);
|
||||||
|
InventoryManager.RemoveUserItem(player.GetUser(), uItem, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
39
ReallifeGamemode.Server/Inventory/Items/Baklava.cs
Normal file
39
ReallifeGamemode.Server/Inventory/Items/Baklava.cs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using GTANetworkAPI;
|
||||||
|
using ReallifeGamemode.Database.Entities;
|
||||||
|
using ReallifeGamemode.Server.Extensions;
|
||||||
|
using ReallifeGamemode.Server.Managers;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Server.Inventory.Items
|
||||||
|
{
|
||||||
|
internal class Baklava : ConsumableItem
|
||||||
|
{
|
||||||
|
public override int Id => 104;
|
||||||
|
public override string Name => "Baklava";
|
||||||
|
public override string Description => "Dessert für dannach.";
|
||||||
|
public override int Gewicht => 100;
|
||||||
|
public override string Einheit => "g";
|
||||||
|
public override int HpAmount => 30;
|
||||||
|
public override uint Object => 2240524752;
|
||||||
|
public override int Price => 300;
|
||||||
|
|
||||||
|
public override float Cooldown => 10000;
|
||||||
|
|
||||||
|
public override void Consume(UserItem uItem)
|
||||||
|
{
|
||||||
|
Player player = uItem.GetUser().Player;
|
||||||
|
|
||||||
|
int amountToAdd = HpAmount;
|
||||||
|
if (player.Health + amountToAdd > 100)
|
||||||
|
{
|
||||||
|
amountToAdd = 100 - player.Health;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.SafeSetHealth(player.Health + amountToAdd);
|
||||||
|
player.SendNotification("Du hast ein ~y~" + Name + " ~s~gegessen.", false);
|
||||||
|
InventoryManager.RemoveUserItem(player.GetUser(), uItem, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using ReallifeGamemode.Database.Entities;
|
||||||
|
|
||||||
namespace ReallifeGamemode.Server.Inventory.Items
|
namespace ReallifeGamemode.Server.Inventory.Items
|
||||||
{
|
{
|
||||||
class Bier : FoodItem
|
internal class Bier : ConsumableItem
|
||||||
{
|
{
|
||||||
public override int Id => 102;
|
public override int Id => 102;
|
||||||
public override string Name => "Bier";
|
public override string Name => "Bier";
|
||||||
@@ -14,5 +15,12 @@ namespace ReallifeGamemode.Server.Inventory.Items
|
|||||||
public override int HpAmount => 10;
|
public override int HpAmount => 10;
|
||||||
public override uint Object => 2240524752;
|
public override uint Object => 2240524752;
|
||||||
public override int Price => 20;
|
public override int Price => 20;
|
||||||
|
|
||||||
|
public override float Cooldown => 1000;
|
||||||
|
|
||||||
|
public override void Consume(UserItem uItem)
|
||||||
|
{
|
||||||
|
//nothing
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
/**
|
using GTANetworkAPI;
|
||||||
|
using ReallifeGamemode.Database.Entities;
|
||||||
|
using ReallifeGamemode.Server.Extensions;
|
||||||
|
using ReallifeGamemode.Server.Managers;
|
||||||
|
|
||||||
|
/**
|
||||||
* @overview Life of German Reallife - Inventory Items Cheeseburger (Cheeseburger.cs)
|
* @overview Life of German Reallife - Inventory Items Cheeseburger (Cheeseburger.cs)
|
||||||
* @author VegaZ
|
* @author VegaZ
|
||||||
* @copyright (c) 2008 - 2018 Life of German
|
* @copyright (c) 2008 - 2018 Life of German
|
||||||
@@ -6,15 +11,31 @@
|
|||||||
|
|
||||||
namespace ReallifeGamemode.Server.Inventory.Items
|
namespace ReallifeGamemode.Server.Inventory.Items
|
||||||
{
|
{
|
||||||
public class Cheeseburger : FoodItem
|
public class Cheeseburger : ConsumableItem
|
||||||
{
|
{
|
||||||
public override int Id => 103;
|
public override int Id => 103;
|
||||||
public override string Name => "Cheeseburger";
|
public override string Name => "Cheeseburger";
|
||||||
public override string Description => "Ein Burger";
|
public override string Description => "Ein Burger";
|
||||||
public override int Gewicht => 50;
|
public override int Gewicht => 120;
|
||||||
public override string Einheit => "g";
|
public override string Einheit => "g";
|
||||||
public override int HpAmount => 20;
|
public override int HpAmount => 20;
|
||||||
public override uint Object => 2240524752;
|
public override uint Object => 2240524752;
|
||||||
public override int Price => 100;
|
public override int Price => 150;
|
||||||
|
public override float Cooldown => 4000;
|
||||||
|
|
||||||
|
public override void Consume(UserItem uItem)
|
||||||
|
{
|
||||||
|
Player player = uItem.GetUser().Player;
|
||||||
|
|
||||||
|
int amountToAdd = HpAmount;
|
||||||
|
if (player.Health + amountToAdd > 100)
|
||||||
|
{
|
||||||
|
amountToAdd = 100 - player.Health;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.SafeSetHealth(player.Health + amountToAdd);
|
||||||
|
player.SendNotification("Du hast einen ~y~" + Name + " ~s~gegessen.", false);
|
||||||
|
InventoryManager.RemoveUserItem(player.GetUser(), uItem, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,39 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using GTANetworkAPI;
|
||||||
|
using ReallifeGamemode.Database.Entities;
|
||||||
|
using ReallifeGamemode.Server.Extensions;
|
||||||
|
using ReallifeGamemode.Server.Managers;
|
||||||
|
|
||||||
namespace ReallifeGamemode.Server.Inventory.Items
|
namespace ReallifeGamemode.Server.Inventory.Items
|
||||||
{
|
{
|
||||||
class Chips : FoodItem
|
internal class Chips : ConsumableItem
|
||||||
{
|
{
|
||||||
public override int Id => 100;
|
public override int Id => 100;
|
||||||
public override string Name => "Chips";
|
public override string Name => "Chips";
|
||||||
public override string Description => "Eine tüte Chips";
|
public override string Description => "Eine tüte Chips";
|
||||||
public override int Gewicht => 10;
|
public override int Gewicht => 180;
|
||||||
public override string Einheit => "g";
|
public override string Einheit => "g";
|
||||||
public override int HpAmount => 10;
|
public override int HpAmount => 5;
|
||||||
public override uint Object => 2240524752;
|
public override uint Object => 2240524752;
|
||||||
public override int Price => 20;
|
public override int Price => 5;
|
||||||
|
|
||||||
|
public override float Cooldown => 3500;
|
||||||
|
|
||||||
|
public override void Consume(UserItem uItem)
|
||||||
|
{
|
||||||
|
Player player = uItem.GetUser().Player;
|
||||||
|
|
||||||
|
int amountToAdd = HpAmount;
|
||||||
|
if (player.Health + amountToAdd > 100)
|
||||||
|
{
|
||||||
|
amountToAdd = 100 - player.Health;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.SafeSetHealth(player.Health + amountToAdd);
|
||||||
|
player.SendNotification("Du hast ~y~" + Name + " ~s~gegessen.", false);
|
||||||
|
InventoryManager.RemoveUserItem(player.GetUser(), uItem, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
/**
|
using ReallifeGamemode.Database.Entities;
|
||||||
|
|
||||||
|
/**
|
||||||
* @overview Life of German Reallife - Inventory Items Chickenburger (Chickenburger.cs)
|
* @overview Life of German Reallife - Inventory Items Chickenburger (Chickenburger.cs)
|
||||||
* @author VegaZ
|
* @author VegaZ
|
||||||
* @copyright (c) 2008 - 2018 Life of German
|
* @copyright (c) 2008 - 2018 Life of German
|
||||||
@@ -6,15 +8,22 @@
|
|||||||
|
|
||||||
namespace ReallifeGamemode.Server.Inventory.Items
|
namespace ReallifeGamemode.Server.Inventory.Items
|
||||||
{
|
{
|
||||||
public class Cocain : FoodItem
|
public class Cocain : ConsumableItem
|
||||||
{
|
{
|
||||||
public override int Id => 31;
|
public override int Id => 31;
|
||||||
public override string Name => "Kosks";
|
public override string Name => "Koks";
|
||||||
public override string Description => "Rave";
|
public override string Description => "Rave";
|
||||||
public override int Gewicht => 50;
|
public override int Gewicht => 2;
|
||||||
public override string Einheit => "g";
|
public override string Einheit => "g";
|
||||||
public override int HpAmount => 25;
|
public override int HpAmount => -5;
|
||||||
public override uint Object => 2240524752;
|
public override uint Object => 2240524752;
|
||||||
public override int Price => 0;
|
public override int Price => 0;
|
||||||
|
|
||||||
|
public override float Cooldown => throw new System.NotImplementedException();
|
||||||
|
|
||||||
|
public override void Consume(UserItem uItem)
|
||||||
|
{
|
||||||
|
//nothing
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ using ReallifeGamemode.Server.Managers;
|
|||||||
|
|
||||||
namespace ReallifeGamemode.Server.Inventory.Items
|
namespace ReallifeGamemode.Server.Inventory.Items
|
||||||
{
|
{
|
||||||
public abstract class FoodItem : IUsableItem
|
public abstract class ConsumableItem : IUsableItem
|
||||||
{
|
{
|
||||||
public abstract int HpAmount { get; }
|
public abstract int HpAmount { get; }
|
||||||
public abstract int Id { get; }
|
public abstract int Id { get; }
|
||||||
@@ -16,20 +16,21 @@ namespace ReallifeGamemode.Server.Inventory.Items
|
|||||||
public abstract string Einheit { get; }
|
public abstract string Einheit { get; }
|
||||||
public abstract uint Object { get; }
|
public abstract uint Object { get; }
|
||||||
public abstract int Price { get; }
|
public abstract int Price { get; }
|
||||||
|
public abstract float Cooldown { get; }
|
||||||
|
|
||||||
public void Use(UserItem uItem)
|
public abstract void Consume(UserItem uItem);
|
||||||
|
|
||||||
|
public bool Use(UserItem uItem)
|
||||||
{
|
{
|
||||||
Player player = uItem.GetUser().Player;
|
User user = uItem.GetUser();
|
||||||
|
if (user.Player.IsLoggedIn() && InventoryManager.itemCooldown.ContainsKey(user.Player))
|
||||||
int amountToAdd = HpAmount;
|
|
||||||
if (player.Health + amountToAdd > 100)
|
|
||||||
{
|
{
|
||||||
amountToAdd = 100 - player.Health;
|
uItem.GetUser().Player.TriggerEvent("Error", "Du kannst dieses Item nicht benutzen.");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.SafeSetHealth(player.Health + amountToAdd);
|
Consume(uItem);
|
||||||
player.SendNotification("Du hast ein/einen ~y~" + InventoryManager.GetItemById(uItem.ItemId).Name + " ~s~gegessen.", false);
|
return true;
|
||||||
InventoryManager.RemoveUserItem(player.GetUser(), uItem, 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -20,13 +20,13 @@ namespace ReallifeGamemode.Server.Inventory.Items
|
|||||||
public abstract uint Object { get; }
|
public abstract uint Object { get; }
|
||||||
public abstract int Price { get; }
|
public abstract int Price { get; }
|
||||||
|
|
||||||
public void Use(UserItem uItem)
|
public bool Use(UserItem uItem)
|
||||||
{
|
{
|
||||||
Player player = uItem.GetUser().Player;
|
Player player = uItem.GetUser().Player;
|
||||||
|
|
||||||
if (uItem.ItemId != 200)
|
if (uItem.ItemId != 200)
|
||||||
{
|
{
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
int randomNumber = random.Next(1, 5);
|
int randomNumber = random.Next(1, 5);
|
||||||
@@ -47,6 +47,7 @@ namespace ReallifeGamemode.Server.Inventory.Items
|
|||||||
}
|
}
|
||||||
player.SendNotification("Du hast ~g~" + InventoryManager.GetItemById(uItem.ItemId).Name + " ~s~verwendet.", false);
|
player.SendNotification("Du hast ~g~" + InventoryManager.GetItemById(uItem.ItemId).Name + " ~s~verwendet.", false);
|
||||||
InventoryManager.RemoveUserItem(player.GetUser(), uItem, 1);
|
InventoryManager.RemoveUserItem(player.GetUser(), uItem, 1);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -180,7 +180,6 @@ namespace ReallifeGamemode.Server.Job
|
|||||||
|
|
||||||
public void MuellmannJobBeenden(Player player)
|
public void MuellmannJobBeenden(Player player)
|
||||||
{
|
{
|
||||||
JobBase job = JobManager.GetJob(player.GetUser().JobId ?? -1);
|
|
||||||
player.TriggerEvent("SERVER:MuellmannStatusFalse");
|
player.TriggerEvent("SERVER:MuellmannStatusFalse");
|
||||||
player.TriggerEvent("SERVER:MuellmannBCSEntfernen");
|
player.TriggerEvent("SERVER:MuellmannBCSEntfernen");
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
|
|
||||||
public static Dictionary<Player, List<InventoryItem>> backpackItems { get; set; } = new Dictionary<Player, List<InventoryItem>>();
|
public static Dictionary<Player, List<InventoryItem>> backpackItems { get; set; } = new Dictionary<Player, List<InventoryItem>>();
|
||||||
public static Dictionary<Player, List<InventoryItem>> vehicleItems { get; set; } = new Dictionary<Player, List<InventoryItem>>();
|
public static Dictionary<Player, List<InventoryItem>> vehicleItems { get; set; } = new Dictionary<Player, List<InventoryItem>>();
|
||||||
|
|
||||||
|
public static Dictionary<Player, PlayerTimer> itemCooldown = new Dictionary<Player, PlayerTimer>();
|
||||||
|
|
||||||
private static Timer aTimer;
|
private static Timer aTimer;
|
||||||
|
|
||||||
public class InventoryItem
|
public class InventoryItem
|
||||||
@@ -528,11 +531,13 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
|
|
||||||
if (iItem is IUsableItem usableItemObj)
|
if (iItem is IUsableItem usableItemObj)
|
||||||
{
|
{
|
||||||
usableItemObj.Use(fItem);
|
if (usableItemObj.Use(fItem))
|
||||||
|
{
|
||||||
List<InventoryItem> items = backpackItems[player];
|
List<InventoryItem> items = backpackItems[player];
|
||||||
player.SetSharedData("backpackItems", JsonConvert.SerializeObject(items.ToArray()));
|
player.SetSharedData("backpackItems", JsonConvert.SerializeObject(items.ToArray()));
|
||||||
player.TriggerEvent("aproveUse", 1, iItem.Name);
|
player.TriggerEvent("aproveUse", 1, iItem.Name);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else player.TriggerEvent("Error", "Du kannst dieses Item nicht benutzen.");
|
else player.TriggerEvent("Error", "Du kannst dieses Item nicht benutzen.");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -168,75 +168,6 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
job.StartJobEndTimer(player);
|
job.StartJobEndTimer(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PlayerTimer_Elapsed(Player player, Vehicle veh)
|
|
||||||
{
|
|
||||||
NAPI.Task.Run(() =>
|
|
||||||
{
|
|
||||||
//Vehicle LastVehicle = player.GetData<Vehicle>("LastVehicle");
|
|
||||||
Vehicle LastVehicle = veh;
|
|
||||||
JobBase job = GetJob(player?.GetUser()?.JobId ?? -1);
|
|
||||||
if (LastVehicle == null || job == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (LastVehicle.GetServerVehicle() is JobVehicle vehJ)
|
|
||||||
{
|
|
||||||
if (LastVehicle.GetData<bool>("timerJobVehicleRespawn") == true)
|
|
||||||
{
|
|
||||||
if (vehJ.GetJob().GetUsersInJob().Contains(player))
|
|
||||||
{
|
|
||||||
if (LastVehicle != null)
|
|
||||||
{
|
|
||||||
if (job.Id != 2) //Müllman Handelt Fahrzeug respawn eigenständig
|
|
||||||
{
|
|
||||||
LastVehicle.ResetData("timerJobVehicleRespawn");
|
|
||||||
ServerVehicle sVeh = VehicleManager.GetServerVehicleFromVehicle(LastVehicle);
|
|
||||||
ServerVehicleExtensions.Spawn(sVeh, LastVehicle);
|
|
||||||
}
|
|
||||||
|
|
||||||
job.StopJob(player);
|
|
||||||
ChatService.SendMessage(player, $"~y~[JOB]~s~ Du hast deinen Job ~o~{job.Name}~s~ beendet.");
|
|
||||||
CheckPointHandle.DeleteCheckpoints(player);
|
|
||||||
if (!player.HasData("isDead") || player.GetData<bool>("isDead") == false)
|
|
||||||
{
|
|
||||||
if (player.GetUser().JobId == 1)//Taxifahrer
|
|
||||||
{
|
|
||||||
player.TriggerEvent("CLIENT:stopFare");
|
|
||||||
player.SafeTeleport(new Vector3(-628.598388671875, -2107.609130859375, 6.072586536407471));
|
|
||||||
player.Heading = (-171.50303649902344f);
|
|
||||||
}
|
|
||||||
if (player.GetUser().JobId == 2)//Müllmann
|
|
||||||
{
|
|
||||||
player.SafeTeleport(new Vector3(485.4114685058594, -2173.25, 5.918273448944092));
|
|
||||||
player.Heading = (-15.922085762023926f);
|
|
||||||
}
|
|
||||||
if (player.GetUser().JobId == 3)//Pilot
|
|
||||||
{
|
|
||||||
if (!player.HasData("PilotenBase") || player.GetData<int>("PilotenBase") == 1) //Sandyshores
|
|
||||||
{
|
|
||||||
player.SafeTeleport(new Vector3(1707.2711181640625, 3276.216064453125, 41.155494689941406));
|
|
||||||
player.Heading = (-154.65234375f);
|
|
||||||
}
|
|
||||||
if (player.HasData("PilotenBase") && player.GetData<int>("PilotenBase") == 2) //LS Airport
|
|
||||||
{
|
|
||||||
player.SafeTeleport(new Vector3(-1622.48, -3151.58, 13));
|
|
||||||
player.Heading = (48.44f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.GetUser().JobId == 4)//Busfahrer
|
|
||||||
{
|
|
||||||
player.SafeTeleport(new Vector3(-535.46, -2144.97, 5.95));
|
|
||||||
player.Heading = (57.03f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
[RemoteEvent("CLIENT:Job_StopJob")]
|
[RemoteEvent("CLIENT:Job_StopJob")]
|
||||||
public void StopJob(Player player)
|
public void StopJob(Player player)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
|
using ReallifeGamemode.Server.Inventory.Interfaces;
|
||||||
|
|
||||||
namespace ReallifeGamemode.Server.Util
|
namespace ReallifeGamemode.Server.Util
|
||||||
{
|
{
|
||||||
@@ -10,9 +11,12 @@ namespace ReallifeGamemode.Server.Util
|
|||||||
{
|
{
|
||||||
private readonly Player player;
|
private readonly Player player;
|
||||||
private readonly Vehicle veh;
|
private readonly Vehicle veh;
|
||||||
|
private readonly IUsableItem usableItem;
|
||||||
private readonly Timer timer;
|
private readonly Timer timer;
|
||||||
|
public readonly DateTime startTime;
|
||||||
|
|
||||||
public delegate void PlayerTimerElapsed(Player player, Vehicle veh);
|
public delegate void PlayerTimerElapsed(Player player, Vehicle veh);
|
||||||
|
|
||||||
public event PlayerTimerElapsed Elapsed;
|
public event PlayerTimerElapsed Elapsed;
|
||||||
|
|
||||||
public PlayerTimer(Player player, Vehicle veh = null, int milliseconds = 1000)
|
public PlayerTimer(Player player, Vehicle veh = null, int milliseconds = 1000)
|
||||||
@@ -25,6 +29,17 @@ namespace ReallifeGamemode.Server.Util
|
|||||||
this.timer.Start();
|
this.timer.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PlayerTimer(Player player, IUsableItem usableItem, int milliseconds = 1000)
|
||||||
|
{
|
||||||
|
this.player = player;
|
||||||
|
this.usableItem = usableItem;
|
||||||
|
this.startTime = DateTime.Now;
|
||||||
|
|
||||||
|
this.timer = new Timer(milliseconds);
|
||||||
|
this.timer.Elapsed += Timer_Elapsed;
|
||||||
|
this.timer.Start();
|
||||||
|
}
|
||||||
|
|
||||||
private void Timer_Elapsed(object sender, ElapsedEventArgs e)
|
private void Timer_Elapsed(object sender, ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
Elapsed?.Invoke(player, veh);
|
Elapsed?.Invoke(player, veh);
|
||||||
|
|||||||
Reference in New Issue
Block a user