Jump to content
  • 0

How to send a message to all online characters in their messagebox


JayPee

Question


  • Group:  Members
  • Topic Count:  47
  • Topics Per Day:  0.01
  • Content Count:  633
  • Reputation:   78
  • Joined:  11/14/11
  • Last Seen:  

I noob in source editting but i just want to ask how to send a message to all online characters in their message box

example is: I request a trade... It will display a message to all online chars that "User A request a trade on User B". I think clif_displaymessage(sd->fd,target_sd->status.name) cant do that. I found this clif_GlobalMessage

Thanks in advance.

Edited by JayPeeMateo
Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  201
  • Reputation:   47
  • Joined:  11/17/11
  • Last Seen:  

I think you could avoid a source edit (If you are running an SQL based server) just use a query to loop through all members, if they are online, it will message them.

*Note: In the query you can recall the characters ID, name etc for certain things like:

*message "<character name>","<message>";

or

*isloggedin(<account id>{,<char id>})

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

assuming you only had < 128 players online... there would be a little more factors in it that just that..

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  201
  • Reputation:   47
  • Joined:  11/17/11
  • Last Seen:  

Well it would just loop back before the query, and update the same variable o.o

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

mmmhmmm and then of course you need a sleep2 1; in the event there is > ~650 players ;) haha but who knows ;)

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  201
  • Reputation:   47
  • Joined:  11/17/11
  • Last Seen:  

Oh haha true true

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  47
  • Topics Per Day:  0.01
  • Content Count:  633
  • Reputation:   78
  • Joined:  11/14/11
  • Last Seen:  

I came up with this code, is this correct?:

trade.c

char output[200];

void trade_traderequest(struct map_session_data *sd, struct map_session_data *target_sd)
  int level;
  int targetLevel;

   level = pc_isGM(sd);
   targetLevel = pc_isGM(target_sd);

  if((level>=60) && (targetLevel<=20))
  {
        sprintf(output, msg_txt(904), sd->status.name, target_sd->status.name);
      clif_broadcast(&sd->bl, output, strlen(output) + 1, 0, ALL_CLIENT);
  }
}

msg_athena.conf


  904: %s request a trade to %s

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  764
  • Reputation:   220
  • Joined:  11/14/11
  • Last Seen:  

There is a method called map_foreachpc which will loop through all online players and execute a given method.

map_foreachpc(clif_displaymessage(sd->fd, "TEXT"));

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...