Thread: Give donor points command

Results 1 to 9 of 9
  1. #1 Give donor points command 
    Registered Member
    Join Date
    Mar 2011
    Posts
    569
    Thanks given
    146
    Thanks received
    65
    Rep Power
    52
    Does anyone have a command that gives donor points to another player. Such as ::givedp (name) (amount).
    Reply With Quote  
     

  2. #2  
    Registered Member coder eddie's Avatar
    Join Date
    Jul 2011
    Posts
    509
    Thanks given
    18
    Thanks received
    14
    Rep Power
    6
    Use search bar, seen alot.
    Reply With Quote  
     

  3. #3  
    Member

    Join Date
    Aug 2009
    Posts
    192
    Thanks given
    14
    Thanks received
    12
    Rep Power
    0
    I can write one for you if you tell me what class your donor points int is and also what its called ( e.g donorPoints )

    C H E E S E - S M O K E
    Reply With Quote  
     

  4. #4  
    Legalize it

    Join Date
    Jun 2011
    Posts
    145
    Thanks given
    1
    Thanks received
    3
    Rep Power
    12
    Here you go mate, TESTED and is working on my own Source [PI] CHANGE "YOUDONORPOINTNAME HERE" to e.g donatorPoints You can find this in playersave.java
    Code:
    if (playerCommand.startsWith("givedp")) {
    			String[] args = playerCommand.split("-");
    			if (args.length == 3) {
    				try {
    					String givenPlayer = args[1];
    					int donorPoints = Integer.parseInt(args[2]);
    					for(int i = 0; i < Config.MAX_PLAYERS; i++) {
    						if(Server.playerHandler.players[i] != null) {
    							Client c2 = (Client)Server.playerHandler.players[i];
    							if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(givenPlayer)) {
    								c.sendMessage("<col=890909>You have given "+ givenPlayer +" "+donorPoints+" DonatorPoints</col>");
    								c2."YOUDONORPOINTNAME HERE" += donorPoints;
    								c2.sendMessage("<col=890909>You have Recieved "+donorPoints+" DonatorPoints Thank You So Much :)</col>");
    							}
    						}
    					}
    				} catch(Exception e) {
    					c.sendMessage("Player is not online.");
    				}
    			} else {
    				c.sendMessage("Command Error.");
    			}
    		}
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Mar 2011
    Posts
    569
    Thanks given
    146
    Thanks received
    65
    Rep Power
    52
    Quote Originally Posted by Mibow View Post
    Here you go mate, TESTED and is working on my own Source [PI] CHANGE "YOUDONORPOINTNAME HERE" to e.g donatorPoints You can find this in playersave.java
    Code:
    if (playerCommand.startsWith("givedp")) {
    			String[] args = playerCommand.split("-");
    			if (args.length == 3) {
    				try {
    					String givenPlayer = args[1];
    					int donorPoints = Integer.parseInt(args[2]);
    					for(int i = 0; i < Config.MAX_PLAYERS; i++) {
    						if(Server.playerHandler.players[i] != null) {
    							Client c2 = (Client)Server.playerHandler.players[i];
    							if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(givenPlayer)) {
    								c.sendMessage("<col=890909>You have given "+ givenPlayer +" "+donorPoints+" DonatorPoints</col>");
    								c2."YOUDONORPOINTNAME HERE" += donorPoints;
    								c2.sendMessage("<col=890909>You have Recieved "+donorPoints+" DonatorPoints Thank You So Much :)</col>");
    							}
    						}
    					}
    				} catch(Exception e) {
    					c.sendMessage("Player is not online.");
    				}
    			} else {
    				c.sendMessage("Command Error.");
    			}
    		}
    Everytime i use this command, i get "Command Error." in my chatbox. This is my code for the givedp command.
    if (playerCommand.startsWith("givedp") && c.playerName.equalsIgnoreCase("Russ")) {
    String[] args = playerCommand.split("-");
    if (args.length == 3) {
    try {
    String givenPlayer = args[1];
    int DonorPoints = Integer.parseInt(args[2]);
    for(int i = 0; i < Config.MAX_PLAYERS; i++) {
    if(Server.playerHandler.players[i] != null) {
    Client c2 = (Client)Server.playerHandler.players[i];
    if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(givenPlayer)) {
    c.sendMessage("<col=890909>You have given "+ givenPlayer +" "+DonorPoints+" DonatorPoints</col>");
    c2.DonorPoints += DonorPoints;
    c2.sendMessage("<col=890909>You have Recieved "+DonorPoints+" DonatorPoints Thank You So Much </col>");
    }
    }
    }
    } catch(Exception e) {
    c.sendMessage("Player is not online.");
    }
    } else {
    c.sendMessage("Command Error.");
    }
    }
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Mar 2011
    Posts
    569
    Thanks given
    146
    Thanks received
    65
    Rep Power
    52
    It doesn't work with people who have spaces in their usernames. How can i make that work?
    Reply With Quote  
     

  7. #7  
    Banned

    Join Date
    Mar 2011
    Posts
    4,062
    Thanks given
    194
    Thanks received
    689
    Rep Power
    0
    Code:
    	if (playerCommand.startsWith("givedp")) {
    		String[] args = playerCommand.split("-");
    		for (Player p : PlayerHandler.players) {
    			if (p != null && p.playerName.equalsIgnoreCase(args[1])) {
    				p.donorPoints += Integer.parseInt(args[2]);
    				((Client) p).sendMessage("You have been given " + args[2] + " donor points by " + c.playerName);
    			}
    		}
    	}
    Use as: givedp-playerName-amountOfPoints
    Reply With Quote  
     

  8. #8  
    Legalize it

    Join Date
    Jun 2011
    Posts
    145
    Thanks given
    1
    Thanks received
    3
    Rep Power
    12
    russ you gotta use it like this ::givedp-name-points
    Reply With Quote  
     

  9. #9  
    Registered Member
    Join Date
    Jun 2011
    Posts
    48
    Thanks given
    0
    Thanks received
    0
    Rep Power
    1
    This is the one i have used on all my servers:

    if (playerCommand.startsWith("givepoints")) {
    try {
    String[] args = playerCommand.split(" ");

    for(int i = 0; i < Config.MAX_PLAYERS; i++) {
    if(Server.playerHandler.players[i] != null) {
    if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(args[1])) {
    Client c2 = (Client)Server.playerHandler.players[i];
    c2.donatorChest += Integer.parseInt(args[2]);
    c.sendMessage("You gave points to "+c2.playerName+", he has now "+c2.donatorChest+" points.");
    c2.sendMessage("You recieve "+Integer.parseInt(args[2])+" donator chest points, you now have "+c2.donatorChest+".");

    }
    }
    }
    } catch(Exception e) {
    c.sendMessage("Player must be offline.");
    }
    }
    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. [PI] Need Command Give Donator Points
    By Udang in forum Help
    Replies: 15
    Last Post: 03-27-2012, 12:39 AM
  2. Replies: 1
    Last Post: 03-06-2012, 03:30 AM
  3. [PI] Give Points Command
    By ParadoxPvP in forum Help
    Replies: 12
    Last Post: 02-08-2012, 03:23 AM
  4. Command to give people Pk Points?
    By Bauce in forum Help
    Replies: 2
    Last Post: 11-04-2011, 12:41 AM
  5. [PI] ::give points command?
    By Acquittal in forum Help
    Replies: 7
    Last Post: 01-30-2011, 05:25 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •