Jump to content

xTryhard

Premium
  • Posts

    52
  • Joined

  • Last visited

  • Feedback

    0%

Everything posted by xTryhard

  1. use a std::vector instead of a std::map you can resize the vector in the characters constructor if the Instance is a PlayerCharacter otherwise you keep the size from the vector at 0
  2. this error says something else CDropItemGroup* pkGroup; << Error CDropItemGroup* pkGroup = NULL; << OK CDropItemGroup* pkGroup = nullptr; << OK
  3. cooldowns should run on the server directly and not via database you can save the time in database and load it back when you relog but dont send everytime a query while the player is on the same core questflags are just integers in database but another question why do you want to use a cooldown for 1 second ?
  4. i dont know how to do this in Lua but in C++ it would look like this : char Query[512]; snprintf(Query, sizeof(Query), "SELECT * FROM player.horse WHERE PID = %d", GetPlayerID()); std::unique_ptr<SQLMsg> msg(DBManager::instance().DirectQuery(Query)); if (msg->Get()->uiNumRows == 0) { return; } else { MYSQL_ROW row = mysql_fetch_row(msg->Get()->pSQLResult); str_to_number(MyHorse.Level, row[1]); return; }
  5. char szQuery[50]; // << the length of your string snprintf(szQuery, sizeof(szQuery), "SELECT IP FROM player.player WHERE name = '%s'", arg1); std::unique_ptr<SQLMsg> msg(DBManager::instance().DirectQuery(szQuery)); MYSQL_RES* Result = msg->Get()->pSQLResult; MYSQL_ROW row = mysql_fetch_row(Result); std::string IP = row[0]; if you select a string you can just create one if you use an integer you have to use this function : str_to_number(IP, row[0]);
  6. your header and packet struct has to be 100% synced clientside and serverside make sure when you send a packet to the client use return true at the end of the function in client source also make sure your header is not over 255 because the client will cast it back to unsigned char
  7. in your case you have to send the message from the client to your current Server (core) where you in this Server has to send the message to each other Game Server (core) and each Server has to send the message back to each client so its along way maybe the p2p packets are working but there is a issue when the server is trying to send it back to each client you can test this very simple if your p2p packet is working goto : input_p2p.cpp void CInputP2P::Shout(const char * c_pData) now when you send a message every server will recieve this packet here to check if this is working use a debug print for example : std::cout << "My Packet is Working! \n"; now when you send a message check the debug console if this message is shown you have a server-client problem
  8. every single "core" is a Server and dont know anything from another one if you want to talk with another one send a packet.
  9. you have to create a user in db root 12345 have you did that?
  10. make sure your server item_proto is synced with your client item_proto if this dont help take a look in uiinventory.py
  11. this happen because the client-server-client communication is slow go to PythonNetworkStreamPhaseGame.cpp void CPythonNetworkStream::GamePhase() and remove this if(dwRecvCount++ >= MAX_RECV_COUNT-1 && GetRecvBufferSize() < SAFE_RECV_BUFSIZE && m_strPhase == "Game") break; you can also rewrite the refine function and resize the packet
  12. you use the same value in a switch statement multiple times only one time allowed
  13. goto input.h #add in private section void GiveStarterSet(LPCHARACTER Player); now goto input_login.cpp #search for void CInputLogin::Entergame(LPDESC d, const char * data) add at the bottom from the function : if(ch != NULL) GiveStarterSet(ch); define the function: void CInputLogin::GiveStarterSet(LPCHARACTER Player) { if (Player != NULL) { if(Player->GetQuestFlag("give_starter_set.source") == 0) { Player->SetQuestFlag("give_starter_set.source", 1); BYTE CharClass = Player->GetJob(); bool Warrior = CharClass == 0; bool Ninja = CharClass == 1; bool Sura = CharClass == 2; bool Schami = CharClass == 3; if (Warrior) Player->EquipWarrior(); if (Sura) Player->EquipSura(); if (Ninja) Player->EquipNinja(); if (Schami) Player->EquipShaman(); } } } goto char.h add the functions in public section ; void EquipWarrior(); void EquipSura(); void EquipShaman(); void EquipNinja(); goto char.cpp now add all 4 functions and add your ID in the vector array void CHARACTER::EquipWarrior() { std::vector<DWORD>WarriorStuff { 10, }; for (BYTE i = 0; i < WarriorStuff.size(); ++i) { LPITEM item = ITEM_MANAGER::instance().CreateItem(WarriorStuff[i]); if (item != NULL) { bool Success = item->EquipTo(this, item->FindEquipCell(this)); if (!Success) M2_DESTROY_ITEM(item); } } } you are done you can now add everything you need in the new character functions
  14. ofc you set the weapon. in your code you use this item2->SetForceAttribute(idx, 72, value); as third parameter you use value. anyway this is the correct if statement : if (item2->GetAttributeValue(idx) >= 80 && item2->GetAttributeValue(idx) <= 200) { item2->SetForceAttribute(idx, 72, value); }
  15. if you want just to increase a value from a bonus you dont have to change anything in item_proto the bonus value is signed 16 bit that means you can have max. 32767 without change anything item2->SetForceAttribute(idx, 72, 32767); this function will do it also if you want to increase a value by 1 use the ++ increment operator instead of using +1 int32_t value = item2->GetAttributeValue(idx); ++value;
  16. you have to know C++ to do this there is no magic button for the pc to know what you think
  17. yes you can do this go to game.py create a function with your key send this to the server check if you have this item id in your inventory and if you have it do what you want and send it back to the client
  18. it is always the same you ( client ) want something from the server so for example you press a button now you send a packet to the server he looks what you want and after that he will validate your packet if everything is good you get a callback from the server with the data you want if something is wrong he will not send you anything ( anti cheat ) the best way to debug something is to start at the beginning from the road look what will happen when you press on the button and check everything the way to the server and back to the client use printf in source to see if you get what you expect or not
  19. when you add an item to your inventory with AddToCharacter print the index out and look if you really have the item or not if your console says you have it check if the update packet is sending to the client and check if python update correctly
  20. go to input_main.cpp void CInputMain::Attack(LPCHARACTER ch, const BYTE header, const char* data) this is the location where the damage packet starts you have to check from there until you find your problem
  21. char_battle.cpp but if you have more than 100% defense you get 0 damage
  22. create this file as sub file : title subImage version 1.0 image "tabchararab.tga" left 0 top 0 right 253 bottom 37 now go to python and select it with the if statement
  23. create 2 sub files: a default one and the new one and use this: if localeInfo.IsARABIC(): image "tabchararab.tga" else: image "tabchar.tga" inside python and not inside the sub file
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.