public async Task StartMiniJob(IPlayer player, int routeId) { try { if (player == null || !player.Exists || routeId <= 0) { return; } int charId = User.GetPlayerOnline(player); if (charId <= 0) { return; } if (player.GetPlayerCurrentMinijob() != "None") { return; } if (!Model.ExistRoute(routeId)) { return; } if (CharactersMinijobs.GetCharacterMinijobEXP(charId, "Busfahrer") < Model.GetRouteNeededEXP(routeId)) { HUDHandler.SendNotification(player, 3, 5000, $"Du hast nicht die benötigen EXP für diese Linie ({Model.GetRouteNeededEXP(routeId)}EXP - du hast {CharactersMinijobs.GetCharacterMinijobEXP(charId, "Busfahrer")}EXP)."); return; } foreach (var veh in Alt.Server.GetVehicles().ToList()) { if (veh == null || !veh.Exists) { continue; } if (veh.Position.IsInRange(Constants.Positions.Minijob_Busdriver_VehOutPos, 8f)) { HUDHandler.SendNotification(player, 3, 5000, "Der Ausparkpunkt ist blockiert."); return; } } ServerVehicles.CreateVehicle(Model.GetRouteVehicleHash(routeId), charId, 2, 0, false, 0, Constants.Positions.Minijob_Busdriver_VehOutPos, Constants.Positions.Minijob_Busdriver_VehOutRot, $"BUS-{charId}", 132, 132); player.SetPlayerCurrentMinijob("Busfahrer"); player.SetPlayerCurrentMinijobStep("FirstStepInVehicle"); player.SetPlayerCurrentMinijobRouteId((ulong)routeId); player.SetPlayerCurrentMinijobActionCount(1); HUDHandler.SendNotification(player, 1, 2500, "Du hast den Minijob begonnen. Wir haben dir einen Bus am Tor ausgeparkt, steige ein."); return; } catch (Exception e) { Alt.Log($"{e}"); } }
internal static void TryStartMinijob(IPlayer player) { try { if (player == null || !player.Exists || !((ClassicColshape)startJobShape).IsInRange((ClassicPlayer)player)) { return; } int charId = User.GetPlayerOnline(player); if (charId <= 0) { return; } if (player.GetPlayerCurrentMinijob() == "Pilot") { //Job abbrechen foreach (var veh in Alt.Server.GetVehicles().Where(x => x.NumberplateText == $"PL-{charId}").ToList()) { if (veh == null || !veh.Exists) { continue; } ServerVehicles.RemoveVehiclePermanently(veh); veh.Remove(); } HUDHandler.SendNotification(player, 2, 1500, "Du hast den Minijob: Pilot beendet."); player.SetPlayerCurrentMinijob("None"); player.SetPlayerCurrentMinijobRouteId(0); player.SetPlayerCurrentMinijobStep("None"); player.SetPlayerCurrentMinijobActionCount(0); return; } else if (player.GetPlayerCurrentMinijob() == "None") { //Levelauswahl anzeigen if (!CharactersMinijobs.ExistCharacterMinijobEntry(charId, "Pilot")) { CharactersMinijobs.CreateCharacterMinijobEntry(charId, "Pilot"); } player.EmitLocked("Client:MinijobPilot:openCEF"); return; } } catch (Exception e) { Alt.Log($"{e}"); } }
public async Task LSPDAppSearchLicense(IPlayer player, string targetCharname) { try { if (player == null || !player.Exists || targetCharname == "") { return; } int charId = User.GetPlayerOnline(player); if (charId <= 0) { return; } if (player.HasPlayerHandcuffs() || player.HasPlayerRopeCuffs()) { HUDHandler.SendNotification(player, 4, 5000, "Wie willst du das mit Handschellen/Fesseln machen?"); return; } if (!ServerFactions.IsCharacterInAnyFaction(charId)) { HUDHandler.SendNotification(player, 4, 5000, "Fehler: Du bist in keiner Fraktion."); return; } if (ServerFactions.GetCharacterFactionId(charId) != 2 && ServerFactions.GetCharacterFactionId(charId) != 1) { HUDHandler.SendNotification(player, 4, 5000, "Fehler: Du bist nicht im L.S.P.D. oder der Justiz angestellt."); return; } if (!ServerFactions.IsCharacterInFactionDuty(charId)) { HUDHandler.SendNotification(player, 4, 5000, "Fehler: Du bist nicht im Dienst."); return; } if (!Characters.ExistCharacterName(targetCharname)) { HUDHandler.SendNotification(player, 3, 5000, "Fehler: Der eingegebene Name wurde nicht gefunden."); return; } int targetCharId = Characters.GetCharacterIdFromCharName(targetCharname); if (targetCharId <= 0) { return; } string charName = Characters.GetCharacterName(targetCharId); string licArray = CharactersLicenses.GetCharacterLicenses(targetCharId); player.EmitLocked("Client:Tablet:SetLSPDAppLicenseSearchData", charName, licArray); HUDHandler.SendNotification(player, 2, 1500, $"Lizenzabfrage durchgeführt: {charName}."); } catch (Exception e) { Alt.Log($"{e}"); } }
private static void PlayerEnterVehicle(IVehicle vehicle, IPlayer player, byte seat) { try { if (player == null || vehicle == null || !player.Exists || !vehicle.Exists) { return; } int charId = User.GetPlayerOnline(player); if (charId <= 0) { return; } if (ServerVehicles.GetVehicleType(vehicle) != 2) { return; } if (ServerVehicles.GetVehicleOwner(vehicle) != charId) { return; } if (player.GetPlayerCurrentMinijob() != "Müllmann") { return; } if (player.GetPlayerCurrentMinijobStep() == "None") { return; } if (player.GetPlayerCurrentMinijobStep() == "FirstStepInVehicle") { HUDHandler.SendNotification(player, 1, 2500, "Fahre zum ersten Zielort um den Müll abzuholen, dieser wurde auf deinem GPS markiert."); var spot = Model.GetCharacterMinijobNextSpot(player); if (spot == null) { return; } player.SetPlayerCurrentMinijobStep("PICKUP_TRASH"); player.EmitLocked("Client:Minijob:CreateJobMarker", "Minijob: Müll abholen", 3, 514, 1, spot.posX, spot.posY, spot.posZ, false); return; } } catch (Exception e) { Alt.Log($"{e}"); } }
private static void PlayerEnterVehicle(IVehicle vehicle, IPlayer player, byte seat) { try { if (player == null || vehicle == null || !player.Exists || !vehicle.Exists) { return; } int charId = User.GetPlayerOnline(player); if (charId <= 0) { return; } if (ServerVehicles.GetVehicleType(vehicle) != 2) { return; } if (ServerVehicles.GetVehicleOwner(vehicle) != charId) { return; } if (player.GetPlayerCurrentMinijob() != "Busfahrer") { return; } if (player.GetPlayerCurrentMinijobStep() == "None") { return; } if (player.GetPlayerCurrentMinijobStep() == "FirstStepInVehicle") { var spot = Model.GetCharacterMinijobNextSpot(player); if (spot == null) { return; } HUDHandler.SendNotification(player, 1, 25000, "Fahre zur ersten Haltestelle und warte dort 10 Sekunden."); player.SetPlayerCurrentMinijobStep("DRIVE_TO_NEXT_STATION"); player.EmitLocked("Client:Minijob:CreateJobMarker", "Minijob: Haltestelle", 3, 80, 30, spot.posX, spot.posY, spot.posZ, false); return; } } catch (Exception e) { Alt.Log($"{e}"); } }
private static void PlayerEnterVehicle(IVehicle vehicle, IPlayer player, byte seat) { try { if (player == null || vehicle == null || !player.Exists || !vehicle.Exists) { return; } int charId = User.GetPlayerOnline(player); if (charId <= 0) { return; } if (ServerVehicles.GetVehicleType(vehicle) != 2) { return; } if (ServerVehicles.GetVehicleOwner(vehicle) != charId) { return; } if (player.GetPlayerCurrentMinijob() == "None") { return; } if (player.GetPlayerCurrentMinijobStep() == "None") { return; } if (player.GetPlayerCurrentMinijob() != "Pilot") { return; } if (player.GetPlayerCurrentMinijobStep() == "FirstStepInVehicle") { player.SetPlayerCurrentMinijobStep("DRIVE_TO_DESTINATION"); player.SetPlayerCurrentMinijobActionCount(1); HUDHandler.SendNotification(player, 1, 2500, "Fahre zum ersten Punkt und warte dort 15 Sekunden."); player.EmitLocked("Client:Minijob:CreateJobMarker", "Pilot: Checkpoint", 3, 514, 30, MinijobSpots_[0].depositShape.Position.X, MinijobSpots_[0].depositShape.Position.Y, MinijobSpots_[0].depositShape.Position.Z, true); return; } } catch (Exception e) { Alt.Log($"{e}"); } }
public async Task ViewBankTransactions(IPlayer player, int accNumber) { try { if (player == null || !player.Exists || accNumber <= 0) { return; } int charId = User.GetPlayerOnline(player); if (charId <= 0) { return; } if (player.HasPlayerHandcuffs() || player.HasPlayerRopeCuffs()) { HUDHandler.SendNotification(player, 3, 5000, "Wie willst du das gefesselt machen?"); return; } if (!ServerFactions.IsCharacterInAnyFaction(charId)) { HUDHandler.SendNotification(player, 3, 5000, "Du bist in keiner Fraktion."); return; } if (!ServerFactions.IsCharacterInFactionDuty(charId)) { HUDHandler.SendNotification(player, 3, 5000, "Du bist nicht im Dienst."); return; } if (ServerFactions.GetCharacterFactionId(charId) != 1) { HUDHandler.SendNotification(player, 3, 5000, "Du bist kein Angehöriger der Justiz."); return; } if (!CharactersBank.ExistBankAccountNumber(accNumber)) { HUDHandler.SendNotification(player, 3, 5000, $"Die ausgewählte Kontonummer existiert nicht ({accNumber})."); return; } var bankPapers = ServerBankPapers.GetTabletBankAccountBankPaper(accNumber); if (bankPapers == "[]" || bankPapers == "") { HUDHandler.SendNotification(player, 3, 5000, "Dieses Konto besitzt keine Transaktionen."); return; } player.EmitLocked("Client:Tablet:SetJusticeAppBankTransactions", bankPapers); } catch (Exception e) { Alt.Log($"{e}"); } }
public static void sendMsg(int fId, string msg) { try { foreach (var p in Alt.Server.GetPlayers().Where(x => x != null && x.Exists && x.GetCharacterMetaId() > 0 && IsCharacterInAnyFaction((int)x.GetCharacterMetaId()) && IsCharacterInFactionDuty((int)x.GetCharacterMetaId()) && GetCharacterFactionId((int)x.GetCharacterMetaId()) == fId).ToList()) { if (p == null || !p.Exists) { continue; } HUDHandler.SendNotification(p, 1, 2500, $"{msg}"); } } catch (Exception e) { Alt.Log($"{e}"); } }
public async Task TowVehicle(IPlayer player, IVehicle vehicle) { try { if (player == null || !player.Exists || vehicle == null || !vehicle.Exists) { return; } int charId = (int)player.GetCharacterMetaId(); int vehId = (int)vehicle.GetVehicleId(); if (charId <= 0 || player.HasPlayerRopeCuffs() || player.HasPlayerHandcuffs() || player.IsPlayerUnconscious() || !ServerFactions.IsCharacterInAnyFaction(charId) || !vehicle.Position.IsInRange(Constants.Positions.AutoClubLosSantos_StoreVehPosition, 5f) || vehId <= 0) { return; } if (ServerFactions.GetCharacterFactionId(charId) != 4) { return; } int vehClass = ServerAllVehicles.GetVehicleClass(vehicle.Model); switch (vehClass) { case 0: //Fahrzeuge ServerVehicles.SetVehicleInGarage(vehicle, true, 10); break; case 1: //Boote break; case 2: //Flugzeuge break; case 3: //Helikopter break; } ServerFactions.SetFactionBankMoney(4, ServerFactions.GetFactionBankMoney(4) + 1500); //ToDo: Anpassen HUDHandler.SendNotification(player, 2, 2000, "Fahrzeug erfolgreich verwahrt."); LoggingService.NewFactionLog(4, charId, vehId, "towVehicle", $"{Characters.GetCharacterName(charId)} hat das Fahrzeug mit der ID {vehId} abgeschleppt."); } catch (Exception e) { Alt.Log($"{e}"); } }
public static void CreateNewBank(IPlayer client, Position pos, string zoneName) { if (client == null || !client.Exists) { return; } var ServerBankData = new Server_Banks { posX = pos.X, posY = pos.Y, posZ = pos.Z, zoneName = zoneName }; try { ServerBanks_.Add(ServerBankData); using (gtaContext db = new gtaContext()) { db.Server_Banks.Add(ServerBankData); db.SaveChanges(); } HUDHandler.SendNotification(client, 2, 5000, $"Bank in der Zone ({ServerBankData.zoneName}) an deiner Position erstellt."); foreach (IPlayer player in Alt.Server.GetPlayers()) { if (player == null || !player.Exists) { return; } player.EmitLocked("Client:ServerBlips:AddNewBlip", "Bank", 2, 1, true, 605, pos.X, pos.Y, pos.Z); } } catch (Exception e) { Alt.Log($"{e}"); } }
public static void createFactionDispatch(IPlayer player, int factionId, string msg, string notificationMsg) { try { if (player == null || !player.Exists || factionId <= 0 || msg.Length <= 0) { return; } int charId = (int)player.GetCharacterMetaId(); if (charId <= 0) { return; } if (ExistDispatchBySender(charId)) { RemoveDispatchWithoutFactionId(charId); } AddNewFactionDispatch(charId, factionId, msg, player.Position); foreach (var p in Alt.Server.GetPlayers().Where(x => x != null && x.Exists && x.GetCharacterMetaId() > 0).ToList()) { if (p == null || !p.Exists) { continue; } if (!IsCharacterInAnyFaction((int)p.GetCharacterMetaId()) || !IsCharacterInFactionDuty((int)p.GetCharacterMetaId()) || GetCharacterFactionId((int)p.GetCharacterMetaId()) != factionId) { continue; } HUDHandler.SendNotification(p, 1, 3500, notificationMsg); } } catch (Exception e) { Alt.Log($"{e}"); } }
private void ColAction(IColShape colShape, IEntity targetEntity, bool state) { if (colShape == null) { return; } if (!colShape.Exists) { return; } IPlayer client = targetEntity as IPlayer; if (client == null || !client.Exists) { return; } string colshapeName = colShape.GetColShapeName(); ulong colshapeId = colShape.GetColShapeId(); if (colshapeName == "Cardealer" && state == true) { ulong vehprice = colShape.GetColshapeCarDealerVehPrice(); string vehname = colShape.GetColshapeCarDealerVehName(); HUDHandler.SendNotification(client, 1, 2500, $"Name: {vehname}<br>Preis: {vehprice}$"); return; } else if (colshapeName == "DoorShape" && state) { var doorData = ServerDoors.ServerDoors_.FirstOrDefault(x => x.id == (int)colshapeId); if (doorData == null) { return; } client.EmitLocked("Client:DoorManager:ManageDoor", doorData.hash, new Position(doorData.posX, doorData.posY, doorData.posZ), (bool)doorData.state); } }
private static void ColshapeEnterExitHandler(IColShape colShape, IEntity targetEntity, bool state) { try { if (colShape == null) { return; } if (!colShape.Exists) { return; } IPlayer client = targetEntity as IPlayer; if (client == null || !client.Exists) { return; } int charId = User.GetPlayerOnline(client); if (charId <= 0) { return; } if (colShape == startJobShape && state) { if (client.GetPlayerCurrentMinijob() == "Müllmann") { HUDHandler.SendNotification(client, 1, 2500, "Drücke E um den Müllmann Minijob zu beenden."); } else if (client.GetPlayerCurrentMinijob() == "None") { HUDHandler.SendNotification(client, 1, 2500, "Drücke E um den Müllmann Minijob zu starten."); } else if (client.GetPlayerCurrentMinijob() != "None") { HUDHandler.SendNotification(client, 3, 25000, "Du bist bereits in einem Minijob."); } return; } if (client.GetPlayerCurrentMinijob() != "Müllmann") { return; } if (client.GetPlayerCurrentMinijobRouteId() <= 0) { return; } if (client.GetPlayerCurrentMinijobActionCount() <= 0) { return; } if (client.GetPlayerCurrentMinijobStep() == "PICKUP_TRASH" && state && !client.IsInVehicle) { var spot = Model.GetCharacterMinijobNextSpot(client); if (spot == null) { return; } if (colShape != spot.destinationColshape) { return; } var personalThrowCol = Alt.GetAllColShapes().Where(x => x.Exists && x != null).ToList().FirstOrDefault(x => x != null && x.Exists && x.GetColShapeName() == "GarbageMinijobThrowInVehicle" && x.GetColShapeId() == (ulong)charId); if (personalThrowCol != null && personalThrowCol.Exists) { personalThrowCol.Remove(); } //ToDo: Objeklt in Hand geben InventoryHandler.InventoryAnimation(client, "farmPickup", 1100); var veh = Alt.Server.GetVehicles().ToList().FirstOrDefault(x => x.Exists && x.NumberplateText == $"MM-{charId}"); if (veh == null || !veh.Exists) { return; } HUDHandler.SendNotification(client, 1, 1200, "Mülltonne geleert, werfe den Müll in den Wagen."); DegreeRotation vehRot = veh.Rotation; Position MMThrowPos = veh.Position.getPositionInBackOfPosition(vehRot.Yaw, -5.5f); client.EmitLocked("Client:Minijob:RemoveJobMarker"); client.SetPlayerCurrentMinijobStep("THROW_TRASH_IN_VEHICLE"); client.EmitLocked("Client:Minijob:CreateJobMarker", "Minijob: Müll einladen", 3, 514, 22, MMThrowPos.X, MMThrowPos.Y, MMThrowPos.Z, true); ClassicColshape throwCol = (ClassicColshape)Alt.CreateColShapeSphere(MMThrowPos, 2.5f); throwCol.SetColShapeName("GarbageMinijobThrowInVehicle"); throwCol.SetColShapeId((ulong)charId); throwCol.Radius = 2.5f; return; } else if (client.GetPlayerCurrentMinijobStep() == "THROW_TRASH_IN_VEHICLE" && state && !client.IsInVehicle) { var personalThrowCol = Alt.GetAllColShapes().Where(x => x.Exists && x != null).ToList().FirstOrDefault(x => x != null && x.Exists && x.GetColShapeName() == "GarbageMinijobThrowInVehicle" && x.GetColShapeId() == (ulong)charId); if (personalThrowCol == null || !personalThrowCol.Exists) { return; } if (!((ClassicColshape)personalThrowCol).IsInRange((ClassicPlayer)client)) { return; } client.EmitLocked("Client:Minijob:RemoveJobMarker"); //ToDo: Objekt aus Hand entfernen InventoryHandler.InventoryAnimation(client, "farmPickup", 1100); int maxSpots = Model.GetMinijobGarbageMaxRouteSpots((int)client.GetPlayerCurrentMinijobRouteId()); if ((int)client.GetPlayerCurrentMinijobActionCount() < maxSpots) { //neuer Punkt client.SetPlayerCurrentMinijobActionCount(client.GetPlayerCurrentMinijobActionCount() + 1); var spot = Model.GetCharacterMinijobNextSpot(client); if (spot == null) { return; } client.SetPlayerCurrentMinijobStep("PICKUP_TRASH"); client.EmitLocked("Client:Minijob:CreateJobMarker", "Minijob: Müll abholen", 3, 514, 1, spot.posX, spot.posY, spot.posZ, false); HUDHandler.SendNotification(client, 1, 2500, "Fahre zum nächsten Zielort um den Müll abzuholen, dieser wurde auf deinem GPS markiert."); Alt.Log($"Aktueller Spot || Route: {spot.routeId} || SpotID: {spot.spotId}"); } else if ((int)client.GetPlayerCurrentMinijobActionCount() >= maxSpots) { //zurueck zum Depot HUDHandler.SendNotification(client, 1, 2222, "VERSUCH: Colshape entfernen [003]"); if (personalThrowCol != null && personalThrowCol.Exists) { personalThrowCol.Remove(); } HUDHandler.SendNotification(client, 1, 6000, "Alles aufgesammelt mein Jung. Zurück zur Mülldeponie - das Zeug abgeben, stell das Fahrzeug einfach dort ab wo du es bekommen hast."); client.SetPlayerCurrentMinijobStep("DRIVE_BACK_TO_START"); client.EmitLocked("Client:Minijob:CreateJobMarker", "Minijob: Fahrzeug abgeben", 3, 514, 30, Constants.Positions.Minijob_Müllmann_VehOutPos.X, Constants.Positions.Minijob_Müllmann_VehOutPos.Y, Constants.Positions.Minijob_Müllmann_VehOutPos.Z, false); } return; } } catch (Exception e) { Alt.Log($"{e}"); } }
private static void PlayerExitVehicle(IVehicle vehicle, IPlayer player, byte seat) { try { if (player == null || vehicle == null || !player.Exists || !vehicle.Exists) { return; } int charId = User.GetPlayerOnline(player); if (charId <= 0) { return; } if (ServerVehicles.GetVehicleType(vehicle) != 2) { return; } if (ServerVehicles.GetVehicleOwner(vehicle) != charId) { return; } if (player.GetPlayerCurrentMinijob() == "None") { return; } if (player.GetPlayerCurrentMinijobStep() == "None") { return; } if (player.GetPlayerCurrentMinijob() != "Pilot") { return; } if (player.GetPlayerCurrentMinijobStep() == "DRIVE_BACK_TO_START" && vehicle.Position.IsInRange(Constants.Positions.Minijob_Pilot_VehOutPos, 10f)) { var model = vehicle.Model; foreach (var veh in Alt.Server.GetVehicles().Where(x => x.NumberplateText == $"PL-{charId}").ToList()) { if (veh == null || !veh.Exists) { continue; } ServerVehicles.RemoveVehiclePermanently(veh); veh.Remove(); } player.SetPlayerCurrentMinijob("None"); player.SetPlayerCurrentMinijobRouteId(0); player.SetPlayerCurrentMinijobStep("None"); player.SetPlayerCurrentMinijobActionCount(0); int rnd = 0; int rndExp = 0; switch (model) { case 2621610858: //Velum rnd = new Random().Next(250, 500); rndExp = new Random().Next(1, 5); break; case 1341619767: //Vestra rnd = new Random().Next(450, 650); rndExp = new Random().Next(3, 8); break; case 2999939664: //Nimbus rnd = new Random().Next(550, 850); rndExp = new Random().Next(5, 11); break; } if (!CharactersBank.HasCharacterBankMainKonto(charId)) { HUDHandler.SendNotification(player, 3, 5000, $"Dein Gehalt i.H.v. {rnd}$ konnte nicht überwiesen werden da du kein Hauptkonto hast."); return; } int accNumber = CharactersBank.GetCharacterBankMainKonto(charId); if (accNumber <= 0) { return; } CharactersMinijobs.IncreaseCharacterMinijobEXP(charId, "Pilot", rndExp); CharactersBank.SetBankAccountMoney(accNumber, CharactersBank.GetBankAccountMoney(accNumber) + rnd); ServerBankPapers.CreateNewBankPaper(accNumber, DateTime.Now.ToString("d", CultureInfo.CreateSpecificCulture("de-DE")), DateTime.Now.ToString("t", CultureInfo.CreateSpecificCulture("de-DE")), "Eingehende Überweisung", "San Andreas Flights", "Minijob Gehalt", $"+{rnd}$", "Online Banking"); HUDHandler.SendNotification(player, 2, 5000, $"Du hast den Minijob erfolgreich abgeschlossen. Dein Gehalt i.H.v. {rnd}$ wurde dir auf dein Hauptkonto überwiesen. Du hast {rndExp}EXP dazu bekommen."); player.EmitLocked("Client:Minijob:RemoveJobMarker"); return; } } catch (Exception e) { Alt.Log($"{e}"); } }
private static async void PlayerExitVehicle(IVehicle vehicle, IPlayer player, byte seat) { try { if (player == null || !player.Exists) { return; } if (vehicle == null || !vehicle.Exists) { return; } int charId = User.GetPlayerOnline(player); if (charId <= 0) { return; } if (ServerVehicles.GetVehicleType(vehicle) != 2) { return; } if (ServerVehicles.GetVehicleOwner(vehicle) != charId) { return; } if (player.GetPlayerCurrentMinijob() != "Busfahrer") { return; } if (player.GetPlayerCurrentMinijobStep() != "DRIVE_BACK_TO_START") { return; } if (!vehicle.Position.IsInRange(Constants.Positions.Minijob_Busdriver_VehOutPos, 8f)) { return; } player.EmitLocked("Client:Minijob:RemoveJobMarker"); foreach (var veh in Alt.Server.GetVehicles().Where(x => x.NumberplateText == $"BUS-{charId}").ToList()) { if (veh == null || !veh.Exists) { continue; } ServerVehicles.RemoveVehiclePermanently(veh); await Task.Delay(5000); veh.Remove(); } int givenEXP = Model.GetRouteGivenEXP((int)player.GetPlayerCurrentMinijobRouteId()); int givenMoney = Model.GetRouteGivenMoney((int)player.GetPlayerCurrentMinijobRouteId()); player.SetPlayerCurrentMinijob("None"); player.SetPlayerCurrentMinijobStep("None"); player.SetPlayerCurrentMinijobActionCount(0); player.SetPlayerCurrentMinijobRouteId(0); CharactersMinijobs.IncreaseCharacterMinijobEXP(charId, "Busfahrer", givenEXP); if (!CharactersBank.HasCharacterBankMainKonto(charId)) { HUDHandler.SendNotification(player, 3, 5000, $"Dein Gehalt i.H.v. {givenMoney}$ konnte nicht überwiesen werden da du kein Hauptkonto hast. Du hast aber {givenEXP}EXP erhalten (du hast nun: {CharactersMinijobs.GetCharacterMinijobEXP(charId, "Busfahrer")}EXP)."); return; } int accNumber = CharactersBank.GetCharacterBankMainKonto(charId); if (accNumber <= 0) { return; } CharactersBank.SetBankAccountMoney(accNumber, CharactersBank.GetBankAccountMoney(accNumber) + givenMoney); ServerBankPapers.CreateNewBankPaper(accNumber, DateTime.Now.ToString("d", CultureInfo.CreateSpecificCulture("de-DE")), DateTime.Now.ToString("t", CultureInfo.CreateSpecificCulture("de-DE")), "Eingehende Überweisung", "Los Santos Transit", "Minijob Gehalt", $"+{givenMoney}$", "Online Banking"); HUDHandler.SendNotification(player, 2, 5000, $"Du hast den Minijob erfolgreich abgeschlossen. Dein Gehalt i.H.v. {givenMoney}$ wurde dir auf dein Hauptkonto überwiesen. Du hast {givenEXP} erhalten (deine EXP: {CharactersMinijobs.GetCharacterMinijobEXP(charId, "Busfahrer")})"); return; } catch (Exception e) { Alt.Log($"{e}"); } }
private static void PlayerEnterVehicle(IVehicle vehicle, IPlayer player, byte seat) { try { if (player == null || vehicle == null || !player.Exists || !vehicle.Exists) { return; } int charId = User.GetPlayerOnline(player); if (charId <= 0) { return; } if (ServerVehicles.GetVehicleType(vehicle) != 2) { return; } if (ServerVehicles.GetVehicleOwner(vehicle) != charId) { return; } if (player.GetPlayerCurrentMinijob() == "None") { return; } if (player.GetPlayerCurrentMinijobStep() == "None") { return; } if (player.GetPlayerCurrentMinijob() != "Elektrolieferant") { return; } if (player.GetPlayerCurrentMinijobStep() == "FirstStepInVehicle") { player.SetPlayerCurrentMinijobStep("DELIVER_TO_DESTINATION"); player.SetPlayerCurrentMinijobActionCount(1); HUDHandler.SendNotification(player, 1, 2500, "Fahre zum ersten Unternehmen um die Elektrozellen abzuliefern."); player.EmitLocked("Client:Minijob:CreateJobMarker", "Diamond Casino", 3, 514, 30, MinijobSpots_[0].pos.X, MinijobSpots_[0].pos.Y, MinijobSpots_[0].pos.Z, true); return; } else if (player.GetPlayerCurrentMinijobStep() == "DELIVER_TO_DESTINATION" && player.GetPlayerCurrentMinijobActionCount() == 2) { HUDHandler.SendNotification(player, 1, 2500, "Fahre zum nächsten Unternehmen um die Elektrozellen abzuliefern."); player.EmitLocked("Client:Minijob:CreateJobMarker", "Lifeinvader", 3, 514, 30, MinijobSpots_[1].pos.X, MinijobSpots_[1].pos.Y, MinijobSpots_[1].pos.Z, true); return; } else if (player.GetPlayerCurrentMinijobStep() == "DELIVER_TO_DESTINATION" && player.GetPlayerCurrentMinijobActionCount() == 3) { HUDHandler.SendNotification(player, 1, 2500, "Fahre zum nächsten Unternehmen um die Elektrozellen abzuliefern."); player.EmitLocked("Client:Minijob:CreateJobMarker", "Weazel News", 3, 514, 30, MinijobSpots_[2].pos.X, MinijobSpots_[2].pos.Y, MinijobSpots_[2].pos.Z, true); return; } else if (player.GetPlayerCurrentMinijobStep() == "DELIVER_TO_DESTINATION" && player.GetPlayerCurrentMinijobActionCount() == 4) { HUDHandler.SendNotification(player, 1, 2500, "Fahre zum nächsten Unternehmen um die Elektrozellen abzuliefern."); player.EmitLocked("Client:Minijob:CreateJobMarker", "Maze Bank", 3, 514, 30, MinijobSpots_[3].pos.X, MinijobSpots_[3].pos.Y, MinijobSpots_[3].pos.Z, true); return; } else if (player.GetPlayerCurrentMinijobStep() == "DELIVER_TO_DESTINATION" && player.GetPlayerCurrentMinijobActionCount() == 5) { HUDHandler.SendNotification(player, 1, 2500, "Fahre zum nächsten Unternehmen um die Elektrozellen abzuliefern."); player.EmitLocked("Client:Minijob:CreateJobMarker", "Crastenburg Hotel", 3, 514, 30, MinijobSpots_[4].pos.X, MinijobSpots_[4].pos.Y, MinijobSpots_[4].pos.Z, true); return; } else if (player.GetPlayerCurrentMinijobStep() == "DELIVER_TO_DESTINATION" && player.GetPlayerCurrentMinijobActionCount() == 6) { HUDHandler.SendNotification(player, 1, 2500, "Fahre zum nächsten Unternehmen um die Elektrozellen abzuliefern."); player.EmitLocked("Client:Minijob:CreateJobMarker", "Glass Heroes", 3, 514, 30, MinijobSpots_[5].pos.X, MinijobSpots_[5].pos.Y, MinijobSpots_[5].pos.Z, true); return; } else if (player.GetPlayerCurrentMinijobStep() == "DRIVE_BACK_TO_START") { HUDHandler.SendNotification(player, 1, 2500, "Fahre zurück zum Department of Water and Power und stelle dein Fahrzeug ab."); player.EmitLocked("Client:Minijob:CreateJobMarker", "Department of Water and Power: Fahrzeugabgabe", 3, 514, 39, Constants.Positions.Minijob_Elektrolieferant_VehOutPos.X, Constants.Positions.Minijob_Elektrolieferant_VehOutPos.Y, Constants.Positions.Minijob_Elektrolieferant_VehOutPos.Z, true); return; } } catch (Exception e) { Alt.Log($"{e}"); } }
private static void ColshapeEnterExitHandler(IColShape colShape, IEntity targetEntity, bool state) { try { if (colShape == null) { return; } if (!colShape.Exists) { return; } IPlayer client = targetEntity as IPlayer; if (client == null || !client.Exists) { return; } int charId = User.GetPlayerOnline(client); if (charId <= 0) { return; } if (colShape == startJobShape && state) { if (client.GetPlayerCurrentMinijob() == "Busfahrer") { HUDHandler.SendNotification(client, 1, 2500, "Drücke E um den Busfahrer Minijob zu beenden."); } else if (client.GetPlayerCurrentMinijob() == "None") { HUDHandler.SendNotification(client, 1, 2500, "Drücke E um den Busfahrer Minijob zu starten."); } else if (client.GetPlayerCurrentMinijob() != "None") { HUDHandler.SendNotification(client, 3, 25000, "Du bist bereits in einem Minijob."); } return; } if (client.GetPlayerCurrentMinijob() != "Busfahrer") { return; } if (client.GetPlayerCurrentMinijobRouteId() <= 0) { return; } if (client.GetPlayerCurrentMinijobActionCount() <= 0) { return; } if (client.GetPlayerCurrentMinijobStep() == "DRIVE_TO_NEXT_STATION" && state && client.IsInVehicle) { var spot = Model.GetCharacterMinijobNextSpot(client); if (spot == null) { return; } if (colShape != spot.destinationColshape) { return; } client.EmitLocked("Client:Minijob:RemoveJobMarkerWithFreeze", 10000); int maxSpots = Model.GetMinijobMaxRouteSpots((int)client.GetPlayerCurrentMinijobRouteId()); if ((int)client.GetPlayerCurrentMinijobActionCount() < maxSpots) { //neuer Punkt client.SetPlayerCurrentMinijobActionCount(client.GetPlayerCurrentMinijobActionCount() + 1); var newSpot = Model.GetCharacterMinijobNextSpot(client); if (newSpot == null) { return; } client.SetPlayerCurrentMinijobStep("DRIVE_TO_NEXT_STATION"); client.EmitLocked("Client:Minijob:CreateJobMarker", "Minijob: Haltestelle", 3, 80, 30, newSpot.posX, newSpot.posY, newSpot.posZ, false); HUDHandler.SendNotification(client, 2, 10000, "An Haltestelle angekommen, warte 10 Sekunden und fahre anschließend zur nächsten Haltestelle."); Alt.Log($"Aktueller Spot || Route: {newSpot.routeId} || SpotID: {newSpot.spotId}"); return; } else if ((int)client.GetPlayerCurrentMinijobActionCount() >= maxSpots) { //zurueck zum Depot HUDHandler.SendNotification(client, 2, 10000, "An Haltestelle angekommen, warte 10 Sekunden und fahre den Bus anschließend zurück zum Depot und stelle ihn dort ab, wo du ihn bekommen hast."); client.SetPlayerCurrentMinijobStep("DRIVE_BACK_TO_START"); client.EmitLocked("Client:Minijob:CreateJobMarker", "Minijob: Busabgabe", 3, 515, 30, Constants.Positions.Minijob_Busdriver_VehOutPos.X, Constants.Positions.Minijob_Busdriver_VehOutPos.Y, Constants.Positions.Minijob_Busdriver_VehOutPos.Z, false); return; } } } catch (Exception e) { Alt.Log($"{e}"); } }
private static async void PlayerExitVehicle(IVehicle vehicle, IPlayer player, byte seat) { try { if (player == null || vehicle == null || !player.Exists || !vehicle.Exists) { return; } int charId = User.GetPlayerOnline(player); if (charId <= 0) { return; } if (ServerVehicles.GetVehicleType(vehicle) != 2) { return; } if (ServerVehicles.GetVehicleOwner(vehicle) != charId) { return; } if (player.GetPlayerCurrentMinijob() == "None") { return; } if (player.GetPlayerCurrentMinijobStep() == "None") { return; } if (player.GetPlayerCurrentMinijob() == "Elektrolieferant" && player.GetPlayerCurrentMinijobStep() == "DELIVER_TO_DESTINATION") { if (player.GetPlayerCurrentMinijobActionCount() == 1 && vehicle.Position.IsInRange(new Position(MinijobSpots_[0].pos.X, MinijobSpots_[0].pos.Y, MinijobSpots_[0].pos.Z), 5f)) { player.EmitLocked("Client:Minijob:RemoveJobMarker"); player.EmitLocked("Client:Minijob:CreateJobMarker", "Diamond Casino", 3, 514, 1, MinijobSpots_[0].depositPos.X, MinijobSpots_[0].depositPos.Y, MinijobSpots_[0].depositPos.Z - 1, false); HUDHandler.SendNotification(player, 1, 5000, "Begebe dich zur Tür und gebe das Paket ab."); return; } else if (player.GetPlayerCurrentMinijobActionCount() == 2 && vehicle.Position.IsInRange(new Position(MinijobSpots_[1].pos.X, MinijobSpots_[1].pos.Y, MinijobSpots_[1].pos.Z), 5f)) { player.EmitLocked("Client:Minijob:RemoveJobMarker"); player.EmitLocked("Client:Minijob:CreateJobMarker", "Lifeinvader", 3, 514, 1, MinijobSpots_[1].depositPos.X, MinijobSpots_[1].depositPos.Y, MinijobSpots_[1].depositPos.Z - 1, false); HUDHandler.SendNotification(player, 1, 5000, "Begebe dich zur Tür und gebe das Paket ab."); return; } else if (player.GetPlayerCurrentMinijobActionCount() == 3 && vehicle.Position.IsInRange(new Position(MinijobSpots_[2].pos.X, MinijobSpots_[2].pos.Y, MinijobSpots_[2].pos.Z), 5f)) { player.EmitLocked("Client:Minijob:RemoveJobMarker"); player.EmitLocked("Client:Minijob:CreateJobMarker", "Weazel News", 3, 514, 1, MinijobSpots_[2].depositPos.X, MinijobSpots_[2].depositPos.Y, MinijobSpots_[2].depositPos.Z - 1, false); HUDHandler.SendNotification(player, 1, 5000, "Begebe dich zur Tür und gebe das Paket ab."); return; } else if (player.GetPlayerCurrentMinijobActionCount() == 4 && vehicle.Position.IsInRange(new Position(MinijobSpots_[3].pos.X, MinijobSpots_[3].pos.Y, MinijobSpots_[3].pos.Z), 5f)) { player.EmitLocked("Client:Minijob:RemoveJobMarker"); player.EmitLocked("Client:Minijob:CreateJobMarker", "Maze Bank", 3, 514, 1, MinijobSpots_[3].depositPos.X, MinijobSpots_[3].depositPos.Y, MinijobSpots_[3].depositPos.Z - 1, false); HUDHandler.SendNotification(player, 1, 5000, "Begebe dich zur Tür und gebe das Paket ab."); return; } else if (player.GetPlayerCurrentMinijobActionCount() == 5 && vehicle.Position.IsInRange(new Position(MinijobSpots_[4].pos.X, MinijobSpots_[4].pos.Y, MinijobSpots_[4].pos.Z), 5f)) { player.EmitLocked("Client:Minijob:RemoveJobMarker"); player.EmitLocked("Client:Minijob:CreateJobMarker", "Crastenburg Hotel", 3, 514, 1, MinijobSpots_[4].depositPos.X, MinijobSpots_[4].depositPos.Y, MinijobSpots_[4].depositPos.Z - 1, false); HUDHandler.SendNotification(player, 1, 5000, "Begebe dich zur Tür und gebe das Paket ab."); return; } else if (player.GetPlayerCurrentMinijobActionCount() == 6 && vehicle.Position.IsInRange(new Position(MinijobSpots_[5].pos.X, MinijobSpots_[5].pos.Y, MinijobSpots_[5].pos.Z), 5f)) { player.EmitLocked("Client:Minijob:RemoveJobMarker"); player.EmitLocked("Client:Minijob:CreateJobMarker", "Glass Heroes", 3, 514, 1, MinijobSpots_[5].depositPos.X, MinijobSpots_[5].depositPos.Y, MinijobSpots_[5].depositPos.Z - 1, false); HUDHandler.SendNotification(player, 1, 5000, "Begebe dich zur Tür und gebe das Paket ab."); return; } } else if (player.GetPlayerCurrentMinijob() == "Elektrolieferant" && player.GetPlayerCurrentMinijobStep() == "DRIVE_BACK_TO_START" && vehicle.Position.IsInRange(Constants.Positions.Minijob_Elektrolieferant_VehOutPos, 8f)) { player.EmitLocked("Client:Minijob:RemoveJobMarker"); foreach (var veh in Alt.Server.GetVehicles().Where(x => x.NumberplateText == $"EL-{charId}").ToList()) { if (veh == null || !veh.Exists) { continue; } ServerVehicles.RemoveVehiclePermanently(veh); veh.Remove(); } player.SetPlayerCurrentMinijob("None"); player.SetPlayerCurrentMinijobStep("None"); player.SetPlayerCurrentMinijobActionCount(0); int rnd = new Random().Next(500, 750); if (!CharactersBank.HasCharacterBankMainKonto(charId)) { HUDHandler.SendNotification(player, 3, 5000, $"Dein Gehalt i.H.v. {rnd}$ konnte nicht überwiesen werden da du kein Hauptkonto hast."); return; } int accNumber = CharactersBank.GetCharacterBankMainKonto(charId); if (accNumber <= 0) { return; } CharactersBank.SetBankAccountMoney(accNumber, CharactersBank.GetBankAccountMoney(accNumber) + rnd); ServerBankPapers.CreateNewBankPaper(accNumber, DateTime.Now.ToString("d", CultureInfo.CreateSpecificCulture("de-DE")), DateTime.Now.ToString("t", CultureInfo.CreateSpecificCulture("de-DE")), "Eingehende Überweisung", "Department of Water and Power", "Minijob Gehalt", $"+{rnd}$", "Online Banking"); HUDHandler.SendNotification(player, 2, 5000, $"Du hast den Minijob erfolgreich abgeschlossen. Dein Gehalt i.H.v. {rnd}$ wurde dir auf dein Hauptkonto überwiesen."); return; } } catch (Exception e) { Alt.Log($"{e}"); } }
public static void kickWithMessage(this IPlayer player, string reason) { HUDHandler.SendNotification(player, 3, 250000, $"Du wurdest vom Server gekickt. Grund: {reason}"); player.Kick(reason); }
private static void ColshapeEnterExitHandler(IColShape colShape, IEntity targetEntity, bool state) { try { if (colShape == null) { return; } if (!colShape.Exists) { return; } IPlayer client = targetEntity as IPlayer; if (client == null || !client.Exists) { return; } if (colShape == startJobShape && state) { if (client.GetPlayerCurrentMinijob() == "Elektrolieferant") { HUDHandler.SendNotification(client, 1, 2500, "Drücke E um den Elektrolieferanten Beruf der Firma 'Department of Water and Power' zu beenden."); } else if (client.GetPlayerCurrentMinijob() == "None") { HUDHandler.SendNotification(client, 1, 2500, "Drücke E um den Elektrolieferanten Beruf der Firma 'Department of Water and Power' zu starten."); } else if (client.GetPlayerCurrentMinijob() != "None") { HUDHandler.SendNotification(client, 3, 25000, "Du bist bereits in einem Minijob."); } return; } if (client.GetPlayerCurrentMinijob() != "Elektrolieferant") { return; } if (colShape == MinijobSpots_[0].depositColshape && state && !client.IsInVehicle) { if (client.GetPlayerCurrentMinijobStep() != "DELIVER_TO_DESTINATION" && client.GetPlayerCurrentMinijobActionCount() != 1) { return; } client.EmitLocked("Client:Minijob:RemoveJobMarker"); client.SetPlayerCurrentMinijobActionCount(2); HUDHandler.SendNotification(client, 2, 2500, "Erfolgreich abgegeben, steige wieder in dein Fahrzeug."); return; } else if (colShape == MinijobSpots_[1].depositColshape && state && !client.IsInVehicle) { if (client.GetPlayerCurrentMinijobStep() != "DELIVER_TO_DESTINATION" && client.GetPlayerCurrentMinijobActionCount() != 2) { return; } client.EmitLocked("Client:Minijob:RemoveJobMarker"); client.SetPlayerCurrentMinijobActionCount(3); HUDHandler.SendNotification(client, 2, 2500, "Erfolgreich abgegeben, steige wieder in dein Fahrzeug."); return; } else if (colShape == MinijobSpots_[2].depositColshape && state && !client.IsInVehicle) { if (client.GetPlayerCurrentMinijobStep() != "DELIVER_TO_DESTINATION" && client.GetPlayerCurrentMinijobActionCount() != 3) { return; } client.EmitLocked("Client:Minijob:RemoveJobMarker"); client.SetPlayerCurrentMinijobActionCount(4); HUDHandler.SendNotification(client, 2, 2500, "Erfolgreich abgegeben, steige wieder in dein Fahrzeug."); return; } else if (colShape == MinijobSpots_[3].depositColshape && state && !client.IsInVehicle) { if (client.GetPlayerCurrentMinijobStep() != "DELIVER_TO_DESTINATION" && client.GetPlayerCurrentMinijobActionCount() != 4) { return; } client.EmitLocked("Client:Minijob:RemoveJobMarker"); client.SetPlayerCurrentMinijobActionCount(5); HUDHandler.SendNotification(client, 2, 2500, "Erfolgreich abgegeben, steige wieder in dein Fahrzeug."); return; } else if (colShape == MinijobSpots_[4].depositColshape && state && !client.IsInVehicle) { if (client.GetPlayerCurrentMinijobStep() != "DELIVER_TO_DESTINATION" && client.GetPlayerCurrentMinijobActionCount() != 5) { return; } client.EmitLocked("Client:Minijob:RemoveJobMarker"); client.SetPlayerCurrentMinijobActionCount(6); HUDHandler.SendNotification(client, 2, 2500, "Erfolgreich abgegeben, steige wieder in dein Fahrzeug."); return; } else if (colShape == MinijobSpots_[5].depositColshape && state && !client.IsInVehicle) { if (client.GetPlayerCurrentMinijobStep() != "DELIVER_TO_DESTINATION" && client.GetPlayerCurrentMinijobActionCount() != 6) { return; } client.EmitLocked("Client:Minijob:RemoveJobMarker"); client.SetPlayerCurrentMinijobStep("DRIVE_BACK_TO_START"); client.SetPlayerCurrentMinijobActionCount(0); HUDHandler.SendNotification(client, 2, 2500, "Erfolgreich abgegeben, steige wieder in dein Fahrzeug."); return; } } catch (Exception e) { Alt.Log($"{e}"); } }
public async Task GiveLicense(IPlayer player, int targetCharId, string licShort) { try { if (player == null || !player.Exists || targetCharId <= 0 || licShort == "") { return; } int charId = User.GetPlayerOnline(player); if (charId <= 0) { return; } if (player.HasPlayerHandcuffs() || player.HasPlayerRopeCuffs()) { HUDHandler.SendNotification(player, 3, 5000, "Wie willst du das gefesselt machen?"); return; } if (!ServerFactions.IsCharacterInAnyFaction(charId)) { HUDHandler.SendNotification(player, 3, 5000, "Du bist in keiner Fraktion."); return; } if (!ServerFactions.IsCharacterInFactionDuty(charId)) { HUDHandler.SendNotification(player, 3, 5000, "Du bist nicht im Dienst."); return; } if (ServerFactions.GetCharacterFactionId(charId) != 5) { HUDHandler.SendNotification(player, 3, 5000, "Du bist kein Angehöriger der Fahrschule."); return; } var targetPlayer = Alt.Server.GetPlayers().ToList().FirstOrDefault(x => x.GetCharacterMetaId() == (ulong)targetCharId); if (targetPlayer == null || !targetPlayer.Exists) { return; } if (targetCharId != (int)targetPlayer.GetCharacterMetaId()) { return; } if (!player.Position.IsInRange(targetPlayer.Position, 5f)) { HUDHandler.SendNotification(player, 3, 5000, "Du bist zu weit entfernt."); return; } if (!CharactersLicenses.ExistServerLicense(licShort)) { HUDHandler.SendNotification(player, 3, 5000, "Ein unerwarteter Fehler ist aufgetreten."); return; } if (CharactersLicenses.HasCharacterLicense(targetCharId, licShort)) { HUDHandler.SendNotification(player, 3, 5000, "Der Spieler hat diese Lizenz bereits."); return; } if (!CharactersBank.HasCharacterBankMainKonto(targetCharId)) { HUDHandler.SendNotification(player, 3, 5000, "Der Spieler besitzt kein Hauptkonto."); return; } int accNumber = CharactersBank.GetCharacterBankMainKonto(targetCharId); int licPrice = CharactersLicenses.GetLicensePrice(licShort); if (CharactersBank.GetBankAccountLockStatus(accNumber)) { HUDHandler.SendNotification(player, 3, 5000, "Das Hauptkonto des Spielers ist gesperrt."); return; } CharactersBank.SetBankAccountMoney(accNumber, CharactersBank.GetBankAccountMoney(accNumber) - licPrice); ServerBankPapers.CreateNewBankPaper(accNumber, DateTime.Now.ToString("d", CultureInfo.CreateSpecificCulture("de-DE")), DateTime.Now.ToString("t", CultureInfo.CreateSpecificCulture("de-DE")), "Ausgehende Überweisung", "Fahrschule", $"Lizenzkauf: {CharactersLicenses.GetFullLicenseName(licShort)}", $"-{licPrice}$", "Bankeinzug"); CharactersLicenses.SetCharacterLicense(targetCharId, licShort, true); ServerFactions.SetFactionBankMoney(5, ServerFactions.GetFactionBankMoney(5) + licPrice); HUDHandler.SendNotification(player, 2, 2000, $"Sie haben dem Spieler {Characters.GetCharacterName(targetCharId)} die Lizenz '{CharactersLicenses.GetFullLicenseName(licShort)}' für eine Gebühr i.H.v. {licPrice}$ ausgestellt."); HUDHandler.SendNotification(targetPlayer, 2, 2000, $"Ihnen wurde die Lizenz '{CharactersLicenses.GetFullLicenseName(licShort)}' für eine Gebühr i.H.v. {licPrice}$ ausgestellt, diese wurde von Ihrem Hauptkonto abgebucht."); } catch (Exception e) { Alt.Log($"{e}"); } }
void Awake() { //Check if object exist in scene GameObject HUDObject = GameObject.Find("HUD"); if (HUDObject == null) { HUDObject = Instantiate (Resources.Load ("Prefabs/HUD")) as GameObject; } m_handler = HUDObject.GetComponentInChildren<HUDHandler>(); m_transitor = GameObject.Find("LoadTransitor"); if (m_transitor == null) { m_transitor = Instantiate (Resources.Load ("Prefabs/LoadTransitor")) as GameObject; DontDestroyOnLoad(m_transitor); } m_scene = m_transitor.GetComponentInChildren<SceneFadeInOut>(); m_sound = Service.Get<SoundService>(); }
private static void ColShapeEnterExitHandler(IColShape colShape, IEntity targetEntity, bool state) { try { if (colShape == null) { return; } if (!colShape.Exists) { return; } IPlayer client = targetEntity as IPlayer; if (client == null || !client.Exists) { return; } if (colShape == startJobShape && state) { if (client.GetPlayerCurrentMinijob() == "Pilot") { HUDHandler.SendNotification(client, 1, 2500, "Drücke E um den Piloten Minijob zu beenden."); } else if (client.GetPlayerCurrentMinijob() == "None") { HUDHandler.SendNotification(client, 1, 2500, "Drücke E um den Piloten Minijob zu starten."); } else if (client.GetPlayerCurrentMinijob() != "None") { HUDHandler.SendNotification(client, 3, 25000, "Du bist bereits in einem Minijob."); } return; } if (client.GetPlayerCurrentMinijob() != "Pilot") { return; } if (colShape == MinijobSpots_[0].depositShape && state && client.IsInVehicle) { if (client.GetPlayerCurrentMinijobStep() != "DRIVE_TO_DESTINATION" || client.GetPlayerCurrentMinijobActionCount() != 1) { return; } client.SetPlayerCurrentMinijobActionCount(2); client.EmitLocked("Client:Minijob:RemoveJobMarkerWithFreeze", 15000); HUDHandler.SendNotification(client, 2, 15000, "Am Checkpoint angekommen, warte 15 Sekunden - fliege anschließend zum nächsten Flughafen."); client.EmitLocked("Client:Minijob:CreateJobMarker", "Grapeseed Airport", 3, 514, 30, MinijobSpots_[1].depositShape.Position.X, MinijobSpots_[1].depositShape.Position.Y, MinijobSpots_[1].depositShape.Position.Z, true); return; } else if (colShape == MinijobSpots_[1].depositShape && state && client.IsInVehicle) { if (client.GetPlayerCurrentMinijobStep() != "DRIVE_TO_DESTINATION" || client.GetPlayerCurrentMinijobActionCount() != 2) { return; } client.EmitLocked("Client:Minijob:RemoveJobMarkerWithFreeze", 15000); client.SetPlayerCurrentMinijobActionCount(3); HUDHandler.SendNotification(client, 2, 15000, "Am Checkpoint angekommen, warte 15 Sekunden - fliege anschließend zum nächsten Flughafen."); client.EmitLocked("Client:Minijob:CreateJobMarker", "Sandy Shores Airport", 3, 514, 30, MinijobSpots_[2].depositShape.Position.X, MinijobSpots_[2].depositShape.Position.Y, MinijobSpots_[2].depositShape.Position.Z, true); return; } else if (colShape == MinijobSpots_[2].depositShape && state && client.IsInVehicle) { if (client.GetPlayerCurrentMinijobStep() != "DRIVE_TO_DESTINATION" || client.GetPlayerCurrentMinijobActionCount() != 3) { return; } client.EmitLocked("Client:Minijob:RemoveJobMarkerWithFreeze", 15000); HUDHandler.SendNotification(client, 2, 15000, "Am Checkpoint angekommen, warte 15 Sekunden - fliege anschließend zurück zum International Airport und gebe dein Flugzeug ab."); client.SetPlayerCurrentMinijobActionCount(0); client.SetPlayerCurrentMinijobStep("DRIVE_BACK_TO_START"); client.EmitLocked("Client:Minijob:CreateJobMarker", "Pilot: Flugzeugabgabe", 3, 514, 30, Constants.Positions.Minijob_Pilot_VehOutPos.X, Constants.Positions.Minijob_Pilot_VehOutPos.Y, Constants.Positions.Minijob_Pilot_VehOutPos.Z, true); return; } } catch (Exception e) { Alt.Log($"{e}"); } }
// Use this for initialization void Start() { m_enemyMgr = EnemyManager.Get(); m_battleMgr = BattleManager.Get(); m_handler = Service.Get<HUDService>().HUDControl; m_inputMgr = InputManager.Get(); // Initialize base value of player m_player = new PlayerStats(); m_player.atk = 10; m_player.hp = 100; m_player.bravebar = 0; m_skills = new Skill[3]; m_skills[0].name = "Punch"; m_skills[0].energyCost = 1; m_skills[0].dmg = 4.7f; m_skills[0].id = 1; m_skills[1].name = "Kick"; m_skills[1].energyCost = 2; m_skills[1].dmg = 9.0f; m_skills[1].id = 2; m_skills[2].name = "Strike A Pose"; m_skills[2].energyCost = 4; m_skills[2].dmg = 19.0f; m_skills[2].id = 3; //Create Skill Buttons m_camService = Service.Get<MapService>(); m_camService.Init(); if(m_handler != null) { m_handler.AddActionButton("NormalAttack", this.gameObject, m_skills[0]); m_handler.AddActionButton("NormalAttack", this.gameObject, m_skills[1]); m_handler.AddActionButton("NormalAttack", this.gameObject, m_skills[2]); m_handler.InitializeGauge((int)GAUGE.PLAYER, m_player.hp, m_player.hp, "Ellie"); } // l2dInterface.LoadProfile (); l2dInterface.GetModel ().StopBasicMotion (true); l2dInterface.PlayCombatIdleAnim (); m_soundService = Service.Get<SoundService>(); }
public async Task LSPDAppSearchPerson(IPlayer player, string targetCharname) { try { if (player == null || !player.Exists || targetCharname == "") { return; } int charId = User.GetPlayerOnline(player); if (charId <= 0) { return; } if (player.HasPlayerHandcuffs() || player.HasPlayerRopeCuffs()) { HUDHandler.SendNotification(player, 4, 5000, "Wie willst du das mit Handschellen/Fesseln machen?"); return; } if (!ServerFactions.IsCharacterInAnyFaction(charId)) { HUDHandler.SendNotification(player, 4, 5000, "Fehler: Du bist in keiner Fraktion."); return; } if (ServerFactions.GetCharacterFactionId(charId) != 2 && ServerFactions.GetCharacterFactionId(charId) != 1) { HUDHandler.SendNotification(player, 4, 5000, "Fehler: Du bist nicht im L.S.P.D. oder der Justiz angestellt."); return; } if (!ServerFactions.IsCharacterInFactionDuty(charId)) { HUDHandler.SendNotification(player, 4, 5000, "Fehler: Du bist nicht im Dienst."); return; } if (!Characters.ExistCharacterName(targetCharname)) { HUDHandler.SendNotification(player, 3, 5000, "Fehler: Der eingegebene Name wurde nicht gefunden."); return; } int targetCharId = Characters.GetCharacterIdFromCharName(targetCharname); if (targetCharId <= 0) { return; } string charName = Characters.GetCharacterName(targetCharId); string gender = "Unbekannt"; string birthdate = Characters.GetCharacterBirthdate(targetCharId); string birthplace = Characters.GetCharacterBirthplace(targetCharId); string address = $"{Characters.GetCharacterStreet(targetCharId)}"; string job = Characters.GetCharacterJob(targetCharId); string mainBankAccount = "Nicht vorhanden"; string firstJoinDate = $"{Characters.GetCharacterFirstJoinDate(targetCharId).ToString("d", CultureInfo.CreateSpecificCulture("de-DE"))}"; if (job == "None") { job = "Arbeitslos"; } if (CharactersBank.HasCharacterBankMainKonto(targetCharId)) { mainBankAccount = $"{CharactersBank.GetCharacterBankMainKonto(targetCharId)}"; } if (Characters.GetCharacterGender(targetCharId)) { gender = "Weiblich"; } else { gender = "Männlich"; } player.EmitLocked("Client:Tablet:SetLSPDAppPersonSearchData", charName, gender, birthdate, birthplace, address, job, mainBankAccount, firstJoinDate); HUDHandler.SendNotification(player, 2, 1500, $"Personenabfrage durchgeführt: {charName}."); } catch (Exception e) { Alt.Log($"{e}"); } }
public async Task StartMiniJob(IPlayer player, int level) { try { if (player == null || !player.Exists || level <= 0) { return; } int charId = User.GetPlayerOnline(player); if (charId <= 0) { return; } if (player.GetPlayerCurrentMinijob() != "None") { return; } foreach (var veh in Alt.Server.GetVehicles().ToList()) { if (veh == null || !veh.Exists) { continue; } if (veh.Position.IsInRange(Constants.Positions.Minijob_Pilot_VehOutPos, 8f)) { HUDHandler.SendNotification(player, 3, 5000, "Der Hangar ist blockiert."); return; } } switch (level) { case 1: ServerVehicles.CreateVehicle(2621610858, charId, 2, 0, false, 0, Constants.Positions.Minijob_Pilot_VehOutPos, Constants.Positions.Minijob_Pilot_VehOutRot, $"PL-{charId}", 132, 132); break; case 2: if (CharactersMinijobs.GetCharacterMinijobEXP(charId, "Pilot") < 50) { HUDHandler.SendNotification(player, 3, 5000, $"Du hast nicht die nötigen EXP für diese Stufe (50 EXP - du hast {CharactersMinijobs.GetCharacterMinijobEXP(charId, "Pilot")}EXP)."); return; } ServerVehicles.CreateVehicle(1341619767, charId, 2, 0, false, 0, Constants.Positions.Minijob_Pilot_VehOutPos, Constants.Positions.Minijob_Pilot_VehOutRot, $"PL-{charId}", 132, 132); break; case 3: if (CharactersMinijobs.GetCharacterMinijobEXP(charId, "Pilot") < 100) { HUDHandler.SendNotification(player, 3, 5000, $"Du hast nicht die nötigen EXP für diese Stufe (100 EXP - du hast {CharactersMinijobs.GetCharacterMinijobEXP(charId, "Pilot")}EXP)."); return; } ServerVehicles.CreateVehicle(2999939664, charId, 2, 0, false, 0, Constants.Positions.Minijob_Pilot_VehOutPos, Constants.Positions.Minijob_Pilot_VehOutRot, $"PL-{charId}", 132, 132); break; } player.SetPlayerCurrentMinijob("Pilot"); player.SetPlayerCurrentMinijobStep("FirstStepInVehicle"); player.SetPlayerCurrentMinijobActionCount(0); player.EmitLocked("Client:Minijob:RemoveJobMarker"); HUDHandler.SendNotification(player, 1, 2500, "Du hast den Minijob begonnen. Wir haben dir ein Flugzeug im Hangar abgestellt, steige ein."); return; } catch (Exception e) { Alt.Log($"{e}"); } }
internal static void StartMinijob(IPlayer player) { try { if (player == null || !player.Exists) { return; } if (!((ClassicColshape)startJobShape).IsInRange((ClassicPlayer)player)) { return; } int charId = User.GetPlayerOnline(player); if (charId <= 0) { return; } if (player.GetPlayerCurrentMinijob() == "Müllmann") { //Job abbrechen foreach (var veh in Alt.Server.GetVehicles().Where(x => x.NumberplateText == $"MM-{charId}").ToList()) { if (veh == null || !veh.Exists) { continue; } ServerVehicles.RemoveVehiclePermanently(veh); veh.Remove(); } var personalThrowCol = Alt.GetAllColShapes().Where(x => x.Exists && x != null).ToList().FirstOrDefault(x => x.GetColShapeName() == "GarbageMinijobThrowInVehicle" && x.GetColShapeId() == (ulong)charId); if (personalThrowCol != null && personalThrowCol.Exists) { personalThrowCol.Remove(); } HUDHandler.SendNotification(player, 2, 1500, "Du hast den Minijob: Müllmann beendet."); player.SetPlayerCurrentMinijob("None"); player.SetPlayerCurrentMinijobStep("None"); player.SetPlayerCurrentMinijobRouteId(0); player.SetPlayerCurrentMinijobActionCount(0); player.EmitLocked("Client:Minijob:RemoveJobMarker"); return; } else if (player.GetPlayerCurrentMinijob() == "None") { //Job annehmen foreach (var veh in Alt.Server.GetVehicles().ToList()) { if (veh == null || !veh.Exists) { continue; } if (veh.Position.IsInRange(Constants.Positions.Minijob_Müllmann_VehOutPos, 5f)) { HUDHandler.SendNotification(player, 3, 5000, "Der Ausparkpunkt ist belegt."); return; } } ServerVehicles.CreateVehicle(3039269212, charId, 2, 0, false, 0, Constants.Positions.Minijob_Müllmann_VehOutPos, Constants.Positions.Minijob_Müllmann_VehOutRot, $"MM-{charId}", 0, 0); var generatorId = new Random(); int routeId = generatorId.Next(1, Model.GetMinijobGarbageMaxRoutes()); player.SetPlayerCurrentMinijob("Müllmann"); player.SetPlayerCurrentMinijobStep("FirstStepInVehicle"); player.SetPlayerCurrentMinijobRouteId((ulong)routeId); player.SetPlayerCurrentMinijobActionCount(1); HUDHandler.SendNotification(player, 1, 2500, "Du hast den Minijob begonnen. Wir haben dir ein Fahrzeug zur Verfügung gestellt, steige in dies ein um zu beginnen."); Alt.Log($"Max Routes: {Model.GetMinijobGarbageMaxRoutes()}"); //2 return; } } catch (Exception e) { Alt.Log($"{e}"); } }
private static async void PlayerExitVehicle(IVehicle vehicle, IPlayer player, byte seat) { try { if (player == null || !player.Exists) { return; } if (vehicle == null || !vehicle.Exists) { return; } int charId = User.GetPlayerOnline(player); if (charId <= 0) { return; } if (ServerVehicles.GetVehicleType(vehicle) != 2) { return; } if (ServerVehicles.GetVehicleOwner(vehicle) != charId) { return; } if (player.GetPlayerCurrentMinijob() != "Müllmann") { return; } if (player.GetPlayerCurrentMinijobStep() != "DRIVE_BACK_TO_START") { return; } if (!vehicle.Position.IsInRange(Constants.Positions.Minijob_Müllmann_VehOutPos, 8f)) { return; } player.EmitLocked("Client:Minijob:RemoveJobMarker"); foreach (var veh in Alt.Server.GetVehicles().Where(x => x.NumberplateText == $"MM-{charId}").ToList()) { if (veh == null || !veh.Exists) { continue; } ServerVehicles.RemoveVehiclePermanently(veh); await Task.Delay(5000); veh.Remove(); } player.SetPlayerCurrentMinijob("None"); player.SetPlayerCurrentMinijobStep("None"); player.SetPlayerCurrentMinijobActionCount(0); player.SetPlayerCurrentMinijobRouteId(0); int rnd = new Random().Next(500, 850); if (!CharactersBank.HasCharacterBankMainKonto(charId)) { HUDHandler.SendNotification(player, 3, 5000, $"Dein Gehalt i.H.v. {rnd}$ konnte nicht überwiesen werden da du kein Hauptkonto hast."); return; } int accNumber = CharactersBank.GetCharacterBankMainKonto(charId); if (accNumber <= 0) { return; } CharactersBank.SetBankAccountMoney(accNumber, CharactersBank.GetBankAccountMoney(accNumber) + rnd); ServerBankPapers.CreateNewBankPaper(accNumber, DateTime.Now.ToString("d", CultureInfo.CreateSpecificCulture("de-DE")), DateTime.Now.ToString("t", CultureInfo.CreateSpecificCulture("de-DE")), "Eingehende Überweisung", "Arbeitgeber: Müllmann", "Minijob Gehalt", $"+{rnd}$", "Online Banking"); HUDHandler.SendNotification(player, 2, 5000, $"Du hast den Minijob erfolgreich abgeschlossen. Dein Gehalt i.H.v. {rnd}$ wurde dir auf dein Hauptkonto überwiesen."); return; } catch (Exception e) { Alt.Log($"{e}"); } }
public async Task switchTuning(IPlayer player, IVehicle vehicle, string Type, int ModType, string Action) { try { if (player == null || !player.Exists || vehicle == null || !vehicle.Exists) { return; } if (player.GetCharacterMetaId() <= 0 || vehicle.GetVehicleId() <= 0) { return; } vehicle.ModKit = 1; if (Type == "Preview") { ServerVehicles.SetVehicleModID(vehicle, Type, Action, ModType); byte modId = 0; if (ModType == 280) { modId = vehicle.HeadlightColor; } else { modId = vehicle.GetMod(Convert.ToByte(ModType)); } if (modId == 255) { modId = 0; } if (ModType == 46) { modId = vehicle.WindowTint; if (modId == 255) { modId = 0; } } else if (ModType == 132) { modId = vehicle.WheelColor; } else if (ModType == 23) { modId = vehicle.WheelVariation; } else if (ModType == 100) { modId = vehicle.PrimaryColor; } else if (ModType == 200) { modId = vehicle.SecondaryColor; } else if (ModType == 250) { modId = vehicle.PearlColor; } else if (ModType == 280) { modId = vehicle.HeadlightColor; } if (modId > 0) { if (ModType == 23) { int WheelT = vehicle.WheelType; if (WheelT == 255) { WheelT = 0; } string modName = ServerVehicles.GetVehicleModName(0, Convert.ToInt32(ModType + "" + WheelT), modId); HUDHandler.SendNotification(player, 1, 3500, $"Mod Name: {modName} | Mod-ID: {modId} | Mod-Type: {ModType}"); } else if (ModType == 46) { modId = vehicle.WindowTint; if (modId == 255) { modId = 0; } string modName = ServerVehicles.GetVehicleModName(0, 46, modId); HUDHandler.SendNotification(player, 1, 3500, $"Mod Name: {modName} | Mod-ID: {modId} | Mod-Type: {ModType}"); } else if (ModType == 11 || ModType == 12 || ModType == 13 || ModType == 14 || ModType == 15 || ModType == 22) { string modName = ServerVehicles.GetVehicleModName(0, ModType, modId); HUDHandler.SendNotification(player, 1, 3500, $"Mod Name: {modName} | Mod-ID: {modId} | Mod-Type: {ModType}"); } else if (ModType == 100) { modId = vehicle.PrimaryColor; string modName = ServerVehicles.GetVehicleModName(0, 132, modId); HUDHandler.SendNotification(player, 1, 3500, $"Mod-Name: {modName} | Mod-ID: {modId} | Mod-Type: {ModType}"); } else if (ModType == 200) { modId = vehicle.SecondaryColor; string modName = ServerVehicles.GetVehicleModName(0, 132, modId); HUDHandler.SendNotification(player, 1, 3500, $"Mod-Name: {modName} | Mod-ID: {modId}| Mod-Type: {ModType}"); } else if (ModType == 250) { modId = vehicle.PearlColor; string modName = ServerVehicles.GetVehicleModName(0, 132, modId); HUDHandler.SendNotification(player, 1, 3500, $"Mod-Name: {modName} | Mod-ID: {modId}| Mod-Type: {ModType}"); } else if (ModType == 280) { modId = vehicle.HeadlightColor; string modName = ServerVehicles.GetVehicleModName(0, 280, modId); HUDHandler.SendNotification(player, 1, 3500, $"Mod-Name: {modName} | Mod-ID: {modId}| Mod-Type: {ModType}"); } else if (ModType == 131) { modId = vehicle.WheelType; string modName = ServerVehicles.GetVehicleModName(0, 131, modId); HUDHandler.SendNotification(player, 1, 3500, $"Mod Name: {modName} | Mod-ID: {modId} | Mod-Type: {ModType}"); } else if (ModType == 132) { modId = vehicle.WheelColor; string modName = ServerVehicles.GetVehicleModName(0, 132, modId); HUDHandler.SendNotification(player, 1, 3500, $"Mod Name: {modName} | Mod-ID: {modId} | Mod-Type: {ModType}"); } else { string modName = ServerVehicles.GetVehicleModName(0, ModType, modId); HUDHandler.SendNotification(player, 1, 3500, $"Mod Name: {modName} | Mod-ID: {modId} | Mod-Type: {ModType}"); } } else if (modId <= 0) { HUDHandler.SendNotification(player, 4, 2000, $"Tuning Teil entfernt. [ModType: {ModType}]."); } } else if (Type == "Build") { ServerVehicles.SetVehicleModID(vehicle, Type, Action, ModType); int ModID = ServerVehicles.GetCurrentVehMod(vehicle, ModType); if (ModID == 255) { ModID = 0; } if (ModID > 0) { if (ModType == 23) { int WheelT = vehicle.WheelType; if (WheelT == 255) { WheelT = 0; } string modName = ServerVehicles.GetVehicleModName(0, Convert.ToInt32(ModType + "" + WheelT), ModID); HUDHandler.SendNotification(player, 1, 1500, $"Mod-Name: {modName} | Mod-ID: {ModID} | Mod-Type: {ModType}"); } else if (ModType == 46) { ModID = vehicle.WindowTint; if (ModID == 255) { ModID = 0; } string modName = ServerVehicles.GetVehicleModName(0, 46, ModID); } else if (ModType == 11 || ModType == 12 || ModType == 13 || ModType == 14 || ModType == 15 || ModType == 22) { string modName = ServerVehicles.GetVehicleModName(0, ModType, ModID); HUDHandler.SendNotification(player, 1, 1500, $"Mod-Name: {modName} | Mod-ID: {ModID} | Mod-Type: {ModType}"); } else if (ModType == 100) { ModID = vehicle.PrimaryColor; if (ModID == 255) { ModID = 0; } string modName = ServerVehicles.GetVehicleModName(0, 132, ModID); HUDHandler.SendNotification(player, 1, 1500, $"Mod-Name: {modName} | Mod-ID: {ModID} | Mod-Type: {ModType}"); } else if (ModType == 200) { ModID = vehicle.SecondaryColor; if (ModID == 255) { ModID = 0; } string modName = ServerVehicles.GetVehicleModName(0, 132, ModID); HUDHandler.SendNotification(player, 1, 1500, $"Mod-Name: {modName} | Mod-ID: {ModID} | Mod-Type: {ModType}"); } else if (ModType == 250) { ModID = vehicle.PearlColor; if (ModID == 255) { ModID = 0; } string modName = ServerVehicles.GetVehicleModName(0, 132, ModID); HUDHandler.SendNotification(player, 1, 1500, $"Mod-Name: {modName} | Mod-ID: {ModID} | Mod-Type: {ModType}"); } else if (ModType == 280) { ModID = vehicle.HeadlightColor; if (ModID == 255) { ModID = 0; } string modName = ServerVehicles.GetVehicleModName(0, 280, ModID); HUDHandler.SendNotification(player, 1, 1500, $"Mod-Name: {modName} | Mod-ID: {ModID} | Mod-Type: {ModType}"); } else if (ModType == 131) { string modName = ServerVehicles.GetVehicleModName(0, 131, ModID); HUDHandler.SendNotification(player, 1, 1500, $"Mod-Name: {modName} | Mod-ID: {ModID} | Mod-Type: {ModType}"); } else if (ModType == 132) { string modName = ServerVehicles.GetVehicleModName(0, 132, ModID); HUDHandler.SendNotification(player, 1, 1500, $"Mod-Name: {modName} | Mod-ID: {ModID} | Mod-Type: {ModType}"); } else { string modName = ServerVehicles.GetVehicleModName(vehicle.Model, ModType, ModID); HUDHandler.SendNotification(player, 1, 1500, $"Mod-Name: {modName} | Mod-ID: {ModID} | Mod-Type: {ModType}"); } } else if (ModID <= 0) { HUDHandler.SendNotification(player, 4, 2000, $"Tuning Teil entfernt. [ModType: {ModType} - ModID: {ModID}]."); } } } catch (Exception e) { Alt.Log($"{e}"); } }