Thread: PI Help With Spaces In Command ::givepoints PI

Results 1 to 3 of 3
  1. #1 PI Help With Spaces In Command ::givepoints PI 
    Registered Member jackd019's Avatar
    Join Date
    Aug 2011
    Posts
    431
    Thanks given
    5
    Thanks received
    8
    Rep Power
    11
    Code:
    if (playerCommand.startsWith("givepoints")) {
    				try {	
    					final String[] args = playerCommand.split(" ");
    					final String otherplayer = args[1];		
    					final int point = Integer.parseInt(args[2]);
    						for (final Player player : PlayerHandler.players) {
    							if (player != null) {
    							    if (player.playerName.equalsIgnoreCase(otherplayer)) {
    								 final Client c2 = (Client) player;
    								 c2.DonorPoints += point; //CHANGE THIS TO YOUR DONOR POINTS VARIABLE
    								c.sendMessage("<shad=60811334><img=4>You have given "
    						 + otherplayer + ", " + point
    						  + " Reward points.<img=4>");
    						   c2.sendMessage("<shad=60811334><img=4>You have been given "
    						   + point + " Reward points by "
    						   + c.playerName + ".<img=4>");
    					}
    					}
    					}
    				} catch(Exception e) {
    					c.sendMessage("Player must be offline.");
    				}
    			}
    Thats my command and it still doesnt works on players with spaces how can i fix it ?
    Reply With Quote  
     

  2. #2  
    Super Donator

    Batukka's Avatar
    Join Date
    Oct 2011
    Posts
    2,433
    Thanks given
    86
    Thanks received
    342
    Rep Power
    496
    Code:
    if (playerCommand.startsWith("givepoints")) {
    				try {	
    					final String[] args = playerCommand.split("_");
    					final String otherplayer = args[1];		
    					final int point = Integer.parseInt(args[2]);
    						for (final Player player : PlayerHandler.players) {
    							if (player != null) {
    							    if (player.playerName.equalsIgnoreCase(otherplayer)) {
    								 final Client c2 = (Client) player;
    								 c2.DonorPoints += point; //CHANGE THIS TO YOUR DONOR POINTS VARIABLE
    								c.sendMessage("<shad=60811334><img=4>You have given "
    						 + otherplayer + ", " + point
    						  + " Reward points.<img=4>");
    						   c2.sendMessage("<shad=60811334><img=4>You have been given "
    						   + point + " Reward points by "
    						   + c.playerName + ".<img=4>");
    					}
    					}
    					}
    				} catch(Exception e) {
    					c.sendMessage("Player must be offline.");
    				}
    			}

    usange: ::givepoints_name_points
    Reply With Quote  
     

  3. #3  
    Registered Member jackd019's Avatar
    Join Date
    Aug 2011
    Posts
    431
    Thanks given
    5
    Thanks received
    8
    Rep Power
    11
    didnt work
    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. Replies: 4
    Last Post: 11-14-2011, 04:08 PM
  2. GivePoints
    By ownagekid in forum Snippets
    Replies: 4
    Last Post: 08-31-2011, 11:31 PM
  3. Checkbank Command - No Spaces..?
    By Keat in forum Help
    Replies: 16
    Last Post: 07-08-2011, 09:38 PM
  4. Replies: 21
    Last Post: 02-13-2011, 02:49 PM
  5. [525] yell command fixed (spaces)
    By Pie in forum Configuration
    Replies: 11
    Last Post: 05-05-2009, 09:05 PM
Tags for this Thread

View Tag Cloud

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •