Array Problem
#1

What I want to do: List all 911 calls, and assign each of them into a dialog

PHP код:
new calls9110[200][5];
new 
calls9111[200][5];
new 
calls9112[200][5];
new 
calls9113[200][5];
new 
calls9114[200][5]; 
PHP код:
for(new i=0i<10i++)
            {
                   if(
isNull(calls9110[i]))
                {
                    
format(calls9110[i], 300"|_______________911 Call_______________|");
                    break;
                }
            }
            for(new 
i=0i<10i++)
            {
                   if(
isNull(calls9111[i]))
                {
                    
format(calls9111[i], 300"Caller: %s  Phone: %i Call Trace: %s",GetName(playerid), PlayerInfo[playerid][pNumber], szZone);
                    break;
                }
            }
            for(new 
i=0i<10i++)
            {
                   if(
isNull(calls9112[i]))
                {
                    
format(calls9112[i], 300"Services Required: SJPD");
                    break;
                }
            }
            for(new 
i=0i<10i++)
            {
                   if(
isNull(calls9113[i]))
                {
                    
format(calls9113[i], 300"Location: %s"text);
                    break;
                }
            }
            for(new 
i=0i<10i++)
            {
                   if(
isNull(calls9114[i]))
                {
                    
format(calls9114[i], 300"Situation: %s"PlayerCrime[playerid][SituationStr]);
                    break;
                }
            } 
PHP код:
new holder[500], string2[200];
                            
format(string2sizeof(string2), "%s\n"calls9110[0]);
                            
strcat(holderstring2sizeof(holder));
                            
format(string2sizeof(string2), "%s\n"calls9111[0]);
                            
strcat(holderstring2sizeof(holder));
                            
format(string2sizeof(string2), "%s\n"calls9112[0]);
                            
strcat(holderstring2sizeof(holder));
                            
format(string2sizeof(string2), "%s\n"calls9113[0]);
                            
strcat(holderstring2sizeof(holder));
                            
format(string2sizeof(string2), "%s\n"calls9114[0]);
                            
strcat(holderstring2sizeof(holder));
                            
ShowPlayerDialog(playeridDIALOG_MDC_911_CALLSDIALOG_STYLE_MSGBOX"MDC Police - Page 0"holder"Next Page""Cancel"); 
Reply
#2

Forgot to post the errors

Reply
#3

You only need one array and a pointer (a variable). Increase the pointer by one when you go to the next page, use the pointer as the index of the array to show the according information.

Simple as that.
Reply
#4

If you mean this

PHP код:
case DIALOG_MDC_911_CALLS1:
            {
                if(
response)
                {
                    new 
holder[500], string2[200];
                    
format(string2sizeof(string2), "%s\n"calls9110[2]);
                    
strcat(holderstring2sizeof(holder));
                    
format(string2sizeof(string2), "%s\n"calls9111[2]);
                    
strcat(holderstring2sizeof(holder));
                    
format(string2sizeof(string2), "%s\n"calls9112[2]);
                    
strcat(holderstring2sizeof(holder));
                    
format(string2sizeof(string2), "%s\n"calls9113[2]);
                    
strcat(holderstring2sizeof(holder));
                    
format(string2sizeof(string2), "%s\n"calls9114[2]);
                    
strcat(holderstring2sizeof(holder));
                    
ShowPlayerDialog(playeridDIALOG_MDC_911_CALLS2DIALOG_STYLE_MSGBOX"MDC Police - Page 2"holder"Next Page""Cancel");
                }
            } 
That's what I used
Reply
#5

Why are you ~removing~ all your posts?
Reply
#6

Fixed, forgot to inform
Reply
#7

Post the solution and put back your old posts, or I'll report your thread. Because as it is right now, it's basically useless for future reference (people searching for solutions to their issues).

Otherwise, don't ever post a thread in this section again. You're breaking the meaning and purpose of "community forums". If you want private help and don't want to post your code, then go somewhere else.
Reply
#8

Oh, alright, hold on.

EDIT: I'll post the necessary parts, I didn't remember everything I did

FIX: Used an enumerator to replace the 4 variables.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)