public void writeMessage(String msg, String charna, boolean isgm)
    {
        try
        {

            Packet packet = new Packet();
            packet.addHeader((byte) 0x1A, (byte) 0x27);
            if (isgm)
            {
                byte[] stringbyte = msg.getBytes("ISO8859-1");
                stringbyte[4] = 0x01;
                packet.addString(new String(stringbyte));
            }
            else
            {
                packet.addString(msg);
            }
            String[] packandhead = new String[2];

            packandhead[0] = packet.getHeader();
            packandhead[1] = packet.getPacket();

            int i = 0;
            do
            {
                if (usersocks[i] == null)
                {
                    debug("client nr:" + i + " is empty");
                }
                else
                {
                    usersocks[i].write(packandhead[0]);
                    usersocks[i].flush();
                    usersocks[i].write(packandhead[1]);
                    usersocks[i].flush();
                    debug("send");
                }
                i++;
            } while (i < this.users);
        } catch (Exception e)
        {
        }
    }