public async Task CharacterSelectedSpawnPlace(ClassicPlayer client, string spawnstr, string charcid) { if (client == null || !client.Exists || spawnstr == null || charcid == null) { return; } Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); int charid = Convert.ToInt32(charcid); if (charid <= 0) { return; } string charName = Characters.GetCharacterName(charid); await User.SetPlayerOnline(client, charid); //Online Feld = CharakterID client.CharacterId = charid; if (Characters.GetCharacterFirstJoin(charid) && Characters.GetCharacterFirstSpawnPlace(client, charid) == "unset") { Characters.SetCharacterFirstSpawnPlace(client, charid, spawnstr); CharactersInventory.AddCharacterItem(charid, "Bargeld", 10000, "inventory"); CharactersInventory.AddCharacterItem(charid, "Tasche", 1, "inventory"); Characters.SetCharacterBackpack(client, "Tasche"); CharactersInventory.AddCharacterItem(charid, "Sandwich", 3, "backpack"); //ToDo: Trinken hinzufuegen CharactersInventory.AddCharacterItem(charid, "Tablet", 1, "inventory"); CharactersInventory.AddCharacterItem(charid, "Smartphone", 1, "inventory"); switch (spawnstr) { case "lsairport": Characters.CreateCharacterLastPos(charid, Constants.Positions.SpawnPos_Airport, 0); break; case "beach": Characters.CreateCharacterLastPos(charid, Constants.Positions.SpawnPos_Beach, 0); break; case "sandyshores": Characters.CreateCharacterLastPos(charid, Constants.Positions.SpawnPos_SandyShores, 0); break; case "paletobay": Characters.CreateCharacterLastPos(charid, Constants.Positions.SpawnPos_PaletoBay, 0); break; case null: Characters.CreateCharacterLastPos(charid, Constants.Positions.SpawnPos_Airport, 0); break; } } if (Characters.GetCharacterGender(charid)) { client.Model = 0x9C9EFFD8; } else { client.Model = 0x705E61F2; } client.EmitLocked("Client:ServerBlips:LoadAllBlips", ServerBlips.GetAllServerBlips()); client.EmitLocked("Client:ServerMarkers:LoadAllMarkers", ServerBlips.GetAllServerMarkers()); client.EmitLocked("Client:SpawnArea:setCharSkin", Characters.GetCharacterSkin("facefeatures", charid), Characters.GetCharacterSkin("headblendsdata", charid), Characters.GetCharacterSkin("headoverlays", charid)); Position dbPos = Characters.GetCharacterLastPosition(charid); client.Position = dbPos; client.Spawn(dbPos, 0); client.Dimension = Characters.GetCharacterLastDimension(charid); client.Health = (ushort)(Characters.GetCharacterHealth(charid) + 100); client.Armor = (ushort)Characters.GetCharacterArmor(charid); HUDHandler.CreateHUDBrowser(client); //HUD erstellen WeatherHandler.SetRealTime(client); //Echtzeit setzen Characters.SetCharacterCorrectClothes(client); Characters.SetCharacterLastLogin(charid, DateTime.Now); Characters.SetCharacterCurrentFunkFrequence(charid, null); Alt.Log($"Eingeloggt {client.Name}"); Alt.Emit("PlayerLoggedIn", client); client.EmitLocked("SaltyChat_OnConnected"); if (Characters.IsCharacterUnconscious(charid)) { DeathHandler.openDeathscreen(client); } if (Characters.IsCharacterFastFarm(charid)) { var fastFarmTime = Characters.GetCharacterFastFarmTime(charid) * 60000; client.EmitLocked("Client:Inventory:PlayEffect", "DrugsMichaelAliensFight", fastFarmTime); HUDHandler.SendNotification(client, 2, 2000, $"Du bist durch dein Koks noch {fastFarmTime} Minuten effektiver."); } ServerAnimations.RequestAnimationMenuContent(client); if (Characters.IsCharacterPhoneEquipped(charid) && CharactersInventory.ExistCharacterItem(charid, "Smartphone", "inventory") && CharactersInventory.GetCharacterItemAmount(charid, "Smartphone", "inventory") > 0) { client.EmitLocked("Client:Smartphone:equipPhone", true, Characters.GetCharacterPhonenumber(charid), Characters.IsCharacterPhoneFlyModeEnabled(charid)); Characters.SetCharacterPhoneEquipped(charid, true); } else if (!Characters.IsCharacterPhoneEquipped(charid) || !CharactersInventory.ExistCharacterItem(charid, "Smartphone", "inventory") || CharactersInventory.GetCharacterItemAmount(charid, "Smartphone", "inventory") <= 0) { client.EmitLocked("Client:Smartphone:equipPhone", false, Characters.GetCharacterPhonenumber(charid), Characters.IsCharacterPhoneFlyModeEnabled(charid)); Characters.SetCharacterPhoneEquipped(charid, false); } SmartphoneHandler.RequestLSPDIntranet(client); await setCefStatus(client, false); AltAsync.Do(() => { client.SetStreamSyncedMetaData("sharedUsername", $"{charName} ({Characters.GetCharacterAccountId(charid)})"); client.SetSyncedMetaData("ADMINLEVEL", client.AdminLevel()); client.SetSyncedMetaData("PLAYER_SPAWNED", true); }); if (Characters.IsCharacterInJail(charid)) { HUDHandler.SendNotification(client, 1, 2500, $"Du befindest dich noch {Characters.GetCharacterJailTime(charid)} Minuten im Gefängnis.", 8000); client.Position = new Position(1691.4594f, 2565.7056f, 45.556763f); if (Characters.GetCharacterGender(charid) == false) { client.EmitLocked("Client:SpawnArea:setCharClothes", 11, 5, 0); client.EmitLocked("Client:SpawnArea:setCharClothes", 3, 5, 0); client.EmitLocked("Client:SpawnArea:setCharClothes", 4, 7, 15); client.EmitLocked("Client:SpawnArea:setCharClothes", 6, 7, 0); client.EmitLocked("Client:SpawnArea:setCharClothes", 8, 1, 88); } else { } } client.updateTattoos(); stopwatch.Stop(); if (stopwatch.Elapsed.Milliseconds > 30) { Alt.Log($"{charid} - CharacterSelectedSpawnPlace benötigte {stopwatch.Elapsed.Milliseconds}ms"); } await Task.Delay(5000); Model.ServerTattoos.GetAllTattoos(client); }
public override ushort GetId(IntPtr entityPointer) { return(AltAsync.Do(() => Player.GetId(entityPointer)).Result); }
public override void OnStart() { //var benchmarkRunner = new BenchmarkRunner(); //benchmarkRunner.Run(); long currentTraceSize = 0; AltTrace.OnTraceFileSizeChange += size => { currentTraceSize = size; }; Alt.OnConsoleCommand += (name, args) => { Console.WriteLine("Command name: " + name); foreach (var arg in args) { Console.WriteLine("arg:" + arg); } switch (name) { case "trace_start": if (args.Length != 1) { Console.WriteLine("trace_start {name}"); return; } AltTrace.Start(args[0]); break; case "trace_stop": AltTrace.Stop(); break; case "trace_size": Console.WriteLine("trace file size: " + currentTraceSize + " bytes"); break; } }; Alt.OnServer <object[]>("array_test", objects => { Console.WriteLine("count:" + objects.Length); Console.WriteLine("1:" + objects[0]); Console.WriteLine("3:" + objects[1]); Console.WriteLine("2:" + ((object[])objects[2]).Length); Console.WriteLine("2:" + string.Join(",", objects[1])); Console.WriteLine("2:" + ((object[])objects[2])[0]); }); Alt.Emit("array_test", new object[] { new object[] { "test", "test4", new[] { 1337 } } }); Alt.OnServer <object[]>("array_test2", objects => { Console.WriteLine("count2:" + objects.Length); Console.WriteLine("count3:" + ((object[])objects[0])[0]); }); Alt.Emit("array_test2", new object[] { new object[] { new object[] { 1337 } } }); var mValues = new MValueConst[1]; var mInnerValues = new MValueConst[1]; Alt.Core.CreateMValueInt(out mInnerValues[0], 5); Alt.Core.CreateMValueList(out mValues[0], mInnerValues, 1); Alt.Core.CreateMValueList(out var mValueList, mValues, 1); var mValuesListGet = mValueList.GetList(); for (var i = 0; i < mValuesListGet.Length; i++) { Console.WriteLine("val: " + mValuesListGet[i]); mValuesListGet[i].Dispose(); } Alt.RegisterMValueAdapter(new ConvertibleObject.ConvertibleObjectAdapter()); Alt.OnServer("convertible_test", delegate(ConvertibleObject convertible) { Console.WriteLine("convertible_test received"); Console.WriteLine(convertible.Test); foreach (var t in convertible.List) { Console.WriteLine("-" + t.Test); } }); var convertibleObject = new ConvertibleObject(); /*var writer = new MValueWriter2(); * convertibleObject.GetAdapter().ToMValue(convertibleObject, writer); * writer.ToMValue(out var mValueFromConvertible); * foreach (var entry in mValueFromConvertible.GetDictionary()) * { * Console.WriteLine("key="+ entry.Key + " =" + entry.Value.type); * entry.Value.Dispose(); * }*/ //Console.WriteLine("obj:" + mValueFromConvertible.type + " " + mValueFromConvertible.nativePointer); //mValueFromConvertible.Dispose(); Alt.Emit("convertible_test", convertibleObject); Alt.OnServer <string>("test", s => { Alt.Log("test=" + s); }); //Alt.OnServer<object[]>("test", args => { Alt.Log("args=" + args[0]); }); Alt.Emit("test", "bla"); Alt.OnServer("bla", bla); Alt.OnServer <string>("bla2", bla2); Alt.OnServer <string, bool>("bla3", bla3); Alt.OnServer <string, string>("bla4", bla4); Alt.OnServer <IMyVehicle>("vehicleTest", myVehicle => { Console.WriteLine("inside invoke"); Alt.Log("myData: " + myVehicle?.MyData); Console.WriteLine("inside invoke2"); }); Console.WriteLine("vehicleTestDone"); Alt.OnPlayerConnect += OnPlayerConnect; Alt.OnPlayerDisconnect += OnPlayerDisconnect; AltAsync.OnPlayerDisconnect += OnPlayerDisconnectAsync; Alt.OnPlayerRemove += OnPlayerRemove; Alt.OnVehicleRemove += OnVehicleRemove; AltAsync.OnPlayerConnect += OnPlayerConnectAsync; Alt.OnConsoleCommand += (name, args) => { }; Alt.OnPlayerEvent += (player, name, args) => { Alt.Log("event:" + name); }; AltAsync.OnPlayerEvent += (player, name, args) => { AltAsync.Log("event:" + name); return(Task.CompletedTask); }; AltAsync.OnServer <object[]>("bla", async args => { await AltAsync.Do(() => Alt.Log("bla with no args:" + args.Length)); }); Alt.Emit("bla"); var blip = Alt.CreateBlip(BlipType.Area, Position.Zero); blip.Color = 1; var checkpoint = Alt.CreateCheckpoint(CheckpointType.Cyclinder, Position.Zero, 1f, 1f, Rgba.Zero); Alt.Log(checkpoint.Color.ToString()); var voiceChannel = Alt.CreateVoiceChannel(true, 10f); Alt.Log(voiceChannel.MaxDistance.ToString("R")); var vehicle = Alt.CreateVehicle(VehicleModel.Apc, new Position(1, 2, 3), new Rotation(1, 2, 3)); vehicle.SetSyncedMetaData("test", 123); Alt.Log(vehicle.Position.ToString()); /*var watch = System.Diagnostics.Stopwatch.StartNew(); * for (int i = 0; i < int.MaxValue; i++) * { * vehicle.PrimaryColor = (i % 2 == 0) ? (byte) 1 : (byte) 0; * } * watch.Stop(); * var elapsedMs = watch.Elapsed; * Console.WriteLine("primaryColor took " + elapsedMs);*/ vehicle.NumberplateText = "AltV-C#"; vehicle.NumberplateIndex = 2; vehicle.SetMod(0, 0); vehicle.GetMod(0); vehicle.GetModsCount(0); vehicle.Dimension = 0; vehicle.LockState = VehicleLockState.Locked; vehicle.PrimaryColorRgb = new Rgba { R = 1, G = 8, B = 7, A = 0 }; var(x, y, z) = vehicle.GetPosition(); vehicle.SetPosition(1, 1, 1); vehicle.SetPosition((x, y, z)); var tuple = vehicle.GetPosition(); vehicle.SetPosition(tuple); Task.Factory.StartNew(() => AltAsync.CreateVehicleBuilder(VehicleModel.Apc, new Position(1, 2, 3), new Rotation(1, 2, 3)) .PrimaryColorRgb(Color.GreenYellow) .SecondaryColor(24) .NumberplateText("C#") .LockState(VehicleLockState.Locked) .Build() ); Alt.Log("ptr:" + vehicle.NativePointer); Alt.Log("number-plate:" + vehicle.NumberplateText + " " + vehicle.NumberplateIndex); Alt.Emit("vehicleTest", vehicle); Alt.OnServer("event_name", delegate(string s, string s1, long i1, string[] arg3, object[] arg4, IMyVehicle arg5, Dictionary <string, object> arg6, IMyVehicle[] myVehicles, string probablyNull, string[] nullArray, Dictionary <string, double> bla) { Alt.Log("param1:" + s); Alt.Log("param2:" + s1); Alt.Log("bla:" + ((object[])arg4[1])[0]); Alt.Log("myData-2: " + arg5.Position.X + " " + arg5.MyData); Alt.Log("myData-4-veh-array: " + myVehicles[0].Position.X + " " + myVehicles[0].MyData); Alt.Log("myData-3: " + arg6["test"]); Alt.Log("null?" + (probablyNull == null ? "y" : "n")); Alt.Log("null2?" + (nullArray[0] == null ? "y" : "n")); Alt.Log("bla2:" + bla["test"]); }); Alt.OnServer <object[]>("entity-array-obj", delegate(object[] myVehicles) { Alt.Log("entity-array-obj: " + ((MyVehicle)myVehicles[0]).Position.X + " " + ((MyVehicle)myVehicles[0]).MyData); }); AltAsync.OnServer("event_name", async delegate(string s, string s1, long i1, string[] arg3, object[] arg4, IMyVehicle arg5, Dictionary <string, object> arg6, IMyVehicle[] myVehicles, string probablyNull, string[] nullArray, Dictionary <string, double> bla) { await Task.Delay(500); await AltAsync.CreateVehicle(VehicleModel.Apc, Position.Zero, new Rotation(1, 2, 3)); AltAsync.Log("async-param1:" + s); AltAsync.Log("async-param2:" + s1); AltAsync.Log("async-bla:" + ((object[])arg4[1])[0]); AltAsync.Log("exists:" + arg5.Exists); AltAsync.Log("async-myData-2: " + arg5.Position.X + " " + arg5.MyData); AltAsync.Log("async-myData-4: " + myVehicles[0].Position.X + " " + myVehicles[0].MyData); AltAsync.Log("async-myData-3: " + arg6["test"]); AltAsync.Log("async-null?" + (probablyNull == null ? "y" : "n")); AltAsync.Log("async-null2?" + (nullArray[0] == null ? "y" : "n")); AltAsync.Log("async-bla2:" + bla["test"]); }); Alt.Emit("event_name", "param_string_1", "param_string_2", 1, new[] { "array_1", "array_2" }, new object[] { "test", new[] { 1337 } }, vehicle, new Dictionary <string, object> { ["test"] = "test" //, //["test2"] = new Dictionary<string, long> {["test"] = 1}, //["test3"] = new Dictionary<string, long> {["test"] = 42} }, new[] { (IMyVehicle)vehicle }, null, new string[] { null }, new Dictionary <string, object> { ["test"] = null }); Alt.OnServer <string[]>("test_string_array", s => { Alt.Log("string-array-entry-0:" + s[0]); }); Alt.Emit("test_string_array", new object[] { new[] { "bla" } }); Alt.OnServer("function_event", delegate(Function.Func func) { var result = func("parameter1"); Alt.Log("result:" + result); }); Alt.Emit("function_event", Function.Create(Alt.Core, delegate(string bla) { Console.WriteLine(bla + " " + (bla == null)); Alt.Log("parameter=" + bla); return(42); })); Alt.OnServer("function_event_action", delegate(Function.Func func) { var result = func("parameter1"); Alt.Log("result:" + result); }); Alt.Emit("function_event_action", Function.Create(Alt.Core, delegate(string bla) { Console.WriteLine(bla + " " + (bla == null)); Alt.Log("parameter=" + bla); })); foreach (var pl in Alt.GetAllPlayers()) { Alt.Log("player:" + pl.Position.X + " " + pl.Position.Y + " " + pl.Position.Z); } foreach (var veh in Alt.GetAllVehicles()) { Alt.Log("vehicle:" + veh.Position.X + " " + veh.Position.Y + " " + veh.Position.Z); } Alt.OnServer("1337", delegate(int int1) { Alt.Log("int1:" + int1); }); AltAsync.OnServer("1337", delegate(int int1) { Alt.Log("int1:" + int1); }); Alt.Emit("1337", 1); Alt.OnServer <IMyVehicle>("MyServerEvent3", MyServerEventHandler2, MyServerEventParser3); Alt.OnServer <IMyVehicle>("MyServerEvent3", MyServerEventHandlerAsync, MyServerEventParserAsync); Alt.Emit("MyServerEvent3", vehicle); Alt.Emit("entity-array-obj", new object[] { new[] { vehicle } }); //vehicle.Remove(); Bla(); Alt.OnClient <IPlayer, string>("MyEvent", MyEventHandler, MyParser); Alt.OnServer <string>("MyServerEvent", MyServerEventHandler, MyServerEventParser); Alt.OnServer <string>("MyServerEvent2", MyServerEventHandler, MyServerEventParser2); Alt.Emit("MyServerEvent", "test-custom-parser"); Alt.Emit("MyServerEvent2", new object[] { new[] { "test-custom-parser-array" } }); //dynamic dynamic = new ExpandoObject(); //Alt.Emit("dynamic_test", dynamic); Alt.Export("GetBla", () => { Alt.Log("GetBla called"); }); Alt.Import(Alt.Core.Resource.Name, "GetBla", out Action action); action(); Alt.Export("functionExport", delegate(string name) { Alt.Log("called with:" + name); }); Alt.Import(Alt.Core.Resource.Name, "functionExport", out Action <string> action2); action2("123"); /*if (Alt.Import("Bla", "GetBla", out Action value)) * { * value(); * }*/ Alt.Emit("none-existing-event", new WritableObject()); Alt.Emit("none-existing-event", new ConvertibleObject()); // You need to catch this with a exception because its not possible to construct a invalid entity // Remember not all vehicles you receive from events has to be constructed by this constructor when there got created from different resources ect. // But when you don't use a entity factory you can validate that by checking if the ivehicle is a imyvehicle try { IMyVehicle unused = new MyVehicle((uint)VehicleModel.Apc, new Position(1, 1, 1), new Rotation(1, 1, 1)); } catch (BaseObjectRemovedException) { } Alt.RegisterEvents(this); Alt.Emit("bla2", "bla"); AltAsync.RegisterEvents(this); Alt.Emit("asyncBla3", "bla"); Alt.OnColShape += (shape, entity, state) => { Console.WriteLine("collision shape test:" + shape + " " + shape.GetData("bla", out int id1) + " " + id1); Console.WriteLine(" " + shape + " " + shape.GetMetaData("bla", out long id2) + " " + id2 + " " + entity + " " + state); }; var colShapeCylinder = Alt.CreateColShapeCylinder(new Position(1337, 1337, 1337), 10, 10); colShapeCylinder.SetMetaData("bla", 1); colShapeCylinder.SetData("bla", 2); var colShapeCircle = Alt.CreateColShapeCircle(new Position(1337, 1337, 1337), 10); colShapeCircle.SetMetaData("bla", 3); colShapeCircle.SetData("bla", 4); AltChat.SendBroadcast("Test"); var vehicle2 = Alt.CreateVehicle(VehicleModel.Adder, new Position(1337, 1337, 1337), Rotation.Zero); Alt.OnServer <IVehicle, VehicleModel>("onEnum", OnEnum); Alt.Emit("onEnum", vehicle2, VehicleModel.Adder.ToString()); Alt.OnServer("EmptyParams", TestEmptyParams); Alt.Emit("EmptyParams", 1, 2, 3); Alt.Emit("chat:message", "/dynamicArgs2 7"); Alt.Emit("chat:message", "/dynamicArgs2 7 5 test"); Alt.Emit("chat:message", "bla"); Alt.Emit("chat:message", "/bla"); Alt.Emit("chat:message", "/bla 5"); Alt.Emit("chat:message", "/bla2 3223"); Alt.Emit("chat:message", "/bla3 3535"); Alt.Emit("chat:message", "/invalidCommand"); Alt.Emit("chat:message", "/invalidCommand 3535"); Alt.Emit("chat:message", "/defaultParamsCommand test"); Alt.Emit("chat:message", "/defaultParamsCommand test 5"); Alt.Emit("chat:message", "/defaultParamsCommand test 6 3"); Alt.Emit("chat:message", "/defaultParamsCommand2 test 6 3"); Alt.Emit("chat:message", "/bladyn 6"); Alt.Emit("chat:message", "/bladyn 6 test"); Alt.Emit("chat:message", "/bladyn 6 test test2"); Alt.Emit("chat:message", "/bladyn 6 test test2 test3"); Alt.OnServer <int, object[]>("onOptionalAndParamArray", OnOptionalAndParamArray); Alt.Emit("onOptionalAndParamArray", 5, 42, "test"); Alt.CreateCheckpoint(CheckpointType.Cyclinder, Position.Zero, 50f, 50f, Rgba.Zero); var vehicle5 = Alt.CreateVehicle(VehicleModel.Adder, Position.Zero, Rotation.Zero); Alt.Emit("eventNameWithEntity", null, vehicle5); }
public async Task DoGarageAction(IPlayer player, int garageid, string action, int vehID) { try { if (player == null || !player.Exists || action == "" || vehID <= 0 || garageid <= 0) { return; } Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); int charId = User.GetPlayerOnline(player); if (charId <= 0) { return; } var vehicle = Alt.Server.GetVehicles().ToList().FirstOrDefault(x => x.GetVehicleId() == (ulong)vehID); if (action == "storage") { //Fahrzeug einparken if (vehicle == null) { return; } if (!vehicle.Position.IsInRange(player.Position, 50f)) { return; } //var gData = ServerGarages.ServerGarageSlots_.FirstOrDefault(x => vehicle.Position.IsInRange(new Position(x.posX, x.posY, x.posZ), 15f) && x.garageId == garageid); //Position garagePos = new Position(gData.posX, gData.posY, gData.posZ); //Alt.Log($"StorageVeh: {gData} - {gData.garageId} - {garagePos} - {garagePos.ToString()}"); //if (garagePos == null || garagePos == new Position(0, 0, 0)) return; ServerVehicles.SetVehicleInGarage(vehicle, true, garageid); HUDHandler.SendNotification(player, 2, 5000, $"Fahrzeug erfolgreich eingeparkt."); } else if (action == "take") { //Fahrzeug ausparken Position outPos = new Position(0, 0, 0); int curPid = 1; bool slotAreFree = true; foreach (var x in ServerGarages.ServerGarageSlots_.Where(x => x.garageId == garageid)) { foreach (var veh in Alt.Server.GetVehicles().ToList()) { if (veh.Position.IsInRange(ServerGarages.GetGarageSlotPosition(garageid, curPid), 2f)) { slotAreFree = false; curPid++; break; } else { slotAreFree = true; } } if (slotAreFree) { break; } } if (!slotAreFree) { HUDHandler.SendNotification(player, 4, 5000, $"Es ist kein Parkplatz mehr frei."); return; } if (vehicle != null) { HUDHandler.SendNotification(player, 4, 5000, $"Ein unerwarteter Fehler ist aufgetreten. [GARAGE-002]"); return; } var finalVeh = ServerVehicles.ServerVehicles_.FirstOrDefault(v => v.id == vehID); if (finalVeh == null) { HUDHandler.SendNotification(player, 4, 5000, $"Ein unerwarteter Fehler ist aufgetreten. [GARAGE-001]"); return; } var altVeh = await AltAsync.Do(() => Alt.CreateVehicle((uint)finalVeh.hash, ServerGarages.GetGarageSlotPosition(garageid, curPid), (ServerGarages.GetGarageSlotRotation(garageid, curPid)))); altVeh.LockState = VehicleLockState.Locked; altVeh.EngineOn = false; altVeh.NumberplateText = finalVeh.plate; altVeh.SetVehicleId((ulong)finalVeh.id); altVeh.SetVehicleTrunkState(false); ServerVehicles.SetVehicleModsCorrectly(altVeh); ServerVehicles.SetVehicleInGarage(altVeh, false, garageid); } if (!CharactersTablet.HasCharacterTutorialEntryFinished(charId, "useGarage")) { CharactersTablet.SetCharacterTutorialEntryState(charId, "useGarage", true); HUDHandler.SendNotification(player, 1, 2500, "Erfolg freigeschaltet: Keine Schäden"); } stopwatch.Stop(); if (stopwatch.Elapsed.Milliseconds > 30) { Alt.Log($"{charId} - DoGarageAction benötigte {stopwatch.Elapsed.Milliseconds}ms"); } } catch (Exception e) { Alt.Log($"{e}"); } }
public async Task OnPlayerDamage(IPlayer player, IEntity attacker, ushort oldHealth, ushort oldArmor, ushort oldMaxHealth, ushort oldMaxArmor, uint weapon, ushort damage) => await AltAsync.Do(() => { if (player.Health >= 150) { return; } Alt.Log("wysyłam emit z damagem"); player.EmitAsync("player-damage:drawFall"); });