problem with dialog and query -
verlaj - 17.08.2017
The dialog doesn't appear and I have checked the logs, query is working.
The following code dosen't display any dialog at all. but..
Код:
stock DisplayGroupMembers(groupid, playerid)
{
new query[128], dialogstr[556];
mysql_format(c_handle, query, sizeof(query), "SELECT * FROM `users` WHERE `pGroup` = %d", groupid);
mysql_query(c_handle, query, true);
new strings[76];
format(strings,sizeof(strings),"Group Members for %s(%d)",groupinfo[groupid][grname],groupid);
new count = cache_num_rows();
if(count > 0)
{
new TempString[MAX_PLAYER_NAME], tempid, levelf, resultst[128];
for(new r = 0; r < count; r++)
{
cache_get_field_content(r, "User", TempString);
levelf = cache_get_field_content_int(r, "pGroupLevel");
tempid = GetID(TempString);
format(resultst, sizeof(resultst), "%s\n", TempString);
if(IsPlayerConnected(tempid))
{
strcat(dialogstr, "~g~(ONLINE) ");
}
else
{
strcat(dialogstr, "(OFFLINE) ");
}
if(levelf == 5)
{
strcat(dialogstr, "(Leader) ");
}
if(levelf == 4)
{
strcat(dialogstr, "(Co Leader) ");
}
if(levelf == 3)
{
strcat(dialogstr, "(Managing Member) ");
}
if(levelf == 2)
{
strcat(dialogstr, "(Veteran Member) ");
}
if(levelf == 1)
{
strcat(dialogstr, "(Member) ");
}
strcat(dialogstr, resultst);
}
ShowDialog(playerid, Show:thedom, DIALOG_STYLE_TABLIST, strings, dialogstr, "Select", "Close");
}
return 1;
}
When using Client message, then it works perfectly.
Код:
stock DisplayGroupMembers2(groupid, playerid)
{
new query[128], dialogstr[128];
mysql_format(c_handle, query, sizeof(query), "SELECT * FROM `users` WHERE `pGroup` = %d", groupid);
mysql_query(c_handle, query, true);
new strings[76];
format(strings,sizeof(strings),"{58D3F7}Group Members for %s(%d)",groupinfo[groupid][grname],groupid);
SCM(playerid,-1, "============================================");
SCM(playerid,SERVER_CLIENT, strings);
new count = cache_num_rows();
if(count > 0)
{
new TempString[MAX_PLAYER_NAME], tempid, levelf, resultst[128];
for(new r = 0; r < count; r++)
{
cache_get_field_content(r, "User", TempString);
levelf = cache_get_field_content_int(r, "pGroupLevel");
tempid = GetID(TempString);
format(resultst, sizeof(resultst), "{AFAFAF}%s", TempString);
if(IsPlayerConnected(tempid))
{
strcat(dialogstr, "{33EE22}(ONLINE) ");
}
else
{
strcat(dialogstr, "{FF8080}(OFFLINE) ");
}
if(levelf == 5)
{
strcat(dialogstr, "{58D3F7}(Leader) ");
}
if(levelf == 4)
{
strcat(dialogstr, "{58D3F7}(Co Leader) ");
}
if(levelf == 3)
{
strcat(dialogstr, "{58D3F7}(Managing Member) ");
}
if(levelf == 2)
{
strcat(dialogstr, "{58D3F7}(Veteran Member) ");
}
if(levelf == 1)
{
strcat(dialogstr, "{58D3F7}(Member) ");
}
strcat(dialogstr, resultst);
SCM(playerid,-1, dialogstr);
SCM(playerid,-1, "============================================");
}
}
return 1;
}
log
Код:
[13:11:09] [DEBUG] mysql_format - connection: 1, len: 1256, format: "SELECT * FROM `users` WHERE `pGroup` = %d"
[13:11:09] [DEBUG] mysql_query - connection: 1, query: "SELECT * FROM `users` WHERE `pGroup` = 3", use_cache: true
[13:11:09] [DEBUG] CMySQLQuery::Execute - starting query execution
[13:11:09] [DEBUG] CMySQLQuery::Execute - query was successfully executed within 0.887 milliseconds
[13:11:09] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[13:11:09] [DEBUG] CMySQLHandle::SaveActiveResult - cache saved (id: 1)
[13:11:09] [DEBUG] cache_get_row_count - connection: 1
[13:11:09] [DEBUG] cache_get_field_content - row: 0, field_name: "User", connection: 1, max_len: 24
[13:11:09] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "User", data: "Heller"
[13:11:09] [DEBUG] cache_get_field_content_int - row: 0, field_name: "pGroupLevel", connection: 1
[13:11:09] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "pGroupLevel", data: "5"
Re: problem with dialog and query -
verlaj - 21.08.2017
bump.. edited main post.
Edit: problem found = easy dialog is obsolete