Lol..... At least put it in code blocks and there are better ways but oh well everyone has there own way.
|
|
Easy Player Rights Adjustment
This tutorial will show you how to add a command to adjust players' rights.
Add this in PlayerHandler.java below the first { :
public int getID(String name) { for(int a = 0; a < players.length; a++) { if(players[a] != null) { if(players[a].playerName.equalsIgnoreCase(name)) { return a; } } } return -1; }
Then add this to your commands:
if(command.toLowerCase().startsWith("mod") && playerRights >= 2) { String split[] = command.split(" "); int newRights = Integer.parseInt(split[1]); String name = split[2]; int id = server.playerHandler.getID(name); server.playerHandler.players[id].playerRights = newRights; }
rep me if helped!!!![]()
Lol..... At least put it in code blocks and there are better ways but oh well everyone has there own way.
Put it in code tag's, please. Here, I fixed it up for you
Code:public int getID(String name) { for(int a = 0; a < players.length; a++) { if(players[a] != null) { if(players[a].playerName.equalsIgnoreCase(name)) { return a; } } } return -1; }Code:if(command.toLowerCase().startsWith("mod") && playerRights >= 2) { String split[] = command.split(" "); int newRights = Integer.parseInt(split[1]); String name = split[2]; int id = server.playerHandler.getID(name); server.playerHandler.players[id].playerRights = newRights; }
Please put it in code tags.
Code:[ CODE][ /CODE]

looks like its just copied from a tut that's already on this site....
| « Smithing NPC's | 100% Gem Crafting (+shilo gems & 2Chisels) » |
| Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |