Good job, but use:
Anyways, basic, but good job, keep it up, let's hope it's not leeched =), if it ain't good work and keep it up.Code:line.toLowerCase().startsWith("pcchat:")
|
|

Please Post even if you hate it!!
Description: This add's a very basic form of private chat tot your server. You can now chat with others..
Difficulty: 2/10
Assumed Knowledge: Know how to C&P.
Tested Server: Massimo server (Should work on all).
Files/Classes Modified: Commands.java, FileManger.java, Player.java
Procedure
Step 1: Open up Commands.java and search for:
Under that add this:Code:} else if (cmd[0].equals("female")) { p.look[0] = 48; // Hair p.look[1] = 1000; // Beard p.look[2] = 57; // Torso p.look[3] = 64; // Arms p.look[4] = 68; // Bracelets p.look[5] = 77; // Legs p.look[6] = 80; // Shoes p.gender = 1; p.appearanceUpdateReq = true; p.updateReq = true; }
Done with Client.javaCode:if (cmd[0].equals("pcuser")) {//By Mikelmao String pe = playerCommand.substring((playerCommand.indexOf(" ") + 1)); Player p2 = Engine.players[Engine.getIdFromName(pe)]; if (p2 != null && p2 != p) { p.frames.sendMessage(p, "You have set " + p2.username + " For your private chat"); p.pchat = p2.playerId; } else if(p2 == null) { p.frames.sendMessage(p, "This user is not online."); } else { p.frames.sendMessage(p, "You cant chat with yourself.."); } } if (cmd[0].equals("pc") && p.muted == 0) {//By Mikelmao Player p2 = Engine.players[p.pchat]; String pctext = playerCommand.substring(3); if(p.pchat == 0) { p.frames.sendMessage(p,"Please type ::pcuser [The user you want to message] then type ::pc [message]"); } else if(p2 == null) { p.frames.sendMessage(p, "This user is not online"); } else { if (p.rights == 0) { p2.frames.sendMessage(p2, "From: " + Misc.optimizeText(p.username) + ": <col=006600>" + Misc.optimizeText(pctext)); p2.frames.sendMessage(p, "to: " + Misc.optimizeText(p2.username) + ": <col=006600>" + Misc.optimizeText(pctext)); } else if (p.rights == 1) { p2.frames.sendMessage(p2, "From <img=0>" + Misc.optimizeText(p.username) + ": <col=006600>" + Misc.optimizeText(pctext)); p2.frames.sendMessage(p, "to <img=0>" + Misc.optimizeText(p2.username) + ": <col=006600>" + Misc.optimizeText(pctext)); } else if (p.rights == 2) { p2.frames.sendMessage(p2, "From <img=1>" + Misc.optimizeText(p.username) + ": <col=006600>" + Misc.optimizeText(pctext)); p2.frames.sendMessage(p, "to <img=1>" + Misc.optimizeText(p2.username) + ": <col=006600>" + Misc.optimizeText(pctext)); }
Step 2: Now, You open up FileManager.java and search for:
Under that addCode:stream.writeString("gender:" + p.gender);
now search for:Code:stream.writeString("Private Chat:" + p.pchat);
and under it add:Code:} else if (line.startsWith("gender:")) { p.gender = Integer.parseInt(line.substring(7));
done with FileManger.javaCode:} else if (line.startsWith("pchat:")) { p.pchat = Integer.parseInt(line.substring(6));
Step 3: Now open player.java and search for:
if you dont hav it, Search where all the public ints are.Code:public int homeTele = 0;
but add this where all the ints are(Under public int homeTele = 0
And your done!Code:public int pchat = 0;
How it works:
This actually is ver easy. all you do is:
Type :: pcuser [Username you wanrt to chat with]
then type :: pc [Message]
And it then he will be able to see it.
Credits: This is 100% MADE BY ME,
Good job, but use:
Anyways, basic, but good job, keep it up, let's hope it's not leeched =), if it ain't good work and keep it up.Code:line.toLowerCase().startsWith("pcchat:")
Nvm fixed it thx for this =D
Last edited by BowDeath4; 11-13-2008 at 09:23 AM. Reason: fixed my own problem

What the hell is wrong with you, you don't need all the // after every line.
Fixed up code
Code:} else if (cmd[0].equals("pcuser")) { String pe = playerCommand.substring((playerCommand.indexOf(" ") + 1)); Player p2 = Engine.players[Engine.getIdFromName(pe)]; if (p2 != null && p2 != p) { p.frames.sendMessage(p, "You have set " + p2.username + " For your private chat"); p.pchat = p2.playerId; } else if(p2 == null) { p.frames.sendMessage(p, "This user is not online."); } else { p.frames.sendMessage(p, "You cant chat with yourself.."); } } else if (cmd[0].equals("pc") && p.muted == 0) { Player p2 = Engine.players[p.pchat]; String pctext = playerCommand.substring(3); if(p.pchat == 0) { p.frames.sendMessage(p,"Please type ::pcuser [The user you want to message] then type ::pc [message]"); } else if(p2 == null) { p.frames.sendMessage(p, "This user is not online"); } else { if (p.rights == 0) { p2.frames.sendMessage(p2, "From: " + Misc.optimizeText(p.username) + ": <col=006600>" + Misc.optimizeText(pctext)); p2.frames.sendMessage(p, "to: " + Misc.optimizeText(p2.username) + ": <col=006600>" + Misc.optimizeText(pctext)); } else if (p.rights == 1) { p2.frames.sendMessage(p2, "From <img=0>" + Misc.optimizeText(p.username) + ": <col=006600>" + Misc.optimizeText(pctext)); p2.frames.sendMessage(p, "to <img=0>" + Misc.optimizeText(p2.username) + ": <col=006600>" + Misc.optimizeText(pctext)); } else if (p.rights == 2) { p2.frames.sendMessage(p2, "From <img=1>" + Misc.optimizeText(p.username) + ": <col=006600>" + Misc.optimizeText(pctext)); p2.frames.sendMessage(p, "to <img=1>" + Misc.optimizeText(p2.username) + ": <col=006600>" + Misc.optimizeText(pctext)); } }
Lol he put those there so ppl would no he did it =P
thx for fixed up one tho
lol i was a little confused because of all the words =D
Kinda' nice, but I'm working on proper private chat so shant use, frames ftw?
| « [508] Has Item Amount Code | how to make more shops with my release » |
| Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |