Quick question on mysql and filterscript!
#2

If I understand you correctly, I think you need to do the following:

at the top of the filterscript you need to
Код:
#include <a_mysql>
then you would connect to the mysql server and access the database the same way the game mode accesses it

Код:
GetMoney(name[])
{
mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS);

new Query[256];
format(Query, 256, "SELECT * FROM playerdata WHERE username='%s'", name);
mysql_query(Query);
mysql_store_result();

new nMoneyAmount;

while(mysql_fetch_row_format(Query,"|"))
{
	mysql_fetch_field_row(nMoneyAmount, "money"); //nMoneyAmount will store the retrieved variable, in this case the players money, and "money" is the name of the row in the database
}

return nMoneyAmount;
}
Let me know if you need anything here clarified.
Reply


Messages In This Thread
Quick question on mysql and filterscript! - by Jerm - 13.10.2013, 07:30
Re: Quick question on mysql and filterscript! - by showdown - 13.10.2013, 08:01
Re: Quick question on mysql and filterscript! - by Jerm - 13.10.2013, 11:27
Re: Quick question on mysql and filterscript! - by Jerm - 13.10.2013, 12:04
Re: Quick question on mysql and filterscript! - by Jerm - 13.10.2013, 12:56
Re: Quick question on mysql and filterscript! - by Jerm - 14.10.2013, 02:08
Re: Quick question on mysql and filterscript! - by Jerm - 15.10.2013, 10:38
Re: Quick question on mysql and filterscript! - by [LCK]Chris - 15.10.2013, 10:49
Re: Quick question on mysql and filterscript! - by Jerm - 15.10.2013, 11:01
Re: Quick question on mysql and filterscript! - by [LCK]Chris - 15.10.2013, 11:09

Forum Jump:


Users browsing this thread: 3 Guest(s)