Loop are not working.
#1

Hi, so well. I guess I'm just tired and too blind to see any problem, but..
This loop isn't working;
PHP код:
for(new sent 0sent 27sent++) {
    
printf("%i"sent); 
It just prints 0, and I did try multiple times.
http://prntscr.com/buz1q8

Here's the full loop;
PHP код:
for(new sent 0sent 27sent++) {
                                    
printf("%i"sent);
                                    
printf("%i"sent);
                                    if(
oUsed[playerid][sent] == 0) {
                                        
oUsed[playerid][sent] = 1;
                                        
oStages[playerid] = sent;
                                        
oStage[playerid]++;
                                        switch(
sent) {
                                            case 
1: {
                                                
ShowPlayerDialog(playerid879DIALOG_STYLE_INPUT"The Office""Read and type the sentence correctly below.\nOrder meeting at 2:00 PM Thursday.""Contine""Cancel");
                                            }
                                            case 
2: {
                                                
ShowPlayerDialog(playerid879DIALOG_STYLE_INPUT"The Office""Read and type the sentence correctly below.\nSign copyright notices for Credit Union.""Contine""Cancel");
                                            }
                                            case 
3: {
                                                
ShowPlayerDialog(playerid879DIALOG_STYLE_INPUT"The Office""Read and type the sentence correctly below.\nReview wages for all maintenance workers.""Contine""Cancel");
                                            }
                                            case 
4: {
                                                
ShowPlayerDialog(playerid879DIALOG_STYLE_INPUT"The Office""Read and type the sentence correctly below.\nRecalibrate CCTV in the Police Station.""Contine""Cancel");
                                            }
                                            case 
5: {
                                                
ShowPlayerDialog(playerid879DIALOG_STYLE_INPUT"The Office""Read and type the sentence correctly below.\nArchive unreviewed court documents.""Contine""Cancel");
                                            }
                                            case 
6: {
                                                
ShowPlayerDialog(playerid879DIALOG_STYLE_INPUT"The Office""Read and type the sentence correctly below.\nArchive all miscellaneous video footage.""Contine""Cancel");
                                            }
                                            case 
7: {
                                                
ShowPlayerDialog(playerid879DIALOG_STYLE_INPUT"The Office""Read and type the sentence correctly below.\nReview second floor office schedules.""Contine""Cancel");
                                            }
                                            case 
8: {
                                                
ShowPlayerDialog(playerid879DIALOG_STYLE_INPUT"The Office""Read and type the sentence correctly below.\nOffice application reviews at 12:30 PM.""Contine""Cancel");
                                            }
                                            case 
9: {
                                                
ShowPlayerDialog(playerid879DIALOG_STYLE_INPUT"The Office""Read and type the sentence correctly below.\nReset streetlight software at 12:00 AM.""Contine""Cancel");
                                            }
                                            case 
10: {
                                                
ShowPlayerDialog(playerid879DIALOG_STYLE_INPUT"The Office""Read and type the sentence correctly below.\nDocument all uses of company software.""Contine""Cancel");
                                            }
                                            case 
11: {
                                                
ShowPlayerDialog(playerid879DIALOG_STYLE_INPUT"The Office""Read and type the sentence correctly below.\nPlace all faulty office hardware in inventory.""Contine""Cancel");
                                            }
                                            case 
12: {
                                                
ShowPlayerDialog(playerid879DIALOG_STYLE_INPUT"The Office""Read and type the sentence correctly below.\nAssign security detail to weapons shipment.""Contine""Cancel");
                                            }
                                            case 
13: {
                                                
ShowPlayerDialog(playerid879DIALOG_STYLE_INPUT"The Office""Read and type the sentence correctly below.\nEncode prioritized police messages.""Contine""Cancel");
                                            }
                                            case 
14: {
                                                
ShowPlayerDialog(playerid879DIALOG_STYLE_INPUT"The Office""Read and type the sentence correctly below.\nRequest interception of FM radio traffic.""Contine""Cancel");
                                            }
                                            case 
15: {
                                                
ShowPlayerDialog(playerid879DIALOG_STYLE_INPUT"The Office""Read and type the sentence correctly below.\nRequest recent police medical documents.""Contine""Cancel");
                                            }
                                            case 
16: {
                                                
ShowPlayerDialog(playerid879DIALOG_STYLE_INPUT"The Office""Read and type the sentence correctly below.\nDocument drug password 'Cloud 9'""Contine""Cancel");
                                            }
                                            case 
17: {
                                                
ShowPlayerDialog(playerid879DIALOG_STYLE_INPUT"The Office""Read and type the sentence correctly below.\nRequest underground generator calibration.""Contine""Cancel");
                                            }
                                            case 
18: {
                                                
ShowPlayerDialog(playerid879DIALOG_STYLE_INPUT"The Office""Read and type the sentence correctly below.\nDelete deceased citizens from database.""Contine""Cancel");
                                            }
                                            case 
19: {
                                                
ShowPlayerDialog(playerid879DIALOG_STYLE_INPUT"The Office""Read and type the sentence correctly below.\nReset citywide date and time.""Contine""Cancel");
                                            }
                                            case 
20: {
                                                
ShowPlayerDialog(playerid879DIALOG_STYLE_INPUT"The Office""Read and type the sentence correctly below.\nEncode messages regarding Project Zero.""Contine""Cancel");
                                            }
                                            case 
21: {
                                                
ShowPlayerDialog(playerid879DIALOG_STYLE_INPUT"The Office""Read and type the sentence correctly below.\nEncode radio traffic about Project Zero.""Contine""Cancel");
                                            }
                                            case 
22: {
                                                
ShowPlayerDialog(playerid879DIALOG_STYLE_INPUT"The Office""Read and type the sentence correctly below.\nReview construction notice for the church.""Contine""Cancel");
                                            }
                                            case 
23: {
                                                
ShowPlayerDialog(playerid879DIALOG_STYLE_INPUT"The Office""Read and type the sentence correctly below.\nArchive all unused hardware in inventory.""Contine""Cancel");
                                            }
                                            case 
24: {
                                                
ShowPlayerDialog(playerid879DIALOG_STYLE_INPUT"The Office""Read and type the sentence correctly below.\nEncode messages regarding Omega Protocol.""Contine""Cancel");
                                            }
                                            case 
25: {
                                                
ShowPlayerDialog(playerid879DIALOG_STYLE_INPUT"The Office""Read and type the sentence correctly below.\nReview details of authorized blade battles.""Contine""Cancel");
                                            }
                                            case 
26: {
                                                
ShowPlayerDialog(playerid879DIALOG_STYLE_INPUT"The Office""Read and type the sentence correctly below.\nGreenlight all police record metadata.""Contine""Cancel");
                                            }
                                            case 
27: {
                                                
ShowPlayerDialog(playerid879DIALOG_STYLE_INPUT"The Office""Read and type the sentence correctly below.\nDecline all requests to leave The District.""Contine""Cancel");
                                            }
                                        }
                                        break;
                                    }
                                }
                            } 
And trust me, you don't want the full code, you don't want to read 4k lines xD
Reply
#2

It stops on the first iteration as you're using "break;" after the switch.
Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
It stops on the first iteration as you're using "break;" after the switch.
So where should I break the loop?
Edit;
Waow..
I'm stupid..
I should've use random..
Sorry.
Reply
#4

You break the loop when you don't need to go to any other iteration, that depends on your code and what you try to do.

The switch is exaggeration, have a 2D array (static local or global) and just format your dialog's info.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)