-
Posts
52 -
Joined
-
Last visited
-
Feedback
0%
About xTryhard
Informations
-
Gender
Male
Recent Profile Visitors
xTryhard's Achievements
-
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
-
Variable is being used without being initialized.
xTryhard replied to Kafa's topic in Community Support - Questions & Answers
this error says something else CDropItemGroup* pkGroup; << Error CDropItemGroup* pkGroup = NULL; << OK CDropItemGroup* pkGroup = nullptr; << OK -
Best cooldown c++ / Question
xTryhard replied to santa12's topic in Community Support - Questions & Answers
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 ? -
Get a value from MYSQL in quest
xTryhard replied to redscoutyt2's topic in Community Support - Questions & Answers
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; } -
Get IP by query c++
xTryhard replied to avertusss's topic in Community Support - Questions & Answers
what do you want to do exactly? -
Get IP by query c++
xTryhard replied to avertusss's topic in Community Support - Questions & Answers
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]); -
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
-
communication between the core
xTryhard replied to KeeA's topic in Community Support - Questions & Answers
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 -
communication between the core
xTryhard replied to KeeA's topic in Community Support - Questions & Answers
every single "core" is a Server and dont know anything from another one if you want to talk with another one send a packet. -
you have to create a user in db root 12345 have you did that?
-
make sure your server item_proto is synced with your client item_proto if this dont help take a look in uiinventory.py
-
Remove the flicker(update) item
xTryhard replied to bambykek's topic in Community Support - Questions & Answers
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 -
Buff Items System with levelable Buff-Skills
xTryhard replied to .Avenue™'s topic in Features & Metin2 Systems
you use the same value in a switch statement multiple times only one time allowed -
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
-
Increase the value of a specific attribute
xTryhard replied to Reached's topic in Features & Metin2 Systems
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); }