Beispiel #1
0
 public async Task GiveWeaponLicense(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, 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 (!Characters.ExistCharacterName(targetCharName))
         {
             HUDHandler.SendNotification(player, 3, 5000, $"Der angegebene Name wurde nicht gefunden ({targetCharName})."); return;
         }
         int targetCharId = Characters.GetCharacterIdFromCharName(targetCharName);
         if (targetCharId <= 0)
         {
             return;
         }
         var targetPlayer = Alt.Server.GetPlayers().ToList().FirstOrDefault(x => x.GetCharacterMetaId() == (ulong)targetCharId);
         if (targetPlayer == null || !targetPlayer.Exists)
         {
             return;
         }
         if (!player.Position.IsInRange(targetPlayer.Position, 5f))
         {
             HUDHandler.SendNotification(player, 3, 5000, "Der Spieler ist nicht in Ihrer Nähe."); return;
         }
         if (CharactersLicenses.HasCharacterLicense(targetCharId, "weaponlicense"))
         {
             HUDHandler.SendNotification(player, 3, 5000, "Der Spieler hat bereits einen Waffenschein."); return;
         }
         CharactersLicenses.SetCharacterLicense(targetCharId, "weaponlicense", true);
         HUDHandler.SendNotification(player, 2, 3500, $"Sie haben dem Spieler {targetCharName} den Waffenschein erfolgreich ausgestellt.");
         HUDHandler.SendNotification(targetPlayer, 2, 3500, $"Ihnen wurde der Waffenschein erfolgreich ausgestellt.");
     }
     catch (Exception e)
     {
         Alt.Log($"{e}");
     }
 }
Beispiel #2
0
 public async Task RepairVehicle(IPlayer player, IVehicle vehicle)
 {
     try
     {
         if (player == null || !player.Exists || vehicle == null || !vehicle.Exists)
         {
             return;
         }
         int charId = (int)player.GetCharacterMetaId();
         if (charId <= 0 || player.HasPlayerRopeCuffs() || player.HasPlayerHandcuffs() || player.IsPlayerUnconscious())
         {
             return;
         }
         if (!CharactersInventory.ExistCharacterItem(charId, "Reparaturkit", "inventory") && !CharactersInventory.ExistCharacterItem(charId, "Reparaturkit", "backpack"))
         {
             HUDHandler.SendNotification(player, 4, 2000, "Du besitzt kein Reparaturkit."); return;
         }
         if (CharactersInventory.ExistCharacterItem(charId, "Reparaturkit", "inventory"))
         {
             CharactersInventory.RemoveCharacterItemAmount(charId, "Reparaturkit", 1, "inventory");
         }
         else if (CharactersInventory.ExistCharacterItem(charId, "Reparaturkit", "backpack"))
         {
             CharactersInventory.RemoveCharacterItemAmount(charId, "Reparaturkit", 1, "backpack");
         }
         //ToDo: Reparatur-Animation abspielen
         ServerVehicles.SetVehicleEngineHealthy(vehicle, true);
         Alt.EmitAllClients("Client:Utilities:repairVehicle", vehicle);
         //player.EmitLocked("Client:Utilities:repairVehicle", vehicle);
     }
     catch (Exception e)
     {
         Alt.Log($"{e}");
     }
 }
Beispiel #3
0
        public static void CreateServerPed(IPlayer client, string model, Position pos, float rotation)
        {
            if (client == null || !client.Exists)
            {
                return;
            }
            var ServerPedData = new Server_Peds
            {
                model    = model,
                posX     = pos.X,
                posY     = pos.Y,
                posZ     = pos.Z,
                rotation = rotation
            };

            try
            {
                ServerPeds_.Add(ServerPedData);

                using (gtaContext db = new gtaContext())
                {
                    db.Server_Peds.Add(ServerPedData);
                    db.SaveChanges();
                }

                HUDHandler.SendNotification(client, 2, 5000, $"Ped mit dem Model ({ServerPedData.model}) an deiner Position erstellt.");
            }
            catch (Exception e)
            {
                Alt.Log($"{e}");
            }
        }
Beispiel #4
0
        private void createnewmod(IPlayer player, string MName, int MType, int MID)
        {
            try
            {
                if (player == null || !player.Exists)
                {
                    return;
                }
                if (player.IsInVehicle)
                {
                    if (player.Vehicle == null || !player.Vehicle.Exists)
                    {
                        return;
                    }
                    uint vehHash = player.Vehicle.Model;

                    bool success = ServerVehicles.AddVehicleMods(vehHash, MName, MType, MID);
                    if (success)
                    {
                        HUDHandler.SendNotification(player, 2, 2500, $"Mod gespeichert: {vehHash} - {MName} - {MType} - {MID}");
                        Alt.Log($"Mod erfolgreich gespeichert");
                    }
                    else
                    {
                        HUDHandler.SendNotification(player, 4, 2500, $"Mod konnte nicht gespeichert werden (existiert er schon?): {vehHash} - {MName} - {MType} - {MID}");
                        Alt.Log($"FEHLER: MOD NICHT GESPEICHERT {MType} - {MID} - {MName}");
                    }
                }
            }
            catch (Exception e)
            {
                Alt.Log($"{e}");
            }
        }
Beispiel #5
0
 public async Task LSPDAppSearchVehiclePlate(IPlayer player, string targetPlate)
 {
     try
     {
         if (player == null || !player.Exists || targetPlate == "")
         {
             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 (!ServerVehicles.ExistServerVehiclePlate(targetPlate))
         {
             HUDHandler.SendNotification(player, 3, 5000, "Fehler: Das angegebene Kennzeichen wurde nicht gefunden."); return;
         }
         int vehicleId = ServerVehicles.GetVehicleIdByPlate(targetPlate);
         if (vehicleId <= 0)
         {
             return;
         }
         int ownerId = ServerVehicles.GetVehicleOwnerById(vehicleId);
         if (ownerId <= 0)
         {
             return;
         }
         string owner      = Characters.GetCharacterName(ownerId);
         string vehName    = ServerVehicles.GetVehicleNameOnHash(ServerVehicles.GetVehicleHashById(vehicleId));
         string manufactor = ServerVehicles.GetVehicleManufactorOnHash(ServerVehicles.GetVehicleHashById(vehicleId));
         string buyDate    = $"{ServerVehicles.GetVehicleBuyDate(vehicleId).ToString("d", CultureInfo.CreateSpecificCulture("de-DE"))}";
         string trunk      = $"{ServerVehicles.GetVehicleTrunkCapacityOnHash(ServerVehicles.GetVehicleHashById(vehicleId))}kg";
         string tax        = $"{ServerAllVehicles.GetVehicleTaxes(ServerVehicles.GetVehicleHashById(vehicleId))}$";
         string maxfuel    = $"{ServerVehicles.GetVehicleFuelLimitOnHash(ServerVehicles.GetVehicleHashById(vehicleId))}";
         string fuelType   = ServerVehicles.GetVehicleFuelTypeOnHash(ServerVehicles.GetVehicleHashById(vehicleId));
         player.EmitLocked("Client:Tablet:SetLSPDAppSearchVehiclePlateData", owner, vehName, manufactor, buyDate, trunk, maxfuel, tax, fuelType);
         HUDHandler.SendNotification(player, 2, 1500, $"Fahrzeugabfrage durchgeführt: {targetPlate}");
     }
     catch (Exception e)
     {
         Alt.Log($"{e}");
     }
 }
Beispiel #6
0
        internal static void StartMinijob(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() == "Elektrolieferant")
                {
                    //Job abbrechen
                    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();
                    }
                    HUDHandler.SendNotification(player, 2, 1500, "Du hast den Minijob: Elektrolieferant beendet.");
                    player.SetPlayerCurrentMinijob("None");
                    player.SetPlayerCurrentMinijobStep("None");
                    player.SetPlayerCurrentMinijobActionCount(0);
                    player.SetPlayerCurrentMinijobRouteId(0);
                    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_Elektrolieferant_VehOutPos, 5f))
                        {
                            HUDHandler.SendNotification(player, 3, 5000, "Der Ausparkpunkt links vom Haupteingang ist blockiert."); return;
                        }
                    }

                    ServerVehicles.CreateVehicle(2307837162, charId, 2, 0, false, 0, Constants.Positions.Minijob_Elektrolieferant_VehOutPos, Constants.Positions.Minijob_Elektrolieferant_VehOutRot, $"EL-{charId}", 132, 132);
                    player.SetPlayerCurrentMinijob("Elektrolieferant");
                    player.SetPlayerCurrentMinijobStep("FirstStepInVehicle");
                    HUDHandler.SendNotification(player, 1, 2500, "Du hast den Minijob begonnen. Wir haben dir ein Fahrzeug mit Energiezellen links vom Haupteingang abgestellt.");
                    return;
                }
            }
            catch (Exception e)
            {
                Alt.Log($"{e}");
            }
        }
Beispiel #7
0
 public async Task LSPDAppTakeLicense(IPlayer player, string targetCharname, string licName)
 {
     try
     {
         if (player == null || !player.Exists || targetCharname == "" || licName == "")
         {
             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)
         {
             HUDHandler.SendNotification(player, 4, 5000, "Fehler: Du bist nicht im L.S.P.D. 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;
         }
         Alt.Log($"{CharactersLicenses.GetFullLicenseName(licName)}");
         if (CharactersLicenses.GetFullLicenseName(licName) == "None")
         {
             return;
         }
         int targetCharId = Characters.GetCharacterIdFromCharName(targetCharname);
         if (targetCharId <= 0)
         {
             return;
         }
         if (!CharactersLicenses.HasCharacterLicense(targetCharId, licName))
         {
             HUDHandler.SendNotification(player, 3, 5000, "Fehler: Der Spieler hat diese Lizenz nicht mehr."); return;
         }
         CharactersLicenses.SetCharacterLicense(targetCharId, licName, false);
         HUDHandler.SendNotification(player, 2, 2000, $"{targetCharname} wurde die Lizenz {CharactersLicenses.GetFullLicenseName(licName)} entzogen.");
         LSPDAppSearchLicense(player, targetCharname);
     }
     catch (Exception e)
     {
         Alt.Log($"{e}");
     }
 }
Beispiel #8
0
 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() == "Busfahrer")
         {
             //Job abbrechen
             foreach (var veh in Alt.Server.GetVehicles().Where(x => x.NumberplateText == $"BUS-{charId}").ToList())
             {
                 if (veh == null || !veh.Exists)
                 {
                     continue;
                 }
                 ServerVehicles.RemoveVehiclePermanently(veh);
                 veh.Remove();
             }
             HUDHandler.SendNotification(player, 2, 1500, "Du hast den Minijob: Busfahrer beendet.");
             player.SetPlayerCurrentMinijob("None");
             player.SetPlayerCurrentMinijobRouteId(0);
             player.SetPlayerCurrentMinijobStep("None");
             player.SetPlayerCurrentMinijobActionCount(0);
             player.EmitLocked("Client:Minijob:RemoveJobMarker");
             return;
         }
         else if (player.GetPlayerCurrentMinijob() == "None")
         {
             //Levelauswahl anzeigen
             if (!CharactersMinijobs.ExistCharacterMinijobEntry(charId, "Busfahrer"))
             {
                 CharactersMinijobs.CreateCharacterMinijobEntry(charId, "Busfahrer");
             }
             var availableRoutes = Model.GetAvailableRoutes(charId);
             if (availableRoutes == "[]")
             {
                 return;
             }
             player.EmitLocked("Client:MinijobBusdriver:openCEF", availableRoutes);
             return;
         }
     }
     catch (Exception e)
     {
         Alt.Log($"{e}");
     }
 }
Beispiel #9
0
        public async Task RevivePlayer(IPlayer player, IPlayer targetPlayer)
        {
            try
            {
                if (player == null || !player.Exists || targetPlayer == null || !targetPlayer.Exists)
                {
                    return;
                }
                int targetId = (int)targetPlayer.GetCharacterMetaId();
                int charId   = (int)player.GetCharacterMetaId();
                if (charId <= 0 || targetId <= 0 || !Characters.IsCharacterUnconscious(targetId))
                {
                    return;
                }
                if (!CharactersInventory.ExistCharacterItem(charId, "Defibrilator", "inventory") && !CharactersInventory.ExistCharacterItem(charId, "Defibrilator", "backpack"))
                {
                    HUDHandler.SendNotification(player, 3, 3500, "Du hast keinen Defibrilator dabei."); return;
                }
                InventoryHandler.InventoryAnimation(player, "revive", 15000);
                int rnd = new Random().Next(1, 100);
                await Task.Delay(15000);

                if (rnd >= 1 && rnd <= 50)
                {
                    //Reanimation erfolgreich
                    if (!player.IsInVehicle)
                    {
                        InventoryHandler.StopAnimation(player, "missheistfbi3b_ig8_2", "cpr_loop_paramedic");
                    }
                    if (targetId <= 0 || !Characters.IsCharacterUnconscious(targetId))
                    {
                        return;
                    }
                    Characters.SetCharacterUnconscious(targetId, false, 0);
                    DeathHandler.revive(targetPlayer);
                    Characters.SetCharacterHealth(targetId, 115);
                    targetPlayer.Health = 115;
                }
                else if (rnd >= 51 && rnd <= 100)
                {
                    //Reanimation nicht erfolgreich
                    if (!player.IsInVehicle)
                    {
                        InventoryHandler.StopAnimation(player, "missheistfbi3b_ig8_2", "cpr_loop_paramedic");
                    }
                    HUDHandler.SendNotification(player, 3, 3500, "Die Renimation war nicht erfolgreich, versuch es weiter!");
                }
            }
            catch (Exception e)
            {
                Alt.Log($"{e}");
            }
        }
Beispiel #10
0
        public static void CreateServerShop(IPlayer client, int shopid, string name, Position pos)
        {
            if (client == null || !client.Exists)
            {
                return;
            }
            var ServerShopData = new Server_Shops
            {
                shopId        = shopid,
                name          = name,
                posX          = pos.X,
                posY          = pos.Y,
                posZ          = pos.Z,
                pedX          = 0f,
                pedY          = 0f,
                pedZ          = 0f,
                pedRot        = 0f,
                pedModel      = "",
                neededLicense = "None",
                isOnlySelling = false
            };

            try
            {
                ServerShops_.Add(ServerShopData);

                using (gtaContext db = new gtaContext())
                {
                    db.Server_Shops.Add(ServerShopData);
                    db.SaveChanges();
                }

                ServerShopsItems.CreateServerShopItem(client, shopid, "Bagel", 20, 5);
                ServerShopsItems.CreateServerShopItem(client, shopid, "BonBon", 20, 2);
                ServerShopsItems.CreateServerShopItem(client, shopid, "Chips", 20, 4);
                ServerShopsItems.CreateServerShopItem(client, shopid, "Donut", 20, 2);
                ServerShopsItems.CreateServerShopItem(client, shopid, "Eis", 20, 1);
                ServerShopsItems.CreateServerShopItem(client, shopid, "HotDog", 20, 5);
                ServerShopsItems.CreateServerShopItem(client, shopid, "Müsli-Riegel", 20, 2);
                ServerShopsItems.CreateServerShopItem(client, shopid, "Sandwich", 20, 4);
                ServerShopsItems.CreateServerShopItem(client, shopid, "Schokolade", 20, 3);
                ServerShopsItems.CreateServerShopItem(client, shopid, "Wrap", 20, 4);


                HUDHandler.SendNotification(client, 2, 5000, $"Shop mit dem Namen ({ServerShopData.name}) an deiner Position erstellt.");
            }
            catch (Exception e)
            {
                Alt.Log($"{e}");
            }
        }
Beispiel #11
0
        public async Task HealPlayer(IPlayer player, IPlayer targetPlayer)
        {
            try
            {
                if (player == null || !player.Exists || targetPlayer == null || !targetPlayer.Exists)
                {
                    return;
                }
                int targetId = (int)targetPlayer.GetCharacterMetaId();
                int charId   = (int)player.GetCharacterMetaId();
                if (!player.Position.IsInRange(targetPlayer.Position, 3f))
                {
                    return;
                }
                if (charId <= 0 || targetId <= 0 || targetPlayer.Health >= 200)
                {
                    return;
                }
                if (!CharactersInventory.ExistCharacterItem(charId, "Verbandskasten", "inventory") && !CharactersInventory.ExistCharacterItem(charId, "Verbandskasten", "backpack"))
                {
                    HUDHandler.SendNotification(player, 3, 2500, "Du hast keinen Verbandskasten dabei."); return;
                }
                //ToDo: Animation abspielen
                await Task.Delay(4000);

                if (player == null || !player.Exists || targetPlayer == null || !targetPlayer.Exists)
                {
                    return;
                }
                if (!player.Position.IsInRange(targetPlayer.Position, 3f))
                {
                    return;
                }
                Characters.SetCharacterHealth(charId, 200);
                targetPlayer.Health = 200;
                HUDHandler.SendNotification(player, 2, 2000, "Spieler erfolgreich behandelt.");
                HUDHandler.SendNotification(targetPlayer, 1, 2000, "Ein Arzt hat dich behandelt.");
                if (CharactersInventory.ExistCharacterItem(charId, "Verbandskasten", "inventory"))
                {
                    CharactersInventory.RemoveCharacterItemAmount(charId, "Verbandskasten", 1, "inventory"); return;
                }
                else if (CharactersInventory.ExistCharacterItem(charId, "Verbandskasten", "backpack"))
                {
                    CharactersInventory.RemoveCharacterItemAmount(charId, "Verbandskasten", 1, "backpack"); return;
                }
            }
            catch (Exception e)
            {
                Alt.Log($"{e}");
            }
        }
Beispiel #12
0
 public async Task SearchBankAccounts(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, 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 (!Characters.ExistCharacterName(targetCharName))
         {
             HUDHandler.SendNotification(player, 3, 5000, $"Der angegebene Name wurde nicht gefunden ({targetCharName})."); return;
         }
         int targetCharId = Characters.GetCharacterIdFromCharName(targetCharName);
         if (targetCharId <= 0)
         {
             return;
         }
         var targetBankAccounts = CharactersBank.GetCharacterBankAccounts(targetCharId);
         if (targetBankAccounts == "[]" || targetBankAccounts == "")
         {
             HUDHandler.SendNotification(player, 3, 5000, "Der Spieler hat keine Bankkonten."); return;
         }
         player.EmitLocked("Client:Tablet:SetJusticeAppSearchedBankAccounts", targetBankAccounts);
     }
     catch (Exception e)
     {
         Alt.Log($"{e}");
     }
 }
Beispiel #13
0
 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}");
     }
 }
Beispiel #14
0
 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}");
     }
 }
Beispiel #15
0
 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}");
     }
 }
Beispiel #16
0
 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}");
     }
 }
Beispiel #17
0
 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}");
     }
 }
Beispiel #18
0
 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}");
     }
 }
Beispiel #19
0
 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}");
     }
 }
Beispiel #20
0
        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}");
            }
        }
Beispiel #21
0
        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}");
            }
        }
Beispiel #22
0
 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}");
     }
 }
Beispiel #23
0
        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);
            }
        }
Beispiel #24
0
        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}");
            }
        }
Beispiel #25
0
        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}");
            }
        }
Beispiel #26
0
        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}");
            }
        }
Beispiel #27
0
        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}");
            }
        }
Beispiel #28
0
        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}");
            }
        }
Beispiel #29
0
 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}");
     }
 }
Beispiel #30
0
 public static void kickWithMessage(this IPlayer player, string reason)
 {
     HUDHandler.SendNotification(player, 3, 250000, $"Du wurdest vom Server gekickt. Grund: {reason}");
     player.Kick(reason);
 }