Dastgir 1246 Posted December 11, 2015 Now, its time to show examples of how map-char communication can be made, this is essential as there's no example anywhere about this, so here it is... https://raw.githubusercontent.com/dastgir/HPM-Plugins/master/src/plugins/packet_sample.cAbove is the example of Communication between Map-Char ServerHere's Description of what All Functions does: map_sendtochar: Sends Packet to the char-server packet_test(Command): Sets common_value and calls map_sendtochar char_receive_packet: CharServer Function to receive packets(see declaration in plugin_init) ScreenShot: 3 Sephus, Ehwaz and AnnieRuru reacted to this Quote Share this post Link to post Share on other sites
AnnieRuru 957 Posted December 11, 2015 you have a typo for char_receive_packet void char_receive_packet(int fd) { ShowDebug("Char: CommonValue(Before parsing packet): %dn",common_value); common_value = RFIFOL(fd, 2); ShowDebug("Char: CommonValue(After parsing packet): %dn",common_value); return;}..ok so ... enum HPluginPacketHookingPoints { hpClif_Parse, ///< map-server (client-map) hpChrif_Parse, ///< map-server (char-map) hpParse_FromMap, ///< char-server (map-char) hpParse_FromLogin, ///< char-server (login-char) hpParse_Char, ///< char-server (client-char) hpParse_FromChar, ///< login-server (char-login) hpParse_Login, ///< login-server (client-login) /* */ hpPHP_MAX,};in this example,to pass packet from map-server to char-server 1. use hpParse_FromMap in SERVER_TYPE_CHAR 2. check char-server online with chrif->isconnected() function 3. global value can be pass with chrif->fd now this is just in theory ... to pass packet from char-server to login-server 1. use hpParse_FromChar in SERVER_TYPE_LOGIN 2. can hook to loginif->on_ready/loginif->on_disconnect to check if login-server online 3. global value can be pass with .... hmm ... ?? I start to think you did something wrong there in the sample.c, it create a new socket session sockt->session[fd]yes in the sample.c, it also can use sd->fd, right ?but I think sockt->session[fd] is more generic hmm ... need some test ... Quote Share this post Link to post Share on other sites
Dastgir 1246 Posted December 12, 2015 I start to think you did something wrong therein the sample.c, it create a new socket sessionSample.c have example of putting some values in player session data, while my plugin shows how to pass value and save it in global variable (like, if you want to pass some config of char-server from map-server, which applies to all players, instead of just 1 player)You can just increase the size of packets and pass as many values or structures as you can... @@AnnieRuru you have a typo for char_receive_packetWhat's the typo?I just wanted to show before actually receiving to packet, the value is 0, and map-char server loads plugin separately. chrif->fd = map-char chr->login_fd = char-login Char-Map : Search map-server Id and then fd, see char_parse_char_select from char.c on how they do it. Quote Share this post Link to post Share on other sites
REKT 10 Posted December 19, 2015 @@Dastgir just a curiosity for what purposes is this btw? Quote Share this post Link to post Share on other sites
Dastgir 1246 Posted December 19, 2015 @@Dastgir just a curiosity for what purposes is this btw? It's just a sample for those who want to learn how to communicate between 2 or more plugins(at different servers , i.e map/char/login) or play with packets... 1 AnnieRuru reacted to this Quote Share this post Link to post Share on other sites
Sephus 203 Posted February 21, 2017 (edited) Very useful, good work! Edited February 21, 2017 by Smoke Quote Share this post Link to post Share on other sites