Improved postbuild events, added freecam (F5), add check if vehicle hash is valid, improved deathscreen
This commit is contained in:
@@ -800,23 +800,15 @@ namespace reallife_gamemode.Server.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
hash = hash.ToUpper();
|
||||
uint uHash = NAPI.Util.GetHashKey(hash);
|
||||
|
||||
if (!uint.TryParse(hash, out uint vehHash))
|
||||
if(!VehicleManager.IsValidHash(uHash))
|
||||
{
|
||||
if (!Enum.TryParse(hash, true, out VehicleHash realHash))
|
||||
{
|
||||
player.SendChatMessage("~r~[FEHLER]~s~ Dieses Fahrzeug existiert nicht.");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
vehHash = (uint)realHash;
|
||||
}
|
||||
player.SendChatMessage("~r~[FEHLER]~s~ Dieses Fahrzeug existiert nicht.");
|
||||
return;
|
||||
}
|
||||
|
||||
Vehicle v = NAPI.Vehicle.CreateVehicle(vehHash, player.Position, player.Rotation.Z, color1, color2);
|
||||
|
||||
Vehicle v = NAPI.Vehicle.CreateVehicle(uHash, player.Position, player.Rotation.Z, color1, color2);
|
||||
player.SetIntoVehicle(v.Handle, -1);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,11 @@ namespace reallife_gamemode.Server.Managers
|
||||
{
|
||||
public class VehicleManager
|
||||
{
|
||||
private static readonly List<string> _enabledMods = new List<string>()
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
private static Dictionary<int, NetHandle> _serverVehicles = new Dictionary<int, NetHandle>();
|
||||
|
||||
public static void AddVehicle(ServerVehicle serverVehicle, Vehicle vehicle)
|
||||
@@ -71,5 +76,20 @@ namespace reallife_gamemode.Server.Managers
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static bool IsValidHash(uint hash)
|
||||
{
|
||||
foreach(VehicleHash vh in Enum.GetValues(typeof(VehicleHash)))
|
||||
{
|
||||
if ((uint)vh == hash) return true;
|
||||
}
|
||||
|
||||
foreach(string mod in _enabledMods)
|
||||
{
|
||||
if (NAPI.Util.GetHashKey(mod) == hash) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user