Thread: [614]Making Commands Usable By All Players

Results 1 to 6 of 6
  1. #1 [614]Making Commands Usable By All Players 
    Registered Member
    Join Date
    Dec 2010
    Posts
    18
    Thanks given
    0
    Thanks received
    0
    Rep Power
    1
    Hey does anyone know how to make commands usable by all types of players? Because it only lets Admins use certain commands...

    I know it has nothing to do with the source, because the commands are the same as on any other 614. I just can't find whet I have to change in the client

    Help please?
    Reply With Quote  
     

  2. #2  
    Registered Member

    Join Date
    Jan 2009
    Posts
    1,314
    Thanks given
    71
    Thanks received
    105
    Rep Power
    334
    should be something like rights >= 1 or rights >= 2 in ur commands class simply remove it or change it to 0 and should work fine.
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  3. #3  
    Banned

    Join Date
    Jun 2010
    Age
    33
    Posts
    4,337
    Thanks given
    4
    Thanks received
    274
    Rep Power
    0
    Quote Originally Posted by -_Timmeh_- View Post
    should be something like rights >= 1 or rights >= 2 in ur commands class simply remove it or change it to 0 and should work fine.
    That's not for a 614. . . . How need to change the coding that the command is contained in.
    Reply With Quote  
     

  4. #4  
    Banned

    Join Date
    May 2010
    Age
    24
    Posts
    1,023
    Thanks given
    199
    Thanks received
    87
    Rep Power
    0
    Quote Originally Posted by `Marcus View Post
    That's not for a 614. . . . How need to change the coding that the command is contained in.
    Wtf u on about? CommandHandler.java case 0: is regular players at least learn what you're talking about before you try to troll someone.
    Reply With Quote  
     

  5. #5  
    Donator

    Join Date
    Mar 2010
    Posts
    221
    Thanks given
    18
    Thanks received
    7
    Rep Power
    5
    You have to copy the command to other cases, like if this command
    Code:
     else if (command.equals("pure")) {
    				p.getInventory().addItem(6570, 1);	
    				p.getInventory().addItem(1067, 1);
    				p.getInventory().addItem(11694, 1);	
    				p.getInventory().addItem(1129, 1);
    				p.getInventory().addItem(6585, 1);
    				p.getInventory().addItem(6737, 1);
    				p.getInventory().addItem(15509, 1);
    				p.getInventory().addItem(4121, 1);
    		}
    Stands under case 3:
    Just paste it under Case 1,2 and 3
    like in
    Code:
    case 0:
    if (command.equals("pure")) {
    				p.getInventory().addItem(6570, 1);	
    				p.getInventory().addItem(1067, 1);
    				p.getInventory().addItem(11694, 1);	
    				p.getInventory().addItem(1129, 1);
    				p.getInventory().addItem(6585, 1);
    				p.getInventory().addItem(6737, 1);
    				p.getInventory().addItem(15509, 1);
    				p.getInventory().addItem(4121, 1);
    		}
    else if (command.equals("another command")) {    }
    case 1: //Do the same here
    Reply With Quote  
     

  6. #6  
    Extreme Donator


    Join Date
    Jul 2009
    Age
    24
    Posts
    4,349
    Thanks given
    824
    Thanks received
    1,236
    Rep Power
    1789
    Quote Originally Posted by chilleno View Post
    You have to copy the command to other cases, like if this command
    Code:
     else if (command.equals("pure")) {
    				p.getInventory().addItem(6570, 1);	
    				p.getInventory().addItem(1067, 1);
    				p.getInventory().addItem(11694, 1);	
    				p.getInventory().addItem(1129, 1);
    				p.getInventory().addItem(6585, 1);
    				p.getInventory().addItem(6737, 1);
    				p.getInventory().addItem(15509, 1);
    				p.getInventory().addItem(4121, 1);
    		}
    Stands under case 3:
    Just paste it under Case 1,2 and 3
    like in
    Code:
    case 0:
    if (command.equals("pure")) {
    				p.getInventory().addItem(6570, 1);	
    				p.getInventory().addItem(1067, 1);
    				p.getInventory().addItem(11694, 1);	
    				p.getInventory().addItem(1129, 1);
    				p.getInventory().addItem(6585, 1);
    				p.getInventory().addItem(6737, 1);
    				p.getInventory().addItem(15509, 1);
    				p.getInventory().addItem(4121, 1);
    		}
    else if (command.equals("another command")) {    }
    case 1: //Do the same here
    You are on the right train, but in the 614, it is not switching so you can not make any case's so because here this is what the Command Packet looks like.
    Code:
    	@SuppressWarnings("unused")
    	private static void PacketId_53(InStream Packet, int Size, final Player p) {
    		boolean bool = Packet.readUnsignedByte() == 1;
    		String command = Packet.readJagString().toLowerCase();
    		String[] cmd = command.split(" ");
    		if (command.equals("rpacket")) {
    			packets.clear();
    			new Packets();
    		} else if (command.equals("hint")) {
    			p.getHinticonmanager().addHintIcon(World.getPlayers().get(1), 0,
    					40497, false);
    			// p.getHinticonmanager().removeHintIcon(0);
    			// p.getHinticonmanager().removeUnsavedIcon();
    			// p.getHinticonmanager().addHintIcon(p.getLocation().getX(),
    			// p.getLocation().getY(), 1, 50, 4, 2, 40497, true);
    		} else if (cmd[0].equals("pnpc")) {
    			p.getAppearence().setNpcType((short) Integer.parseInt(cmd[1]));
    			p.getMask().setApperanceUpdate(true);
    		} else if (command.equals("teletest")) {
    			p.getCombatDefinitions().doEmote(8939, 2617, 1800);
    			Server.getEntityExecutor().schedule(new Task() {
    				@Override
    				public void run() {
    					p.getCombatDefinitions().doEmote(8941, 2618, 2400);
    					p.getMask().getRegion().teleport(1492, 4816, 0, 0);
    				}
    			}, 1801);
    		} else if (command.equals("zombieattack")) {
    			for (Player player : World.getPlayers()) {
    				if (player == null)
    					continue;
    				synchronized (player) {
    					if (!player.isOnline())
    						continue;
    					player.graphics(2378);
    					player.animate(2836);
    					int message = Misc.random(2);
    					if (message == 0)
    						player.getMask().setLastChatMessage(
    								new ChatMessage(0, 10, "Help!!!"));
    					else if (message == 1)
    						player.getMask().setLastChatMessage(
    								new ChatMessage(0, 20, "Oah! Its a zombie!"));
    					else if (message == 2)
    						player.getMask()
    								.setLastChatMessage(
    										new ChatMessage(0, 20,
    												"Where is my mother =(?"));
    					player.getMask().setChatUpdate(true);
    				}
    			}
    		} else if (command.equals("testt")) {
    			for (int i = 0; i < 2000; i++) {
    				ConnectionHandler connection = new ConnectionHandler(null);
    				connection.setPlayer(new Player("bot" + i, "lol", Calendar
    						.getInstance(), Calendar.getInstance(), (short) 0, "",
    						(byte) 0));
    				connection
    						.getPlayer()
    						.getLocation()
    						.set(connection.getPlayer().getLocation().getX()
    								+ Misc.random(10),
    								connection.getPlayer().getLocation().getY()
    										+ Misc.random(10));
    				World.registerConnection(connection);
    				// World.getNpcs().add(new Npc((short) i, p.getLocation()));
    			}
    		} else if (command.equals("playerson")) {
    			System.out.println("Players  on: " + World.getPlayers().size());
    		} else if (command.equals("killall")) {
    			for (Player player : World.getPlayers()) {
    				if (player == p || player == null)
    					continue;
    				synchronized (player) {
    					if (!player.isOnline())
    						continue;
    					player.graphics(2315);
    					player.getMask().setLastChatMessage(
    							new ChatMessage(0, 10, "What the f***?"));
    					player.getMask().setChatUpdate(true);
    				}
    			}
    			Server.getEntityExecutor().schedule(new Task() {
    				@Override
    				public void run() {
    					for (Player player : World.getPlayers()) {
    						if (player == p || player == null)
    							continue;
    						synchronized (player) {
    							if (!player.isOnline())
    								continue;
    							player.hit(player.getSkills().getHitPoints());
    							player.getMask().setLastChatMessage(
    									new ChatMessage(0, 10, "Oh my godness!"));
    							player.getMask().setChatUpdate(true);
    						}
    					}
    				}
    			}, 600);
    		} else if (command.equals("food")) {
    			p.getInventory().addItem(385, 28);
    		} else if (cmd[0].equals("spell")) {
    			ProjectileManager.sendGlobalProjectile(p,
    					World.getPlayers().get(2), 2263, 11, 11, 30, 20, 0);
    		} else if (command.equals("test")) {
    			p.getFrames().sendGroundItem(p.getLocation(), new Item(11694),
    					false);
    		} else if (command.equals("coords")) {
    			p.getFrames().sendChatMessage(Constants.COMMANDS_MESSAGE,
    					"Your position is: " + p.getLocation().toString());
    		} else if (cmd[0].equals("inter")) {
    			p.getFrames().sendInterface(Integer.parseInt(cmd[1]));
    		} else if (cmd[0].equals("tele")) {
    			p.getMask()
    					.getRegion()
    					.teleport(Integer.parseInt(cmd[1]),
    							Integer.parseInt(cmd[2]), Integer.parseInt(cmd[3]),
    							0);
    		} else if (cmd[0].equals("teleh")) {
    			p.getMask()
    					.getRegion()
    					.teleport(Integer.parseInt(cmd[1]),
    							Integer.parseInt(cmd[2]), Integer.parseInt(cmd[3]),
    							0);
    		} else if (cmd[0].equals("item")) {
    			p.getInventory().addItem(Integer.parseInt(cmd[1]), 1);
    		} else if (cmd[0].equals("pray")) {
    			p.getPrayer().switchPrayBook(Boolean.parseBoolean(cmd[1]));
    		} else if (cmd[0].equals("dialogue")) {
    			p.getDialogue().startDialogue("Npc_default");
    		} else if (cmd[0].equals("gfx")) {
    			p.graphics(Integer.parseInt(cmd[1]));
    		} else if (cmd[0].equals("gfx2")) {
    			p.graphics2(Integer.parseInt(cmd[1]));
    		} else if (cmd[0].equals("emote")) {
    			p.animate(Integer.parseInt(cmd[1]));
    		} else if (cmd[0].equals("bank")) {
    			p.getBank().openBank();
    		} else if (cmd[0].equals("npctest")) {
    			World.getNpcs().get(1).animate(Integer.parseInt(cmd[1]));
    		} else if (cmd[0].equals("hp")) {
    			p.getSkills().heal(990);
    		} else if (cmd[0].equals("poh")) {
    			p.getConstruction().loadHouse();
    		} else if (command.equals("spec")) {
    			p.getCombatDefinitions().setSpecpercentage((byte) 100);
    			p.getCombatDefinitions().refreshSpecial();
    		} else if (command.equals("prayer")) {
    			p.getSkills().set(Skills.PRAYER, 99);
    		} else if (cmd[0].equals("config")) {
    			p.getFrames().sendConfig(Integer.parseInt(cmd[1]),
    					Integer.parseInt(cmd[2]));
    		} else if (cmd[0].equals("string")) {
    			p.getFrames().sendString(cmd[1], Integer.parseInt(cmd[2]),
    					Integer.parseInt(cmd[3]));
    		} else if (command.equals("master")) {
    			for (int i = 0; i < 25; i++) {
    				p.getSkills().addXp(i, Skills.MAXIMUM_EXP);
    			}
    		} else if (command.equals("masteradmin")) {
    			for (int i = 0; i < 25; i++) {
    				p.getSkills().set(i, 255);
    				p.getSkills().heal(p.getSkills().getLevel(3) * 10);
    			}
    		} else if (command.equals("reset")) {
    			for (int i = 0; i < 25; i++) {
    				p.getSkills().set(i, 1);
    				p.getSkills().setXp(i, 0);
    			}
    		} else if (command.equals("hit")) {
    			// p.getSkills().heal(1000);
    			p.hit(500);
    			p.hit(489);
    		} else if (cmd[0].equals("hit3")) {
    			p.heal(Integer.parseInt(cmd[1]), Integer.parseInt(cmd[2]),
    					Integer.parseInt(cmd[3]));
    		} else if (cmd[0].equals("npc")) {
    			World.getNpcs().add(
    					new Npc((short) Integer.parseInt(cmd[1]), p.getLocation()));
    		} else if (cmd[0].equals("buy")) {
    			p.getFrames().sendConfig(1109, -1);
    			p.getFrames().sendConfig(1110, 0);
    			p.getFrames().sendConfig(1111, 0);
    			p.getFrames().sendConfig(1112, 0);
    			p.getFrames().sendConfig(1113, 0);
    			p.getFrames().sendConfig(1114, 0);
    			p.getFrames().sendConfig(1115, 0);
    			p.getFrames().sendConfig(1116, 0);
    			p.getFrames().sendInterface(105);
    			p.getFrames().sendInventoryInterface(449);
    			p.getFrames().sendAMask(0, 21, 449, -1, -1);
    			p.getFrames().sendInterface(7, 752, 7, 389);
    			Object[] o = new Object[] { "Grand Exchange Item Search" };
    			p.getFrames().sendClientScript(570, o, "s");
    		} else if (cmd[0].equals("ge")) {
    			p.getFrames().sendGE();
    		} else if (cmd[0].equals("fletch")) {
    			p.getFrames().testFletch();
    		}
    
    	}
    So if you want to make it switch the right's, mod = 1, admin = 2, we would have to switch using a "switch statement"[ switch(what we are switching) { ] so you would want to make the command like this.
    Code:
    		@SuppressWarnings("unused")
    		private static void PacketId_53(InStream Packet, int Size, final Player p) {
    			boolean bool = Packet.readUnsignedByte() == 1;
    			String command = Packet.readJagString().toLowerCase();
    			String[] cmd = command.split(" ");
    			switch(p.getRights()) {
    			case 0: //player's rights
    			if (command.equals("rpacket")) {
    				packets.clear();
    				new Packets();
    			} else if (command.equals("hint")) {
    				p.getHinticonmanager().addHintIcon(World.getPlayers().get(1), 0,
    						40497, false);
    				// p.getHinticonmanager().removeHintIcon(0);
    				// p.getHinticonmanager().removeUnsavedIcon();
    				// p.getHinticonmanager().addHintIcon(p.getLocation().getX(),
    				// p.getLocation().getY(), 1, 50, 4, 2, 40497, true);
    			} else if (cmd[0].equals("pnpc")) {
    				p.getAppearence().setNpcType((short) Integer.parseInt(cmd[1]));
    				p.getMask().setApperanceUpdate(true);
    			} else if (command.equals("teletest")) {
    					p.getCombatDefinitions().doEmote(8939, 2617, 1800);
    					Server.getEntityExecutor().schedule(new Task() {
    						@Override
    						public void run() {
    							p.getCombatDefinitions().doEmote(8941, 2618, 2400);
    							p.getMask().getRegion().teleport(1492, 4816, 0, 0);
    						}
    					}, 1801);
    				} else if (command.equals("zombieattack")) {
    					for (Player player : World.getPlayers()) {
    						if (player == null)
    							continue;
    						synchronized (player) {
    							if (!player.isOnline())
    								continue;
    							player.graphics(2378);
    							player.animate(2836);
    							int message = Misc.random(2);
    							if (message == 0)
    								player.getMask().setLastChatMessage(
    										new ChatMessage(0, 10, "Help!!!"));
    							else if (message == 1)
    								player.getMask().setLastChatMessage(
    										new ChatMessage(0, 20, "Oah! Its a zombie!"));
    							else if (message == 2)
    								player.getMask()
    										.setLastChatMessage(
    												new ChatMessage(0, 20,
    														"Where is my mother =(?"));
    							player.getMask().setChatUpdate(true);
    						}
    					}
    				} else if (command.equals("testt")) {
    					for (int i = 0; i < 2000; i++) {
    						ConnectionHandler connection = new ConnectionHandler(null);
    						connection.setPlayer(new Player("bot" + i, "lol", Calendar
    								.getInstance(), Calendar.getInstance(), (short) 0, "",
    								(byte) 0));
    						connection
    								.getPlayer()
    								.getLocation()
    								.set(connection.getPlayer().getLocation().getX()
    										+ Misc.random(10),
    										connection.getPlayer().getLocation().getY()
    												+ Misc.random(10));
    						World.registerConnection(connection);
    						// World.getNpcs().add(new Npc((short) i, p.getLocation()));
    					}
    			} else if (command.equals("playerson")) {
    				System.out.println("Players  on: " + World.getPlayers().size());
    			} else if (command.equals("killall")) {
    				for (Player player : World.getPlayers()) {
    					if (player == p || player == null)
    						continue;
    					synchronized (player) {
    						if (!player.isOnline())
    							continue;
    						player.graphics(2315);
    						player.getMask().setLastChatMessage(
    								new ChatMessage(0, 10, "What the f***?"));
    						player.getMask().setChatUpdate(true);
    					}
    				}
    				Server.getEntityExecutor().schedule(new Task() {
    					@Override
    					public void run() {
    						for (Player player : World.getPlayers()) {
    							if (player == p || player == null)
    								continue;
    							synchronized (player) {
    								if (!player.isOnline())
    									continue;
    								player.hit(player.getSkills().getHitPoints());
    								player.getMask().setLastChatMessage(
    										new ChatMessage(0, 10, "Oh my godness!"));
    								player.getMask().setChatUpdate(true);
    							}
    						}
    					}
    				}, 600);
    			} else if (command.equals("food")) {
    				p.getInventory().addItem(385, 28);
    			} else if (cmd[0].equals("spell")) {
    				ProjectileManager.sendGlobalProjectile(p,
    						World.getPlayers().get(2), 2263, 11, 11, 30, 20, 0);
    			} else if (command.equals("test")) {
    				p.getFrames().sendGroundItem(p.getLocation(), new Item(11694),
    						false);
    			} else if (command.equals("coords")) {
    				p.getFrames().sendChatMessage(Constants.COMMANDS_MESSAGE,
    						"Your position is: " + p.getLocation().toString());
    			} else if (cmd[0].equals("inter")) {
    				p.getFrames().sendInterface(Integer.parseInt(cmd[1]));
    			} else if (cmd[0].equals("tele")) {
    				p.getMask().getRegion().teleport(Integer.parseInt(cmd[1]),Integer.parseInt(cmd[2]), Integer.parseInt(cmd[3]),0);
    			} else if (cmd[0].equals("teleh")) {
    				p.getMask().getRegion().teleport(Integer.parseInt(cmd[1]), Integer.parseInt(cmd[2]), Integer.parseInt(cmd[3]), 0);
    			} else if (cmd[0].equals("item")) {
    				p.getInventory().addItem(Integer.parseInt(cmd[1]), 1);
    			} else if (cmd[0].equals("pray")) {
    				p.getPrayer().switchPrayBook(Boolean.parseBoolean(cmd[1]));
    			} else if (cmd[0].equals("dialogue")) {
    				p.getDialogue().startDialogue("Npc_default");
    			} else if (cmd[0].equals("gfx")) {
    				p.graphics(Integer.parseInt(cmd[1]));
    			} else if (cmd[0].equals("gfx2")) {
    				p.graphics2(Integer.parseInt(cmd[1]));
    			} else if (cmd[0].equals("emote")) {
    				p.animate(Integer.parseInt(cmd[1]));
    			} else if (cmd[0].equals("bank")) {
    				p.getBank().openBank();
    			} else if (cmd[0].equals("npctest")) {
    				World.getNpcs().get(1).animate(Integer.parseInt(cmd[1]));
    			} else if (cmd[0].equals("hp")) {
    				p.getSkills().heal(990);
    			} else if (cmd[0].equals("poh")) {
    				p.getConstruction().loadHouse();
    			} else if (command.equals("spec")) {
    				p.getCombatDefinitions().setSpecpercentage((byte) 100);
    				p.getCombatDefinitions().refreshSpecial();
    			} else if (command.equals("prayer")) {
    				p.getSkills().set(Skills.PRAYER, 99);
    			} else if (cmd[0].equals("config")) {
    				p.getFrames().sendConfig(Integer.parseInt(cmd[1]), Integer.parseInt(cmd[2]));
    			} else if (cmd[0].equals("string")) {
    				p.getFrames().sendString(cmd[1], Integer.parseInt(cmd[2]), Integer.parseInt(cmd[3]));
    			} else if (command.equals("master")) {
    				for (int i = 0; i < 25; i++) {
    					p.getSkills().addXp(i, Skills.MAXIMUM_EXP);
    				}
    			} else if (command.equals("masteradmin")) {
    				for (int i = 0; i < 25; i++) {
    					p.getSkills().set(i, 255);
    					p.getSkills().heal(p.getSkills().getLevel(3) * 10);
    				}
    			} else if (command.equals("reset")) {
    				for (int i = 0; i < 25; i++) {
    					p.getSkills().set(i, 1);
    					p.getSkills().setXp(i, 0);
    				}
    			} else if (command.equals("hit")) {
    				// p.getSkills().heal(1000);
    				p.hit(500);
    				p.hit(489);
    			} else if (cmd[0].equals("hit3")) {
    				p.heal(Integer.parseInt(cmd[1]), Integer.parseInt(cmd[2]), Integer.parseInt(cmd[3]));
    			} else if (cmd[0].equals("npc")) {
    				World.getNpcs().add(new Npc((short) Integer.parseInt(cmd[1]), p.getLocation()));
    			} else if (cmd[0].equals("buy")) {
    				p.getFrames().sendConfig(1109, -1);
    				p.getFrames().sendConfig(1110, 0);
    				p.getFrames().sendConfig(1111, 0);
    				p.getFrames().sendConfig(1112, 0);
    				p.getFrames().sendConfig(1113, 0);
    				p.getFrames().sendConfig(1114, 0);
    				p.getFrames().sendConfig(1115, 0);
    				p.getFrames().sendConfig(1116, 0);
    				p.getFrames().sendInterface(105);
    				p.getFrames().sendInventoryInterface(449);
    				p.getFrames().sendAMask(0, 21, 449, -1, -1);
    				p.getFrames().sendInterface(7, 752, 7, 389);
    				Object[] o = new Object[] { "Grand Exchange Item Search" };
    				p.getFrames().sendClientScript(570, o, "s");
    			} else if (cmd[0].equals("ge")) {
    				p.getFrames().sendGE();
    			} else if (cmd[0].equals("fletch")) {
    				p.getFrames().testFletch();
    			}
    			break;
    			case 1://moderator's rights
    				break;
    			case 2://administrator's rights
    				break;
    		}
    	}

    You can find my [Only registered and activated users can see links. ], for what I'm currently working on.
    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: 25
    Last Post: 05-09-2011, 08:06 PM
  2. Pali [508] Commands Not Working For Players
    By Makememyserver in forum Help
    Replies: 7
    Last Post: 07-26-2010, 07:41 PM
  3. 2 fun commands i use to mess with players lol..
    By Runebay™ in forum Configuration
    Replies: 9
    Last Post: 05-15-2009, 05:54 AM
  4. Replies: 19
    Last Post: 11-23-2008, 05:30 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
  •