Author Topic: use lobby2server,how can i access database in other plugin?  (Read 4357 times)

wnpet

  • Not-a-newbie
  • *
  • Posts: 6
  • Karma: 0
    • View Profile
use lobby2server,how can i access database in other plugin?
« on: December 22, 2011, 05:54:02 AM »
now i am developing a game with lobby2server, all database operations are wrapped in lobby2plugin, i want to know other plugin
how to access the database?
do more lobby2messages? or send message to lobby2server like a client? give me some ideas please, tks! ;D

Rak'kar

  • Administrator
  • Hero Member
  • *****
  • Posts: 6895
  • Karma: 291
    • View Profile
    • RakNet
Re: use lobby2server,how can i access database in other plugin?
« Reply #1 on: December 22, 2011, 11:13:54 AM »
If you want to add new database operations, you should clone one of the existing operations. As an example, search for Clans_GetPosts. You'll find 13 matching results. In each location, copy/paste what is there and rename to your own operation.

An alternative is to actually derive from Lobby2MessageFactory_PGSQL and override the Alloc function to be able to take one of your own IDs. You would add your own IDs starting from Lobby2MessageID::L2MID_COUNT  The advantage is that if RakNet changes, you don't have to merge into your own code.