Add ItemShop, fix ClotheShop Payment, fix Vehicle Respawn, Add Vehicle Lock from outside
This commit is contained in:
@@ -148,7 +148,9 @@ namespace ReallifeGamemode.Server.Events
|
||||
WeaponPoint nearestWeapon = PositionManager.WeaponPoints.Find(w => w.Position.DistanceTo(player.Position) <= 1.5 && w.FactionId == user.FactionId);
|
||||
JailReleasePoint nearestJailReleasePoint = PositionManager.JailReleasePoints.Find(j => j.Position.DistanceTo(player.Position) <= 1.5 && (user.FactionId == 1 || user.FactionId == 3) && user.GetData<bool>("duty"));
|
||||
ElevatorPoint nearestElevatorPoint = PositionManager.ElevatorPoints.Find(e => e.Position.DistanceTo(player.Position) <= 1.5 && (user.FactionId == 1 || user.FactionId == 3));
|
||||
ShopPoint nearestShopPoint = PositionManager.ShopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5 && (!user.GetData<bool>("duty")));
|
||||
ClotheshopPoint nearestClotheShopPoint = PositionManager.clotheshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5 && (!user.GetData<bool>("duty")));
|
||||
ItemshopPoint nearestItemShopPoint = PositionManager.itemshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5);
|
||||
|
||||
if (nearestDuty != null)// Duty Point
|
||||
{
|
||||
var nameTagColor = new Color(0, 0, 0);
|
||||
@@ -326,9 +328,13 @@ namespace ReallifeGamemode.Server.Events
|
||||
}
|
||||
player.TriggerEvent("showElevatorMenu", JsonConvert.SerializeObject(stages.ToArray()));
|
||||
}
|
||||
if(nearestShopPoint != null)
|
||||
if(nearestClotheShopPoint != null)
|
||||
{
|
||||
nearestShopPoint.clotheShop.LoadShopNUI(player);
|
||||
nearestClotheShopPoint.clotheShop.LoadShopNUI(player);
|
||||
}
|
||||
if(nearestItemShopPoint != null)
|
||||
{
|
||||
nearestItemShopPoint.itemShop.LoadShopNUI(player);
|
||||
}
|
||||
if (user.FactionLeader)
|
||||
{
|
||||
@@ -481,6 +487,9 @@ namespace ReallifeGamemode.Server.Events
|
||||
|
||||
if (!player.IsInVehicle)
|
||||
{
|
||||
|
||||
Vehicle.VehicleMenuLockCarEvent(player);
|
||||
|
||||
GroundItem.PickUpGroundItem(player);
|
||||
}
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
{
|
||||
CharacterCreator.ApplyCharacter(player);
|
||||
UpdateCharacterCloth.LoadCharacterDefaults(player);
|
||||
if (user.JailTime == 0)
|
||||
if (user.JailTime <= 0)
|
||||
{
|
||||
NAPI.Player.SpawnPlayer(player, new Vector3(user.PositionX, user.PositionY, user.PositionZ), 0);
|
||||
}
|
||||
|
||||
@@ -251,9 +251,10 @@ namespace ReallifeGamemode.Server.Events
|
||||
undershirt.Texture = data[5];
|
||||
}
|
||||
}
|
||||
user.Handmoney -= data[6];
|
||||
client.TriggerEvent("SERVER:SET_HANDMONEY", user.Handmoney);
|
||||
client.GetUser(dbContext).Handmoney -= data[6];
|
||||
dbContext.SaveChanges();
|
||||
client.TriggerEvent("SERVER:SET_HANDMONEY", user.Handmoney);
|
||||
|
||||
}
|
||||
client.TriggerEvent("clothesMenu:updateLast", data[2], data[1], data[4], data[5], data[3]);
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
}
|
||||
|
||||
[RemoteEvent("VehicleMenu_LockCar")]
|
||||
public void VehicleMenuLockCarEvent(Client player)
|
||||
public static void VehicleMenuLockCarEvent(Client player)
|
||||
{
|
||||
if (player.IsInVehicle && player.VehicleSeat == -1)
|
||||
{
|
||||
@@ -98,13 +98,80 @@ namespace ReallifeGamemode.Server.Events
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if(sV is JobVehicle)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (sV is SchoolVehicle)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
state = !state;
|
||||
VehicleStreaming.SetLockStatus(v, state);
|
||||
string msg = "Fahrzeug ";
|
||||
msg += state ? "~g~abgeschlossen" : "~r~aufgeschlossen";
|
||||
player.TriggerEvent("vehsync:OpenCar", state);
|
||||
player.SendNotification(msg);
|
||||
}
|
||||
else if (!player.IsInVehicle)
|
||||
{
|
||||
GTANetworkAPI.Vehicle vehicle = null;
|
||||
foreach(var veh in NAPI.Pools.GetAllVehicles())
|
||||
{
|
||||
if (player.Position.DistanceTo(veh.Position) <= 3f)
|
||||
{
|
||||
vehicle = veh;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (vehicle == null)
|
||||
return;
|
||||
User u = player.GetUser();
|
||||
if (u == null) return;
|
||||
|
||||
bool state = VehicleStreaming.GetLockState(vehicle);
|
||||
ServerVehicle sV = vehicle.GetServerVehicle();
|
||||
|
||||
if (sV != null)
|
||||
{
|
||||
if (sV is ShopVehicle)
|
||||
{
|
||||
VehicleStreaming.SetEngineState(vehicle, false);
|
||||
return;
|
||||
}
|
||||
else if (sV is FactionVehicle fV)
|
||||
{
|
||||
if (fV.FactionId != u.FactionId)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (sV is UserVehicle uV)
|
||||
{
|
||||
if (uV.UserId != u.Id)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (sV is JobVehicle)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (sV is SchoolVehicle)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
state = !state;
|
||||
VehicleStreaming.SetLockStatus(vehicle, state);
|
||||
string msg = "Fahrzeug ";
|
||||
msg += state ? "~g~abgeschlossen" : "~r~aufgeschlossen";
|
||||
player.TriggerEvent("vehsync:OpenCar", state);
|
||||
player.SendNotification(msg);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
[RemoteEvent("CLIENT:VehicleMenu_ParkCar")]
|
||||
@@ -147,6 +214,16 @@ namespace ReallifeGamemode.Server.Events
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (sV is JobVehicle)
|
||||
{
|
||||
player.SendNotification("~r~Du darfst dieses Fahrzeug nicht parken.");
|
||||
return;
|
||||
}
|
||||
else if (sV is SchoolVehicle)
|
||||
{
|
||||
player.SendNotification("~r~Du darfst dieses Fahrzeug nicht parken.");
|
||||
return;
|
||||
}
|
||||
|
||||
Vector3 pos = v.Position;
|
||||
|
||||
@@ -199,10 +276,6 @@ namespace ReallifeGamemode.Server.Events
|
||||
}
|
||||
}
|
||||
|
||||
[ServerEvent(Event.VehicleDeath)]
|
||||
public void VehicleDeathEvent(GTANetworkAPI.Vehicle veh)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user