Dialog shows only half results -
963852741 - 20.01.2017
Hi,
So, I made an application moderating system in-game for administrators to check roleplay applications. The code to get all unchecked applications is:
pawn Код:
new temp[128], count, pid, id,totalString[512];
for(new r=0; r < cache_get_row_count(); ++r)
{
cache_get_field_content(r, "id", temp), id = strval(temp);
cache_get_field_content(r, "playerid", temp), pid = strval(temp);
format(totalString, 2400, "%s\n(APP ID: %d) Applicant ID: %d %s", totalString, id, pid, get_name_from_sqlid(pid));
appList[playerid][count] = id;
count++;
}
if(!count) return SCM(playerid, COLOR_RED, "No applications.");
ShowPlayerDialog(playerid, DIALOG_APPCHECK, DIALOG_STYLE_LIST, "Applications Moderating", totalString, "Check", "Close");
The problem is whenever I do that and sometimes there is more than one application - it only shows half of the applications. Lets say there are 10 applications unchecked, it shows less than half, and I need to do the command again and only then the dialog will show me all the unchecked applications. What's wrong?
Re: Dialog shows only half results -
Amads - 20.01.2017
Increase your totalString size.
Re: Dialog shows only half results -
963852741 - 20.01.2017
Quote:
Originally Posted by Amads
Increase your totalString size.
|
I don't think it has to do with that, because it happened when there were two applications and it showed only one of them and only after I did the command again it showed me both of them.
Re: Dialog shows only half results -
Yaa - 20.01.2017
PHP код:
for(new r=0; r < cache_get_row_count(); r++)
it's r++ not ++r
idk if it's matter just test it :/
Re: Dialog shows only half results - iLearner - 20.01.2017
@OP most of the times its because of the string size.
try to raise the size to 800 for example, also try using it like this:
PHP код:
format(totalString, sizeof(totalString), "...
Quote:
Originally Posted by Yaa
PHP код:
for(new r=0; r < cache_get_row_count(); r++)
it's r++ not ++r
idk if it's matter just test it :/
|
You said that, you get:
i saw this: SA:MP Lead Scripter, you get:
Re: Dialog shows only half results -
oMa37 - 20.01.2017
Quote:
Originally Posted by Yaa
PHP код:
for(new r=0; r < cache_get_row_count(); r++)
it's r++ not ++r
idk if it's matter just test it :/
|
It's the same, but not always.
OT: Increase the string size and I recommend using strcat, It's better.
Re: Dialog shows only half results -
Vince - 20.01.2017
What concerns me most is this function "get_name_from_sqlid(pid)". This should probably be rewritten as a join in the original query because it puts an unnecessary large strain on the system, especially if the list is long. I need to guess now, but I think the server simply can't keep up.
Queries are cached for a short while on the MySQL server so the next time that query is received the MySQL server pulls the result from cache rather than from disk.
Re: Dialog shows only half results -
Yaa - 20.01.2017
Quote:
Originally Posted by iLearner
@OP most of the times its because of the string size.
try to raise the size to 800 for example, also try using it like this:
PHP код:
format(totalString, sizeof(totalString), "...
You said that, you get:
i saw this: SA:MP Lead Scripter, you get:

|
well
........
after reading this you got :