Tasho
-
Posts
358 -
Joined
-
Last visited
-
Days Won
11 -
Feedback
0%
Community Answers
-
Tasho's post in quest kill count in database was marked as the answer
.
UPDATE = The UPDATE statement is used to modify the existing records in a table. INSERT = The INSERT INTO statement is used to insert new records in a table.
You trying to update field id <which doesn't exist> First one you need to do INSERT and after that UPDATE, there are many solutions for that, but i would like that one: INSERT ... ON DUPLICATE KEY UPDATE local quantidade = pc.getqf("total_players") mysql_direct_query(string.format("INSERT INTO player.kill_system (id, quantidade) VALUES(%d, %d) ON DUPLICATE KEY UPDATE quantidade = quantidade + %d;", pc.get_player_id(), quantidade, quantidade)); If you specify an ON DUPLICATE KEY UPDATE clause and a row to be inserted would cause a duplicate value in a UNIQUE index or PRIMARY KEY, an UPDATE of the old row occurs.
-
Tasho's post in c++ Library Hooking Problem was marked as the answer
Try that.
// Change the hook function with this: void MoveHook::hook(CInputMain* self, iCHARACTER* ch, const char* data) { if (!ch || !self || !*data) return; if (ch->m_counterxxx == 100) ch->m_counterxxx = 0; ch->m_counterxxx++; instance()->detour->GetOriginalFunction()(self, ch, data); } // Search for: void CHARACTER::Destroy() and add inside: m_counterxxx = 0; // Search for: void CHARACTER::Disconnect(const char * c_pszReason) and add inside: m_counterxxx = 0; The crash is generated when he destroyed the desc, you should check your class destroy and stop if something is nullptr and try to reinitializate the variables store to default.
Without full code i can't say too much about that, but i hope you get my points.
-
Tasho's post in coins per mob oder metin kill was marked as the answer
quest coins_for_kill begin state start begin when kill begin local mobVnum = npc.get_race() local mobCoins = ({ [8024] = 30, -- 30 Coins [8025] = 20 -- 20 Coins }) [mobVnum] if not mobCoins then return end pc.charge_cash(mobCoins, "coins_for_kill") syschat(string.format("You get %d coins from %s.", mobCoins, mob_name(mobVnum))) end end end This is correctly quest rewrited.
Already ymir did the function for lua to charge the coins via pc.charge_cash, but not all people was used because name of row is called: "cash" and they are used on website/itemshop etc row "coins", but can change very easy.
Go in /src/db/ClientManager.cpp
sprintf(szQuery, "update account set `cash` = `cash` + %d where id = %d limit 1", packet->dwAmount, packet->dwAID); Replace `cash` = `cash` with `coins` = `coins`