-
Posts
52 -
Joined
-
Last visited
-
Feedback
0%
Content Type
Forums
Store
Third Party - Providers Directory
Feature Plan
Release Notes
Docs
Events
Everything posted by xTryhard
-
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); } -
Increase the value of a specific attribute
xTryhard replied to Reached's topic in Features & Metin2 Systems
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; -
recommended everything worked fine
-
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
-
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
-
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
-
char_battle.cpp but if you have more than 100% defense you get 0 damage
-
bug python and bug flag
xTryhard replied to ahmedmohamed's topic in Community Support - Questions & Answers
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 -
bug python and bug flag
xTryhard replied to ahmedmohamed's topic in Community Support - Questions & Answers
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