Thread: help to fix vencillio command

Results 1 to 6 of 6
  1. #1 help to fix vencillio command 
    Registered Member
    Join Date
    May 2017
    Posts
    91
    Thanks given
    36
    Thanks received
    4
    Rep Power
    33
    so i tried to add everythingrs vote command work on vencillio but for some reason it doesnt work .-.

    here is how it looks so far :

    Code:
    case "reward":
            	//Our vote API from EverythingRS.com
    			//By default this will work with Project Insanity sources, but it is very easy to make it
    			//work with anything (Vencillio/RuneSource, Hyperion, Matrix, etc)
    			//Things you will need to change in order to make it work with a different server are: 
    			//1. "String playerName = c.playerName" . Change that to whatever your source uses to fetch the username
    			//2. "c.sendMessage" . Change that to how the server sends the player message packet.
    			//3. "c.getItems().addItem" . Change that to how the server handles adding a new item. 
    			//And that's it. After tweaking those 3 things, you can get it to work with any source.
    			//If you want me to personally add the code for a specific server, please leave a post on our thread
    			//And we will personally add the snippet for your current server base
    			new Thread() {
    				public void run(String[] command) {
    					try {
    						int id = Integer.parseInt(command[1]);
    						String playerName = player.getUsername();
    						final String request = com.everythingrs.vote.Vote.validate("not telling u", playerName, id);
    						String[][] errorMessage = {
    								{ "error_invalid", "There was an error processing your request." },
    								{ "error_non_existent_server", "This server is not registered at EverythingRS." },
    								{ "error_invalid_reward", "The reward you're trying to claim doesn't exist" },
    								{ "error_non_existant_rewards", "This server does not have any rewards set up yet." },
    								{ "error_non_existant_player", "There is not record of user " + playerName + " make sure to vote first" },
    								{ "not_enough", "You do not have enough vote points to recieve this item" } };
    						for (String[] message : errorMessage) {
    							if (request.equalsIgnoreCase(message[0])) {
    								player.send(new SendMessage(message[1]));
    								return;
    							}
    						}
    						if (request.startsWith("complete")) {
    							int item = Integer.valueOf(request.split("_")[1]);
    							int amount = Integer.valueOf(request.split("_")[2]);
    							String itemName = request.split("_")[3];
    							int remainingPoints = Integer.valueOf(request.split("_")[4]);
    							player.getInventory().add(new Item(item, amount));
    							player.send(new SendMessage("You have recieved the item " + itemName + ". You have " + remainingPoints
    									+ " points left."));
    
    						}
    					} catch (Exception e) {
    						player.send(new SendMessage("Our API services are currently offline. We are working on bringing it back up"));
    						e.printStackTrace();
    					}
    				}
    			}.start();
    			return true;
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    May 2017
    Posts
    91
    Thanks given
    36
    Thanks received
    4
    Rep Power
    33
    bumpp
    Reply With Quote  
     

  3. #3  
    Officially Retired


    Join Date
    Oct 2007
    Age
    30
    Posts
    5,454
    Thanks given
    558
    Thanks received
    122
    Rep Power
    1364
    Quote Originally Posted by welpp View Post
    so i tried to add everythingrs vote command work on vencillio but for some reason it doesnt work .-.

    here is how it looks so far :

    Code:
    case "reward":
            	//Our vote API from EverythingRS.com
    			//By default this will work with Project Insanity sources, but it is very easy to make it
    			//work with anything (Vencillio/RuneSource, Hyperion, Matrix, etc)
    			//Things you will need to change in order to make it work with a different server are: 
    			//1. "String playerName = c.playerName" . Change that to whatever your source uses to fetch the username
    			//2. "c.sendMessage" . Change that to how the server sends the player message packet.
    			//3. "c.getItems().addItem" . Change that to how the server handles adding a new item. 
    			//And that's it. After tweaking those 3 things, you can get it to work with any source.
    			//If you want me to personally add the code for a specific server, please leave a post on our thread
    			//And we will personally add the snippet for your current server base
    			new Thread() {
    				public void run(String[] command) {
    					try {
    						int id = Integer.parseInt(command[1]);
    						String playerName = player.getUsername();
    						final String request = com.everythingrs.vote.Vote.validate("not telling u", playerName, id);
    						String[][] errorMessage = {
    								{ "error_invalid", "There was an error processing your request." },
    								{ "error_non_existent_server", "This server is not registered at EverythingRS." },
    								{ "error_invalid_reward", "The reward you're trying to claim doesn't exist" },
    								{ "error_non_existant_rewards", "This server does not have any rewards set up yet." },
    								{ "error_non_existant_player", "There is not record of user " + playerName + " make sure to vote first" },
    								{ "not_enough", "You do not have enough vote points to recieve this item" } };
    						for (String[] message : errorMessage) {
    							if (request.equalsIgnoreCase(message[0])) {
    								player.send(new SendMessage(message[1]));
    								return;
    							}
    						}
    						if (request.startsWith("complete")) {
    							int item = Integer.valueOf(request.split("_")[1]);
    							int amount = Integer.valueOf(request.split("_")[2]);
    							String itemName = request.split("_")[3];
    							int remainingPoints = Integer.valueOf(request.split("_")[4]);
    							player.getInventory().add(new Item(item, amount));
    							player.send(new SendMessage("You have recieved the item " + itemName + ". You have " + remainingPoints
    									+ " points left."));
    
    						}
    					} catch (Exception e) {
    						player.send(new SendMessage("Our API services are currently offline. We are working on bringing it back up"));
    						e.printStackTrace();
    					}
    				}
    			}.start();
    			return true;
    Can explain more?
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    May 2017
    Posts
    91
    Thanks given
    36
    Thanks received
    4
    Rep Power
    33
    Quote Originally Posted by Qimmy View Post
    Can explain more?
    it just doesnt work, nothing happens if i do ::reward 1 , not even error etc .-.

    here is PI command, would be awesome if someone can change it to vencillio . will rep and thank.

    Code:
    if (playerCommand.startsWith("reward")) {
    				//Our vote API from EverythingRS.com
    				//By default this will work with Project Insanity sources, but it is very easy to make it
    				//work with anything (Vencillio/RuneSource, Hyperion, Matrix, etc)
    				//Things you will need to change in order to make it work with a different server are: 
    				//1. "String playerName = c.playerName" . Change that to whatever your source uses to fetch the username
    				//2. "c.sendMessage" . Change that to how the server sends the player message packet.
    				//3. "c.getItems().addItem" . Change that to how the server handles adding a new item. 
    				//And that's it. After tweaking those 3 things, you can get it to work with any source.
    				//If you want me to personally add the code for a specific server, please leave a post on our thread
    				//And we will personally add the snippet for your current server base
    				String[] args = playerCommand.split(" ");
    				new Thread() {
    					public void run() {
    						try {
    							int id = Integer.parseInt(args[1]);
    							String playerName = c.playerName;
    							final String request = com.everythingrs.vote.Vote.validate("secret_key", playerName, id);
    							String[][] errorMessage = {
    									{ "error_invalid", "There was an error processing your request." },
    									{ "error_non_existent_server", "This server is not registered at EverythingRS." },
    									{ "error_invalid_reward", "The reward you're trying to claim doesn't exist" },
    									{ "error_non_existant_rewards", "This server does not have any rewards set up yet." },
    									{ "error_non_existant_player", "There is not record of user " + playerName + " make sure to vote first" },
    									{ "not_enough", "You do not have enough vote points to recieve this item" } };
    							for (String[] message : errorMessage) {
    								if (request.equalsIgnoreCase(message[0])) {
    									c.sendMessage(message[1]);
    									return;
    								}
    							}
    							if (request.startsWith("complete")) {
    								int item = Integer.valueOf(request.split("_")[1]);
    								int amount = Integer.valueOf(request.split("_")[2]);
    								String itemName = request.split("_")[3];
    								int remainingPoints = Integer.valueOf(request.split("_")[4]);
    								c.getItems().addItem(item, amount);
    								c.sendMessage("You have recieved the item " + itemName + ". You have " + remainingPoints
    										+ " points left.");
    
    							}
    						} catch (Exception e) {
    							c.sendMessage("Our API services are currently offline. We are working on bringing it back up");
    							e.printStackTrace();
    						}
    					}
    				}.start();
    			}
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    May 2017
    Posts
    91
    Thanks given
    36
    Thanks received
    4
    Rep Power
    33
    bump, can anyone convert it for me? :C

    this is where i get error.... :C

    Attached image
    Reply With Quote  
     

  6. #6  
    Community Veteran


    Arch337's Avatar
    Join Date
    Sep 2008
    Posts
    2,950
    Thanks given
    210
    Thanks received
    349
    Rep Power
    1376
    Quote Originally Posted by welpp View Post
    bump, can anyone convert it for me? :C

    this is where i get error.... :C

    Attached image
    Because you declear args as null and then try get a value from null which is null.
    String[] args = null;


    "A fail act is something you do regular, but a dumb act is something you can learn from"
    Spoiler for Problem?:
    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: 1
    Last Post: 05-05-2016, 09:16 PM
  2. Replies: 7
    Last Post: 03-02-2011, 11:11 PM
  3. Replies: 8
    Last Post: 05-19-2010, 12:15 PM
  4. Replies: 5
    Last Post: 04-09-2010, 04:49 AM
  5. need help to fix 1 error
    By Skillz Ftw in forum Help
    Replies: 6
    Last Post: 03-19-2009, 07:56 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
  •