Jump to content
  • 0
JayPee

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

Question

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

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

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

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...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.