Reign of Kings Grand Exchange - send money

Discussion in 'Plugin Requests' started by Saddamo, Jan 8, 2016.

  1. I wish plugin with Grand Exchange to send money ( gold ) to other players...
     
  2. When I still used the GE plugin I edited this in it.

    Code:
    [ChatCommand("sendcredits")]
            private void SendCredits(Player player, string cmd, string[] input)
            {
                if (input.Length < 2)
                {
                    PrintToChat(player, "Enter a player name followed by the amount to give.");
                    return;
                }            int amount;
                if (Int32.TryParse(input[1], out amount) == false)
                {
                    PrintToChat(player, "That was not a recognised amount!");
                    return;
                }            if (amount < 0 )
                {
                    PrintToChat(player, "Don't try to steal gold from others!");
                    PrintToChat(player, "A fee of 100.000 gold will be taken from your account.");
                    RemoveGold(player, 100000); // yes it will go into negative if sending player has less then 100.000 gold
                    return;
                }            CheckWalletExists(player);
                var walletAmount = _playerWallet[player.Id];
                if (Convert.ToInt32(walletAmount) < amount)
                {
                    PrintToChat(player, "You can't send more gold then you have!");
                    return;
                }            var playerName = input[0];
                var target = Server.GetPlayerByName(playerName);            if (target == null)
                {
                    PrintToChat(player, "That player doesn't appear to be online right now!");
                    return;
                }            PrintToChat(player, "Sending " + amount.ToString() + " gold to " + playerName + ".");
                PrintToChat(target, "You received " + amount.ToString() + " gold from " + player.DisplayName + ".");            CheckWalletExists(target);
                GiveGold(target, amount);
                RemoveGold(player, amount);
            }
    Just put this code into the user command region.

    All exploits should have been removed but there might still be 1 or 2.
    If you find any and don't know how to edit it just let me know and I'll try to fix it.
     
  3. thx.work great
    i also add this for /shophelp info
    PrintToChat(player, "[00FF00]/sendcredits [FFFFFF] - playername <amount> ");
     
  4. You can set the fee to whatever you like.

    The fee is for when a player tries to enter a negative number.
    Just imagine what would happen if you send someone -100 g.
    They get on their bank - -100 g and the player who it was send to will get on his bank + -100.