Dialog shows only half results
#1

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

Increase your totalString size.
Reply
#3

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

PHP код:
for(new r=0cache_get_row_count(); r++) 
it's r++ not ++r

idk if it's matter just test it :/
Reply
#5

@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(totalStringsizeof(totalString), "... 


Quote:
Originally Posted by Yaa
Посмотреть сообщение
PHP код:
for(new r=0cache_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:

Reply
#6

Quote:
Originally Posted by Yaa
Посмотреть сообщение
PHP код:
for(new r=0cache_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.
Reply
#7

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

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(totalStringsizeof(totalString), "... 




You said that, you get:

i saw this: SA:MP Lead Scripter, you get:

well

........

after reading this you got :

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)