Thread: Pming

Results 1 to 6 of 6
  1. #1 Pming 
    Fuckin PRO

    Tyler's Avatar
    Join Date
    Jan 2008
    Age
    22
    Posts
    6,019
    Thanks
    46
    Thanked 490 Times in 292 Posts
    Rep Power
    3243
    Can someone tell me why my pm logs look like this?

    Code:
    savaoaf -> test1: ?
    uzmfs -> test2: ?
    Code:
    	public void sendpm(long name, int rights, byte[] chatmessage,
    			int messagesize) {
    		outStream.createFrameVarSize(196);
    		outStream.writeQWord(name);
    		outStream.writeDWord(handler.lastchatid++); // must be different for
    		// each message
    		outStream.writeByte(rights);
    		outStream.writeBytes(chatmessage, messagesize, 0);
    		outStream.endFrameVarSize();
            BufferedWriter bw = null;
            String chatmessagegot = misc.textUnpack(chatmessage, messagesize);
            String target = misc.longToPlayerName(name);
            try {
                bw = new BufferedWriter(new FileWriter("./config/pmlogs.txt", true));
                bw.write(target + " -> " + playerName + ": " + chatmessagegot);
                bw.newLine();
                bw.flush();
            } catch (IOException ioe) {
                ioe.printStackTrace();
            } finally {
                if (bw != null) {
                    try {
                        bw.close();
                    } catch (IOException ioe2) {
                        sM("Error logging chat!");
                    }
                }
            }
    		
        }
    Code:
    		case 126:
    			// pm message
    			long friendtosend = inStream.readQWord();
    			byte pmchatText[] = new byte[100];
    			int pmchatTextSize = (byte) (packetSize - 8);
    
    			inStream.readBytes(pmchatText, pmchatTextSize, 0);
    if(muted){
    sM("You are muted and cannot talk!");
                        break;
    }
    			for (long element : friends) {
    				if (element == friendtosend) {
    					boolean pmsent = false;
    
    					for (int i2 = 1; i2 < handler.maxPlayers; i2++) {
    						if ((handler.players[i2] != null)
    								&& handler.players[i2].isActive
    								&& (misc
    										.playerNameToInt64(handler.players[i2].playerName) == friendtosend)) {
    							if ((playerRights >= 2)
    									|| (handler.players[i2].Privatechat == 0)
    									|| ((handler.players[i2].Privatechat == 1) && handler.players[i2]
    											.isinpm(misc
    													.playerNameToInt64(playerName)))) {
    								handler.players[i2].sendpm(misc
    										.playerNameToInt64(playerName),
    										playerRights, pmchatText,
    										pmchatTextSize);
    								pmsent = true;
    							}
    							break;
    						}
    					}
    					if (!pmsent) {
    						sM("Player currently not available");
    						break;
    					}
    				}
    			}
    			break;
     

  2. #2  
    Registered Member
    Core's Avatar
    Join Date
    Sep 2007
    Age
    19
    Posts
    4,186
    Thanks
    0
    Thanked 393 Times in 210 Posts
    Rep Power
    1983
    HAHA!!! and your flaming other people that they leach and can't code!

    ontopic: try looking at where it writes the file like the bufferwriter....
     

  3. #3  
    Fuckin PRO

    Tyler's Avatar
    Join Date
    Jan 2008
    Age
    22
    Posts
    6,019
    Thanks
    46
    Thanked 490 Times in 292 Posts
    Rep Power
    3243
    Flame who?

    And i don't see anything wrong with that, thats why i'm posting..
     

  4. #4  
    Registered Member
    Sunny++'s Avatar
    Join Date
    Jun 2008
    Posts
    1,251
    Thanks
    3
    Thanked 4 Times in 3 Posts
    Rep Power
    176
    bw = new BufferedWriter(new FileWriter("./config/pmlogs.txt", true));
    bw.write(target + " -> " + playerName + ": " + chatmessagegot);
    bw.newLine();
    bw.flush();
    Its all in that Code

    the
    (target +" ->
    displays for Example

    savaoaf ->

    the

    " + playerName + ": " + chatmessagegot);
    Displays

    test1: ?

    Overall in this whole line just by looking at it, commen sense.

    bw = new BufferedWriter(new FileWriter("./config/pmlogs.txt", true)); //Where the Chat Logs will be sent to.
    bw.write(target + " -> " + playerName + ": " + chatmessagegot); //Displays the Text User -> User (Message Sent
    bw.newLine(); // Displays a new line of text instead of cramming the lines together for neatness
    Now you can change around the settings very easility by doing this.

    bw.write(target + " -> " + playerName + ": " + chatmessagegot);
    You can remove the -> and place what ever you want.

    What do you want it to look like :P
    Sunny++ - Badass since 2006.
     

  5. #5  
    Registered Member
    Core's Avatar
    Join Date
    Sep 2007
    Age
    19
    Posts
    4,186
    Thanks
    0
    Thanked 393 Times in 210 Posts
    Rep Power
    1983
    Aww you ruined my fun.
     

  6. #6  
    Fuckin PRO

    Tyler's Avatar
    Join Date
    Jan 2008
    Age
    22
    Posts
    6,019
    Thanks
    46
    Thanked 490 Times in 292 Posts
    Rep Power
    3243
    Quote Originally Posted by freesunfury View Post
    Its all in that Code

    the


    displays for Example

    savaoaf ->

    the



    Displays

    test1: ?

    Overall in this whole line just by looking at it, commen sense.



    Now you can change around the settings very easility by doing this.



    You can remove the -> and place what ever you want.

    What do you want it to look like :P
    Its the exact same thing?
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •