Jump to content

Coins in InventoryWindow


Recommended Posts

  • Premium

All working but constantly 0 mds.

 

It's because coin column named cash ?

I modified that quest, but it is the same...

 

Modified quest :

Version 1 :

quest mds begin
    state start begin
        when login begin
            loop_timer("carga_mds", 10)
        end
     
        when carga_mds.timer begin
            local coins = mysql_query("SELECT cash from account.account WHERE id="..pc.get_account_id().." LIMIT 1;")[1][1]
            cmdchat("Mds "..coins)
        end
    end
end

Version 2 :

quest mds begin
    state start begin
        when login begin
            loop_timer("carga_mds", 10)
        end
     
        when carga_mds.timer begin
            local coins = mysql_query("SELECT cash from account.account WHERE id="..pc.get_account_id().." LIMIT 1;")[1][1]
            cmdchat("Mds "..cash)
        end
    end
end

I doesn't have the mysql module, someone can give me a link for this ?

 

Solved, it's about mysql module.

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
  • Premium
0710 23:33:22988 ::   File "
0710 23:33:22988 :: <string>
0710 23:33:22988 :: ", line 
0710 23:33:22988 :: 2070
0710 23:33:22988 :: 

0710 23:33:22988 ::     
0710 23:33:22988 :: constInfo.mds = int(coins)
0710 23:33:22988 :: 

0710 23:33:22988 ::     
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 :: ^

0710 23:33:22988 :: SyntaxError
0710 23:33:22988 :: : 
0710 23:33:22988 :: invalid syntax
0710 23:33:22988 :: 

How resolve it?

Link to comment
Share on other sites

0710 23:33:22988 ::   File "
0710 23:33:22988 :: <string>
0710 23:33:22988 :: ", line 
0710 23:33:22988 :: 2070
0710 23:33:22988 :: 

0710 23:33:22988 ::     
0710 23:33:22988 :: constInfo.mds = int(coins)
0710 23:33:22988 :: 

0710 23:33:22988 ::     
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 ::  
0710 23:33:22988 :: ^

0710 23:33:22988 :: SyntaxError
0710 23:33:22988 :: : 
0710 23:33:22988 :: invalid syntax
0710 23:33:22988 :: 

How resolve it?

 

 

What about lom? Anyway you've done something wrong..."Invalid syntax"

Link to comment
Share on other sites

All working but constantly 0 mds.

 

It's because coin column named cash ?

I modified that quest, but it is the same...

 

Modified quest :

Version 1 :

quest mds begin
    state start begin
        when login begin
            loop_timer("carga_mds", 10)
        end
     
        when carga_mds.timer begin
            local coins = mysql_query("SELECT cash from account.account WHERE id="..pc.get_account_id().." LIMIT 1;")[1][1]
            cmdchat("Mds "..coins)
        end
    end
end

Version 2 :

quest mds begin
    state start begin
        when login begin
            loop_timer("carga_mds", 10)
        end
     
        when carga_mds.timer begin
            local coins = mysql_query("SELECT cash from account.account WHERE id="..pc.get_account_id().." LIMIT 1;")[1][1]
            cmdchat("Mds "..cash)
        end
    end
end

I doesn't have the mysql module, someone can give me a link for this ?

 

Solved, it's about mysql module.

when carga_mds.timer begin

            local cash = mysql_query("SELECT cash from account.account WHERE id="..pc.get_account_id().." LIMIT 1;")[1][1]

            cmdchat("Mds "..cash)

  • Love 1
Link to comment
Share on other sites

  • Premium

0711 19:26:40246 :: Traceback (most recent call last):
 
0711 19:26:40246 ::   File "networkModule.py", line 237, in SetGamePhase
 
0711 19:26:40246 ::   File "system.py", line 130, in __pack_import
 
0711 19:26:40246 ::   File "
0711 19:26:40246 :: <string>
0711 19:26:40246 :: ", line 
0711 19:26:40246 :: 68
0711 19:26:40246 :: 
 
0711 19:26:40246 ::     
0711 19:26:40246 :: SCREENSHOT_DIR = "YT2W"
 
0711 19:26:40246 ::     
0711 19:26:40246 :: ^
 
0711 19:26:40246 :: SyntaxError
0711 19:26:40246 :: : 
0711 19:26:40246 :: invalid syntax
0711 19:26:40247 :: 
 
Link to comment
Share on other sites

C+ Form

 

Add this function in input_login.cpp

static void _send_coins(LPCHARACTER ch)
{
	if (ch)
	{
		SQLMsg * pMsg = DBManager::instance().DirectQuery("select coins from account%s WHERE id = %u", get_table_postfix(), ch->GetAID());
		if (pMsg->Get()->uiNumRows > 0)
		{
			MYSQL_ROW  row = mysql_fetch_row(pMsg->Get()->pSQLResult);
			ch->ChatPacket(CHAT_TYPE_COMMAND, "BINARY_Update_Coins %s", row[0]);
			delete pMsg;
		}
	}
}

And search ; 

_send_bonus_info(ch);

Add this under that

_send_coins(ch);

Part of Python ; 

 

Add this command under "mall"

			"mall"			: self.__InGameShop_Show,
			"BINARY_Update_Coins"	: self.Binary_Update_Coins

like this

 

Add this function in game.py

def Binary_Update_Coins(self,coins):
	self.wndMds.SetText(str(coins))

€dit : why is not work these commands?

 

Open char_change_empire.cpp file and find this

DWORD CHARACTER::GetAID() const
{
	char szQuery[1024+1];
	DWORD dwAID = 0;

	snprintf(szQuery, sizeof(szQuery), "SELECT id FROM player_index%s WHERE pid1=%u OR pid2=%u OR pid3=%u OR pid4=%u AND empire=%u", 
			get_table_postfix(), GetPlayerID(), GetPlayerID(), GetPlayerID(), GetPlayerID(), GetEmpire());

	SQLMsg* pMsg = DBManager::instance().DirectQuery(szQuery);

	if (pMsg != NULL)
	{
		if (pMsg->Get()->uiNumRows == 0)
		{
			M2_DELETE(pMsg);
			return 0;
		}

		MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult);

		str_to_number(dwAID, row[0]);

		M2_DELETE(pMsg);

		return dwAID;
	}
	else
	{
		return 0;
	}
}

change via this

DWORD CHARACTER::GetAID() const
{
	const TAccountTable pAccountTable = GetDesc()->GetAccountTable();
	if (pAccountTable.id)
		return pAccountTable.id;
} 

Meanwhile add this on top.

#include "desc.h"

Best Regards 

Zerelth ~ Ellie

  • Love 6

Do not be sorry, be better.

Link to comment
Share on other sites

  • 1 month later...
  • 4 months later...

 

€dit : why is not work these commands?

 

if you make it look like this it will work

SQLMsg * pMsg = DBManager::instance().DirectQuery("select coins from account.account WHERE id = %d",ch->GetDesc()->GetAccountTable().id);

 

GetAID() function is already exist in source. Why you want to choice long way? 

 

Kind Regards

Zerelth ~ Ellie

Do not be sorry, be better.

Link to comment
Share on other sites

 

Ok now it found, but when i make in navicat coins or cash > 0 in game it was always 0.. i have the quest on winscp. and i have this error on putty:

 
mysql: ambiguous option '--e=SELECT coins from account.account WHERE id=3 LIMIT 1;' (enable_cleartext_plugin, execute)

 

 

If your using invoice or 34k replace mysql function with this one http://www.elitepvpers.com/forum/metin2-pserver-guides-strategies/2059867-r-mysql-function.html

  • Metin2 Dev 1
Link to comment
Share on other sites

  • Former Staff

 

 

€dit : why is not work these commands?

 

if you make it look like this it will work

SQLMsg * pMsg = DBManager::instance().DirectQuery("select coins from account.account WHERE id = %d",ch->GetDesc()->GetAccountTable().id);

 

GetAID() function is already exist in source. Why you want to choice long way? 

 

Kind Regards

Zerelth ~ Ellie

 

In default GetAID() runs a direct query which is unnecessary in this case.

mmm i'm still noob butthis works for me till now i got other important things to do at the moment so I'll not focus on this right now :) 

thanks anyway

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

I have a error

 


0125 09:55:47724 :: Traceback (most recent call last):
 
0125 09:55:47724 ::   File "networkModule.py", line 237, in SetGamePhase
 
0125 09:55:47725 ::   File "system.py", line 130, in __pack_import
 
0125 09:55:47725 ::   File "
0125 09:55:47725 :: game.py
0125 09:55:47725 :: ", line 
0125 09:55:47725 :: 2398
0125 09:55:47725 :: 
 
0125 09:55:47725 ::     
0125 09:55:47725 :: def __Mds(self, coins):
 
0125 09:55:47725 ::     
0125 09:55:47725 ::  
0125 09:55:47725 ::  
0125 09:55:47726 ::  
0125 09:55:47726 ::  
0125 09:55:47726 ::  
0125 09:55:47726 ::  
0125 09:55:47726 ::  
0125 09:55:47726 ::  
0125 09:55:47726 ::  
0125 09:55:47726 ::  
0125 09:55:47726 ::  
0125 09:55:47726 ::  
0125 09:55:47726 ::  
0125 09:55:47726 ::  
0125 09:55:47726 ::  
0125 09:55:47726 ::  
0125 09:55:47726 ::  
0125 09:55:47726 ::  
0125 09:55:47726 ::  
0125 09:55:47727 ::  
0125 09:55:47727 :: ^
 
0125 09:55:47727 :: IndentationError
0125 09:55:47727 :: : 
0125 09:55:47727 :: unindent does not match any outer indentation level
0125 09:55:47727 :: 
 
I will upload my game.py
 
I hope somebody can help me!
  • Love 1
Link to comment
Share on other sites

Announcements



×
×
  • 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.