Thread: Help with my ;;givedonor command

Results 1 to 6 of 6
  1. #1 Help with my ;;givedonor command 
    Extreme Donator

    Join Date
    Jul 2014
    Posts
    414
    Thanks given
    46
    Thanks received
    8
    Rep Power
    15
    So this is my givedonor command:
    Code:
    case "givedonor":
    			name = "";
    			for (int i = 2; i < cmd.length; i++)
    				name += cmd[i] + ((i == cmd.length - 1) ? "" : " ");
    			target = World.findPlayer(name);
    			if (target == null) {
    				player.getPackets().sendGameMessage(
    						"Couldn't find player " + name + ".");
    				return true;
    			}
    			AutoDonate donate = new AutoDonate(target);
    			double amount = donate.confirm(Integer.valueOf(cmd[1]));
    			donate.setAmount(amount);
    			donate.giveReward();
    			System.gc();
    All it does is say "Couldn't find player ."

    Can someone help me please? I tried replacing it with something else, but I messed it up even more.
    Reply With Quote  
     

  2. #2  
    Registered Member

    Join Date
    Feb 2013
    Posts
    4,409
    Thanks given
    59
    Thanks received
    478
    Rep Power
    138
    Is the player online...?
    Reply With Quote  
     

  3. #3  
    Extreme Donator

    Join Date
    Jul 2014
    Posts
    414
    Thanks given
    46
    Thanks received
    8
    Rep Power
    15
    Quote Originally Posted by Mayne View Post
    Is the player online...?
    Yes sir
    Reply With Quote  
     

  4. #4  
    Banned

    Join Date
    Mar 2015
    Posts
    385
    Thanks given
    7
    Thanks received
    291
    Rep Power
    0
    Code:
    for (int i = 1; i < cmd.length; i++)
    					name += cmd[i] + ((i == cmd.length - 1) ? "" : " ");
    				target = World.getPlayerByDisplayName(name);
    				loggedIn = true;
    				if (target == null) {
    					target = SerializableFilesManager.loadPlayer(Utils
    							.formatPlayerNameForProtocol(name));
    					if (target != null)
    						target.setUsername(Utils
    								.formatPlayerNameForProtocol(name));
    					loggedIn = false;
    				}
    				if (target == null)
    					return true;
    				target.setDonator(true);
    				SerializableFilesManager.savePlayer(target);
    				if (loggedIn)
    					target.getPackets().sendGameMessage(
    							"You have been given donator by "
    									+ Utils.formatPlayerNameForDisplay(player
    											.getUsername()), true);
    				player.getPackets().sendGameMessage(
    						"You gave donator to "
    								+ Utils.formatPlayerNameForDisplay(target
    										.getUsername()), true);
    				return true;
    				}
    Just edit it to what yours is supposed to do.
    Reply With Quote  
     

  5. #5  
    Registered Member

    Join Date
    Nov 2013
    Posts
    153
    Thanks given
    62
    Thanks received
    27
    Rep Power
    77
    Edit totally misread it my bad
    Reply With Quote  
     

  6. #6  
    Registered Member
    Zach's Avatar
    Join Date
    Aug 2013
    Posts
    1,120
    Thanks given
    24
    Thanks received
    513
    Rep Power
    5000
    Not sure how your server rankings go but you currently have your for statement set to if a players rights are higher than 2.
    Code:
    for (int i = 1; i < cmd.length; i++)
    Usually admin rights are 2.

    What is this?
    Code:
    AutoDonate donate = new AutoDonate(target);
    			double amount = donate.confirm(Integer.valueOf(cmd[1]));
    			donate.setAmount(amount);
    			donate.giveReward();
    			System.gc();
    Anyways try using this
    Code:
    case "givedonor":
    				name = "";
    				for (int i = 1; i < cmd.length; i++)
    					name += cmd[i] + ((i == cmd.length - 1) ? "" : " ");
    				target = World.getPlayerByDisplayName(name);
    				loggedIn = true;
    				if (target == null) {
    					target = SerializableFilesManager.loadPlayer(Utils.formatPlayerNameForProtocol(name));
    					if (target != null)
    						target.setUsername(Utils.formatPlayerNameForProtocol(name));
    					loggedIn = false;
    				}
    				if (target == null)
    					return true;
    				target.setDonator(true);
    				SerializableFilesManager.savePlayer(target);
    				if (loggedIn)
    					target.getPackets().sendGameMessage("You have been given donator by " + Utils.formatPlayerNameForDisplay(player.getUsername()), true);
    				player.getPackets().sendGameMessage("You gave donator to " + Utils.formatPlayerNameForDisplay(target.getUsername()), true);
    				return true;
    ZachTX's RSPS Video Services (10,000+ Loyal RSPS Subscribers)
    CLICK HERE!

    Attached image
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Need help with my Yell Command
    By DivideByZero in forum Help
    Replies: 6
    Last Post: 11-01-2014, 03:43 PM
  2. Please help with my ::tele command
    By Juicy J 0 in forum Help
    Replies: 0
    Last Post: 04-28-2013, 03:18 PM
  3. Need help with my yell command..
    By tomstahh in forum Help
    Replies: 15
    Last Post: 09-05-2012, 07:05 PM
  4. need help with my spawn command.
    By pjc9119 in forum Tutorials
    Replies: 9
    Last Post: 09-05-2011, 10:34 PM
  5. [508] Help with my rickroll command??[508]
    By Str pker in forum Help
    Replies: 0
    Last Post: 07-14-2009, 10:56 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •