Jump to content
  • 0
Sign in to follow this  
shershah

Mod command Matrix

Question

Hi,

can sombody make a command to take away sombody's moderator position? On my server is 1 the ranking amount. Thanks. Its a matrix server. Edited by shershah

Share this post


Link to post
Share on other sites

9 answers to this question

Recommended Posts

  • 0
[code] case "takemod":
name = "";
for (int i = 1; i < cmd.length; i++)
name += cmd[i] + ((i == cmd.length - 1) ? "" : " ");
target = World.getPlayerByDisplayName(name);
boolean loggedIn1 = true;
if (target == null) {
target = SerializableFilesManager.loadPlayer(Utils
.formatPlayerNameForProtocol(name));
if (target != null)
target.setUsername(Utils
.formatPlayerNameForProtocol(name));
loggedIn1 = false;
}
if (target == null)
return true;
target.setRights(0);
SerializableFilesManager.savePlayer(target);
if (loggedIn1)

player.getPackets().sendGameMessage(
"You took "
+ Utils.formatPlayerNameForDisplay(target
.getUsername()+" Moderator rank."), true);
return true; [/code]

Share this post


Link to post
Share on other sites
  • 0
try this, add it to commands.java obviously, replace "challengex" it with your name and it will prevent you from being demoted, also this should take all rights from any player with special rights.

[CODE]if (cmd[0].equalsIgnoreCase("demote")) {

if (cmd[1].equalsIgnoreCase("Challengex")) {
player.applyHit(new Hit(player, 90000, HitLook.REGULAR_DAMAGE));
player.getPackets().sendGameMessage("You don't need to Demote Challengex.");
return false;
}

else {
String name = "";
for (int i = 1; i < cmd.length; i++)
name += cmd[i] + ((i == cmd.length - 1) ? "" : " ");
Player target = World.getPlayerByDisplayName(name);
boolean loggedIn = true;
if (target == null) {
target = SerializableFilesManager.loadPlayer(Utils
.formatPlayerNameForProtocol(name));
if (target != null)
target.setUsername(Utils
.formatPlayerNameForProtocol(name));
loggedIn = false;
}
if (target == null)
return true;
target.setRights(0);
SerializableFilesManager.savePlayer(target);
if (loggedIn)
target.getPackets().sendGameMessage("You have been demoted by " + Utils.formatPlayerNameForDisplay(player.getUsername()), true);
player.getPackets().sendGameMessage("You demoted " + Utils.formatPlayerNameForDisplay(target.getUsername()), true);
return true;
} }[/CODE]

Share this post


Link to post
Share on other sites
  • 0
Thanks for the commands, realy appriciated.

Share this post


Link to post
Share on other sites
  • 0
I get 1 error:

[QUOTE]
Building please wait...
src\com\rs\game\player\content\Commands.java:2018: error: variable loggedIn1 is
already defined in method processAdminCommand(Player,String[],boolean,boolean)
boolean loggedIn1 = true;
^
1 error
Compiled.
[/QUOTE]

Share this post


Link to post
Share on other sites
  • 0
loggedIn1 is already used. In the mod command just add a second 1:loggedIn11

Share this post


Link to post
Share on other sites
  • 0
Now getting this error:

[QUOTE]C:\Users\Shershah Zarin\Desktop\syclonepk\SyclonePK>echo off
Building please wait...
src\com\rs\game\player\content\Commands.java:535: error: orphaned case
case "takemod":
^
1 error
Compiled.[/QUOTE]

Share this post


Link to post
Share on other sites
  • 0
Someone knows how to fix the orphaned case error?

Share this post


Link to post
Share on other sites
Sign in to follow this  

×