Mysql Order Playernames By Clanname
#1

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
Reply
#2

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?
Reply
#3

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.
Reply
#4

ALL queries in that plugin HAVE to be threaded.
Reply
#5

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.
Reply
#6

Okay let me thread all queries. ONTOPIC: What about the function GetClanMembers?
Reply
#7

You need to use a threaded query with a callback..
Reply
#8

Quote:
Originally Posted by ******
Посмотреть сообщение
What about it?
How can i make it work so its not returning blank text?
Reply
#9

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)