Thread: WHAT THE HELL is wrong with my simple clan chat system?

Results 1 to 5 of 5
  1. #1 WHAT THE HELL is wrong with my simple clan chat system? 
    Extreme Donator


    Join Date
    Nov 2007
    Posts
    2,712
    Thanks given
    47
    Thanks received
    9
    Discord
    View profile
    Rep Power
    650
    Method:

    Code:
    public void clanYell(String message) {
            for (Player p : handler.players) {
    
                if ((message.indexOf("tradereq") > 0)
                        || (message.indexOf("duelreq") > 0)) {
                    return;
                }
                if ((p == null) || !p.isActive) {
                    continue;
                }
                client temp = (client) p;
                if ((temp.absX > 0) && (temp.absY > 0 && temp.ccChannel == ccChannel)) {
                    if ((temp != null) && !temp.disconnected && p.isActive) {
                        temp.sM(message);
                    }
                }
            }
        }
    command:

    Code:
            if (command.startsWith("y3ll")) {
      String text = command.substring(5);
    clanYell(" "+playerName+": "+text+" ");
    }
    Okay so here's how it works, it displays the "clan chat message" to those with the same clan chat id, but it only displays for me and not globally to others with the same id?
    Reply With Quote  
     

  2. #2  
    Registered Member
    blackman8192's Avatar
    Join Date
    Jun 2010
    Posts
    72
    Thanks given
    12
    Thanks received
    7
    Rep Power
    172
    It's not checking if the players are null.
    hi
    Reply With Quote  
     

  3. #3  
    Extreme Donator


    Join Date
    Nov 2007
    Posts
    2,712
    Thanks given
    47
    Thanks received
    9
    Discord
    View profile
    Rep Power
    650
    Quote Originally Posted by blackman8192 View Post
    It's not checking if the players are null.
    Code:
    if ((temp != null)
    ?
    Reply With Quote  
     

  4. #4  
    Registered Member
    blackman8192's Avatar
    Join Date
    Jun 2010
    Posts
    72
    Thanks given
    12
    Thanks received
    7
    Rep Power
    172
    Quote Originally Posted by Spartacus View Post
    Code:
    if ((temp != null)
    ?
    Not before player variables were accessed which would immediately crash.



    Code:
    public void clanYell(String message)
    {
    	if (message.endsWith(":tradereq:") || message.endsWith(":duelreq:"))
            {
                		return;
            }
            for (int i = 0; i < handler.players.length; i++)
            {
                	client player = (client)handler.players[i];
                	if (player != null && player.isActive && !player.disconnected && player.ccChannel == ccChannel)
                	{
                    	player.sM(message);
                	}
            }
    }
    hi
    Reply With Quote  
     

  5. #5  
    Extreme Donator


    Join Date
    Nov 2007
    Posts
    2,712
    Thanks given
    47
    Thanks received
    9
    Discord
    View profile
    Rep Power
    650
    Quote Originally Posted by blackman8192 View Post
    Not before player variables were accessed which would immediately crash.



    Code:
    public void clanYell(String message)
    {
    	if (message.endsWith(":tradereq:") || message.endsWith(":duelreq:"))
            {
                		return;
            }
            for (int i = 0; i < handler.players.length; i++)
            {
                	client player = (client)handler.players[i];
                	if (player != null && player.isActive && !player.disconnected && player.ccChannel == ccChannel)
                	{
                    	player.sM(message);
                	}
            }
    }
    Thanks for trying but still doesn't seem to output the message to other clan members but myself...
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

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


User Tag List

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