Ejemplo n.º 1
0
        private void OnEntityEnterColShapeHandler(ColShape shape, NetHandle entity)
        {
            if (TTRPG.Api.getEntityType(entity) == EntityType.Player &&
                shape.getData("bergwerk_colshape") != null &&
                (bool)shape.getData("bergwerk_colshape"))
            {
                Client player = TTRPG.Api.getPlayerFromHandle(entity);

                if (player.isInVehicle && player.vehicle.getData("job_bergwerk_bulldozer") != null)
                {
                    Vector3 markerPosition = (Vector3)shape.getData("position");

                    List <Vector3> markers = _alreadyUsedPositions.Get((int)player.getSyncedData("ID"));

                    bool found = false;

                    foreach (Vector3 position in markers)
                    {
                        if (position.DistanceTo(markerPosition) < 1)
                        {
                            markers.Remove(position);
                            found = true;
                            break;
                        }
                    }

                    if (found)
                    {
                        player.triggerEvent("job_bergwerk_destroyMarker", markerPosition);

                        if (markers.Count == 0)
                        {
                            player.vehicle.delete();
                            _alreadyUsedPositions.Remove((int)player.getSyncedData("ID"));

                            int money = _marker.Length * 42;
                            int newEp = (int)Math.Ceiling(_marker.Length * 0.5);

                            MoneyManager.ChangePlayerMoney(player, (float)money / 2, false, MoneyManager.Categorys.Job,
                                                           "BergwerksJob Barzahlung", "");
                            PayDayManager.AddIncomeToPayDay(player, (double)money / 2, PayDayManager.Category.Job,
                                                            true);
                            RpLevelManager.AddRpToPlayer(player, newEp, true);


                            player.sendChatMessage(
                                "~b~Vorarbeiter Karl sagt: Hier hast du schon mal die Hälfte deines Verdienstes auf die Hand: " +
                                (money / 2).ToString("C2") + "!" +
                                "Den Rest bekommst als Gehalt beim PayDay... Das Gesetz will es halt so :-/");
                        }
                        else
                        {
                            ChatHelper.SendChatNotificationToPlayer(player, "~b~Job Info",
                                                                    "~b~Sehr gut! Dann fehlen ja nur noch " + markers.Count + " Positionen.");
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void onATMEventTrigger(Client sender, string eventname, object[] arguments)
        {
            if (eventname.Equals("onATMPayInPayOut"))
            {
                string type   = (string)arguments[0];
                float  amount = float.Parse((string)arguments[1]);
                string reason = (string)arguments[2];

                if (amount < 0)
                {
                    return;
                }

                if (type.Equals("in"))
                {
                    if (MoneyManager.CanPlayerPayMoney(sender, amount))
                    {
                        MoneyManager.ChangePlayerMoney(sender, -amount, false, MoneyManager.Categorys.BankToMoney,
                                                       reason, null);
                        MoneyManager.ChangePlayerMoney(sender, amount, true, MoneyManager.Categorys.BankToMoney, reason,
                                                       null);
                        sender.sendNotification("ATM", "~g~Betrag erfolgreich eingezahlt.");
                        sender.triggerEvent("updateATM");
                    }
                    else
                    {
                        sender.sendNotification("ATM", "~r~Nicht genug Geld.");
                    }
                }
                else
                {
                    if (MoneyManager.CanPlayerPayBank(sender, amount))
                    {
                        MoneyManager.ChangePlayerMoney(sender, amount, false, MoneyManager.Categorys.BankToMoney, reason, null);
                        MoneyManager.ChangePlayerMoney(sender, -amount, true, MoneyManager.Categorys.BankToMoney, reason, null);
                        sender.sendNotification("ATM", "~g~Betrag erfolgreich ausgezahlt.");
                        sender.triggerEvent("updateATM");
                    }
                    else
                    {
                        sender.sendNotification("ATM", "~r~Nicht genug Guthaben.");
                    }
                }
            }
        }
        private void onClientEventHandler(Client player, string eventName, params object[] arguments)
        {
            if (eventName.Equals("stopFisherJob"))
            {
                _isUiOpen = true;
            }
            else if (eventName.Equals("payFisherJob"))
            {
                float money = (float)arguments[0];
                Int32 steps = (Int32)arguments[1];

                MoneyManager.ChangePlayerMoney(player, money, false, MoneyManager.Categorys.Job,
                                               "Fischerjob", "");

                RpLevelManager.AddRpToPlayer(player, steps, true);

                player.sendChatMessage(
                    "~b~Fischhändler Fritz sagt: Okay, diese Menge Fisch kaufe ich dir für " + money.ToString("C2") + " ab");
            }
        }
Ejemplo n.º 4
0
        public void RadDrehCommand(Client player)
        {
            Vector3 currentpos = player.position;
            double  X          = currentpos.X;
            double  Y          = currentpos.Y;
            double  Z          = currentpos.Z;

            if (X < -1603.619 && X > -1623.619 && Y < 1066.322 && Y > -1086.322 && Z > 3.01853 && Z < 23.01853)
            {
                float playermoney = MoneyManager.GetPlayerMoney(player);
                if (playermoney < 50)
                {
                    API.sendChatMessageToPlayer(player, "Du brauchst 50 Dollar um am Rad zu drehen!");
                }
                else
                {
                    MoneyManager.ChangePlayerMoney(player, -50, false, MoneyManager.Categorys.Other, "Rad gedreht", "");
                    double Chooser = GetRandomNumber(0.0, 100.0);
                    if (Chooser < 1)
                    {
                        API.sendChatMessageToPlayer(player, "Glückwunsch! Du hast den Jackpot gewonnen! 250€!!");
                        MoneyManager.ChangePlayerMoney(player, 300, false, MoneyManager.Categorys.Other, "Rad Gewinn", "");
                    }
                    if (Chooser < 20 && Chooser >= 1)
                    {
                        API.sendChatMessageToPlayer(player, "Glückwunsch! Du hast den gewonnen! 100€!!");
                        MoneyManager.ChangePlayerMoney(player, 150, false, MoneyManager.Categorys.Other, "Rad Gewinn", "");
                    }
                    else
                    {
                        API.sendChatMessageToPlayer(player, "Schade, hast wohl nix gewonnen");
                    }
                }
            }
            else
            {
                API.sendChatMessageToPlayer(player, "Du stehst nicht am Glücksrad!");
            }
        }