Mysql Order Playernames By Clanname -
Admigo - 19.06.2013
Hello all,
I am using this stock for getting all clan members.
But when i use the GetClanMembers in a string it returns blank.
pawn Код:
stock GetClanMembers(clan[])
{
new clanquery[200];
new minfo[300], mreturn[300];
new string[300];
format(clanquery, sizeof(clanquery), "SELECT `playername` FROM a_clans_members WHERE clanname = '%s'", clan);
mysql_query(clanquery, _THREAD_GET_CLAN_MEMBERS, -1, gSQL);
mysql_store_result();
while(mysql_fetch_row_format(clanquery,"|"))
{
mysql_fetch_field_row(string,"playername");
format(minfo,sizeof(minfo),"%s\n",string);
strcat(mreturn, minfo);
}
mysql_free_result();
return mreturn;
}
How can i fix this?
Admigo
Re: Mysql Order Playernames By Clanname -
Admigo - 19.06.2013
Quote:
Originally Posted by ******
That looks like you're using a threaded query (based on _THREAD_GET_CLAN_MEMBERS) - which means the data isn't available until it is, at some unknown point in the future. Even if you're not using a threaded query, you should be to avoid server stalls.
|
The _THREAD_GET_CLAN_MEMBERS is empty. I want to get the playernames when the clanname is the same so that the stock returns all the clan members in that clan like:
Код:
acnr|Admigo
acnr2|test1
acnr|test2
So the getclanmembers need to return Admigo and test2. But the message is blank.
Do i need the thread? Or is there anyway to get it work?
Re: Mysql Order Playernames By Clanname -
Admigo - 19.06.2013
Quote:
Originally Posted by ******
Well are you using a MySQL system that has unthreaded queries? AFAIK that's BlueG v6, or Dan..'s.
|
For some functions like loading the account stats i am using threaded queries but the other queries i dont use threads. I am using BlueG r15.
Re: Mysql Order Playernames By Clanname -
MP2 - 19.06.2013
ALL queries in that plugin HAVE to be threaded.
Re: Mysql Order Playernames By Clanname -
Admigo - 19.06.2013
Quote:
Originally Posted by MP2
ALL queries in that plugin HAVE to be threaded.
|
I only have a problem with the detecting of the clan members.
The other functions work fine.
Re: Mysql Order Playernames By Clanname -
Admigo - 19.06.2013
Okay let me thread all queries. ONTOPIC: What about the function GetClanMembers?
Re: Mysql Order Playernames By Clanname -
MP2 - 19.06.2013
You need to use a threaded query with a callback..
Re: Mysql Order Playernames By Clanname -
Admigo - 19.06.2013
Quote:
Originally Posted by ******
What about it?
|
How can i make it work so its not returning blank text?
Re: Mysql Order Playernames By Clanname -
MP2 - 19.06.2013
Quote:
Originally Posted by ******
You need to request the data in advance and cache it somewhere.
|
It doesn't necessarily need to be called in advance. He's likely using this for (for example) a clan leader to list his members. The data should be SELECT'd at that time and displayed when the data is retrieved. Delays won't really matter. There's no need to cache it as it's likely not going to be requested often. > Memory saved.