Well my new server is going great! Were having alot of people starting to join. Now i need some help with some command and bugs i have. And if you help i can make you donator if you want.
__________________________________________________ _________________
Ok ,first the commands. Im making buy and sell commands, like yell but in different colors, blue and green.
Code:
if (command.startsWith("sell") && command.length() > 5 && !muted)
{
String text = command.substring(5);
yell(" " + playerName + ": " + Character.toUpperCase(text.charAt(0)) + text.substring(1));
}
if (command.startsWith("buy") && command.length() > 5 && !muted)
{
String text = command.substring(5);
yell(" " + playerName + " - " + Character.toUpperCase(text.charAt(0)) + text.substring(1));
}
I want the sell to be blue, and the buy to be green. I have tried putting @gre@ and @blu@ in so many different places and get errors, where do i put them for the whole thing to be green or blue?
Now, some more commands un-ban, un-mute, and un-jail:
Code:
if (command.startsWith("mute") && playerRights > 0) {
try {
String otherPName = command.substring(5);
int otherPIndex = PlayerHandler.getPlayerID(otherPName);
if (otherPIndex != -1) {
client p = (client) server.playerHandler.players[otherPIndex];
p.muted = true;
yell(" "+playerName+" has Muted "+p.playerName+" ");
writeLog(p.playerName, "mutes");
sM("You have muted "+p.playerName+"!");
} else {
sM("The name doesnt exist.");
}
} catch (Exception e) {
sM("Try entering a name you want to mute..");
}
}
How would i make an un-mute command out of this. I know if has to be deleted instead of written, so how would i make it deleteLog instead of writeLog?
My unjail command:
Code:
if (command.startsWith("unjail") && playerRights >= 1) {
try {
String otherPName = command.substring(5);
int otherPIndex = PlayerHandler.getPlayerID(otherPName);
if (otherPIndex != -1) {
client p = (client) server.playerHandler.players[otherPIndex];
p.toX = 3093;
p.toY = 3490;
p.action = 0;
p.sM(
"You have been un-jailed by " + playerName);
yell(" "+playerName+" has jailed "+p.playerName+" ");
sM("You have jailed "+p.playerName+".");
} else {
sM("The name doesnt exist.");
}
} catch (Exception e) {
sM("Try entering a name you want to jail..");
}
}
But whenever i use this one i get "The name doesnt exist." Whats wrong?
My ban command:
Code:
if (command.startsWith("ban") && playerRights > 1) {
try {
String otherPName = command.substring(8);
int otherPIndex = PlayerHandler.getPlayerID(otherPName);
if (otherPIndex != -1) {
client p = (client) server.playerHandler.players[otherPIndex];
writeLog(p.playerName, "bans");
p.disconnected = true;
yell(" "+playerName+" has banned "+p.playerName+" ");
sM("You have banned "+p.playerName+"!");
} else {
sM("The name doesnt exist.");
}
} catch (Exception e) {
sM("Try entering a name you want to ban..");
}
}
Now i know this unban would work the same was as un-mute but once again how to i make it deleteLog instead of writeLog?
__________________________________________________ _______________
Now onto some glitches:
On my server there is a "Buy X" cap, originally 100 (Well 101 in java) so i decided to experiment. Well it seems that whenever you buy something over 100 it glitches and gives you a ridiculous amount of runes/arrows/etc....I decided to move to to 2000 but it still does it. Any ideas?
Also some minor help please, my portal code:
Code:
if(objectID == 2492){ //Staff tele
if (playerRights >= 1);
sM("Welcome to the Staff Area.");
toX = 2121;
toY = 4918;
triggerTele2(2121, 4918, 0);
}
For some reason regular players are allowed to go in, why?