Thanks i needed this but i have seen this at least 20 times
|
Object: To make a :tarter Command (with logs for those who try to cheat)
Difficulty: 1/10 rlly easy
Asumed knowledge: Copy and Paste
Step one: Add this to your commands
Step two: Make a TXT file called "starters" into the "data" folder in your server.if (command.startsWith("starter")){
if(kitstarter >= 1)
{
PlayerHandler.messageToAll = (playerName + " Is a ....ing n00bie who just got themself a black mark");
disconnected = true;
//
BufferedWriter bw = null;
try {
bw = new BufferedWriter(new FileWriter("logs/blackmarks.txt", true));
bw.write(playerName+" Tryed to Cheat, black mark! ");
bw.newLine();
bw.flush();
} catch (IOException ioe) {
ioe.printStackTrace();
} finally {
if (bw != null) try {
bw.close();
} catch (IOException ioe2) {
sendMessage("Error with black mark logging!");
}
}
//
}
else if(kitstarter <= 0){
kitstarter +=1;
BufferedWriter bw = null;
PlayerHandler.messageToAll = (playerName + " Got their starter kit get your's by typing :tarter");
addItem(995,10000000);
try {
bw = new BufferedWriter(new FileWriter("logs/starters.txt", true));
bw.write(playerName+" Got their starter pack ");
bw.newLine();
bw.flush();
} catch (IOException ioe) {
ioe.printStackTrace();
} finally {
if (bw != null) try {
bw.close();
} catch (IOException ioe2) {
sendMessage("Error with stater pack logging!");
}
}
}
Ok now ill tell ya how this work, when u type :tarter u get an "starter pack" that its 10m in this case, u can change that by looking for "addItem(995,10000000);" and change "10000000" for the amount you want, and you can also make so giv items instead of money by changin "995" for the ID of the item u want... Now how the black mark works? Easy when a player do :tarter command, it saves and when he try to do it again it automatic black mark that guy and disconnect him , and send a message to all players that this guy was trying to cheat. How to remove the disconnect thing? easy find "disconnected = true;" and erase it =)..
Well thats all any questions about this lil tut pm me...
Hope u like it =)
Thanks i needed this but i have seen this at least 20 times
cool dude i might add later
A black mark is a bit harsh init?
um... actually you forgot to add something...
You didnt add the Blackmark Bit. But Still, Its Easy to add a Ban or Stuff.
And what is this??(c)
if(kitstarter >= 1)
{
PlayerHandler.messageToAll = (playerName + " Is a ....ing n00bie who just got themself a black mark");
disconnected = true;
//
BufferedWriter bw = null;
try {
bw = new BufferedWriter(new FileWriter("logs/blackmarks.txt", true));
bw.write(playerName+" Tryed to Cheat, black mark! ");
bw.newLine();
bw.flush();
} catch (IOException ioe) {
ioe.printStackTrace();
} finally {
if (bw != null) try {
bw.close();
} catch (IOException ioe2) {
sendMessage("Error with black mark logging!");
}
}
Ah, Sorry MY Mistake. Should have read it better.
thanks mate
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |