loop stops at first find??
#1

I have a loop that loops through the businesses and stops at the first one. How do I get it to keep going?

Here is the loop script:
Код:
for(new idxj=1; idxj<MAX_BIZ; idxj++)
							{
    								if(BizInfo[idxj][b1Am] <= 20 || BizInfo[idxj][b2Am] <= 20 || BizInfo[idxj][b3Am] <= 20 || BizInfo[idxj][b4Am] <= 20 || BizInfo[idxj][b5Am] <= 20 || BizInfo[idxj][b6Am] <= 20)
            						{
								        	new string[256];
								        	new string2[256];
											if(BizInfo[idxj][b1Am] == 0 || BizInfo[idxj][b2Am] == 0 || BizInfo[idxj][b3Am] == 0 || BizInfo[idxj][b4Am] == 0 || BizInfo[idxj][b5Am] == 0 || BizInfo[idxj][b6Am] == 0)
											{
								        		format(string, 128, "We have a Delivery at the corinates: {0000FF}X:{13D4A3}%f {0000FF}Y:{13D4A3}%f {0000FF}Z:{13D4A3}%f", BizInfo[idxj][bX], BizInfo[idxj][bY], BizInfo[idxj][bZ]);
											}
											else
											{
								        		format(string, 128, "We have a Delivery at the corinates: {0000FF}X:{13D4A3}%f {0000FF}Y:{13D4A3}%f {0000FF}Z:{13D4A3}%f", BizInfo[idxj][bX], BizInfo[idxj][bY], BizInfo[idxj][bZ]);
											}
                                        		format(string2, 128, "~b~Attach yuor trailer and goto the waypoint");
												PlayerInfo[playerid][JobVehicle] = CreateVehicle(PlayerInfo[playerid][JobVehicleid], SpawnX, SpawnY, SpawnZ, SpawnAngle, 2, 4, -1);
												SendClientMessage(playerid, COLOR_BLUE, "Attach yuor trailer and goto the waypoint");
		        								GameTextForPlayer(playerid, string2, 10000, 3);
												PlayerInfo[playerid][JobGpsX] = BizInfo[idxj][bX];
												PlayerInfo[playerid][JobGpsY] = BizInfo[idxj][bY];
												PlayerInfo[playerid][JobGpsZ] = BizInfo[idxj][bZ];
												SetPlayerInterior(playerid, 0);
			        							SetPlayerVirtualWorld(playerid, 0);
												PutPlayerInVehicle(playerid, PlayerInfo[playerid][JobVehicle], 0);
                                            if(BizInfo[idxj][bType] == 9) //Checking if gas station
											{
   												PlayerInfo[playerid][JobVehicle2] = CreateVehicle(584, 2394.6130,-2095.7573,14.7100, 271.2081, 6, 6, -1);
												SendClientMessage(playerid, COLOR_BLUE, "Connect your trailer and goto the waypoint");
		        								GameTextForPlayer(playerid, "~b~Connect your trailer and goto the waypoint", 10000, 3);
		        								SetPlayerMapIcon(playerid, 41, 2850.9458,-1532.5475,11.0991, 41, 0, MAPICON_GLOBAL);
                                                PlayerInfo[playerid][JobPickupPos][1] = 2850.9458;
												PlayerInfo[playerid][JobPickupPos][2] = -1532.5475;
												PlayerInfo[playerid][JobPickupPos][3] = 11.0991;
												//SetPlayerMapIcon(playerid, 41, 265.0904,1412.0288,10.4879, 41, 0, MAPICON_GLOBAL);
												//PlayerInfo[playerid][JobPickupPos][1] = 265.0904;
												//PlayerInfo[playerid][JobPickupPos][2] = 1412.0288;
												//PlayerInfo[playerid][JobPickupPos][3] = 10.4879;
											}
          									if(BizInfo[idxj][bType] == 1)
											{
											    SendClientMessage(playerid, COLOR_BLUE, "24/7 needs Restocking");
											    PlayerInfo[playerid][JobVehicle2] = CreateVehicle(PlayerInfo[playerid][JobVehicleid2], 2394.6130,-2095.7573,14.7100, 271.2081, 6, 6, -1);
											    SetPlayerMapIcon(playerid, 41, 2850.9458,-1532.5475,11.0991, 41, 0, MAPICON_GLOBAL);
                                                PlayerInfo[playerid][JobPickupPos][1] = 2850.9458;
												PlayerInfo[playerid][JobPickupPos][2] = -1532.5475;
												PlayerInfo[playerid][JobPickupPos][3] = 11.0991;
											}
											if(BizInfo[idxj][bType] == 2)
											{
											    PlayerInfo[playerid][JobVehicle2] = CreateVehicle(PlayerInfo[playerid][JobVehicleid2], 2394.6130,-2095.7573,14.7100, 271.2081, 6, 6, -1);
											    SetPlayerMapIcon(playerid, 41, 2850.9458,-1532.5475,11.0991, 41, 0, MAPICON_GLOBAL);
											    PlayerInfo[playerid][JobPickupPos][1] = 2850.9458;
												PlayerInfo[playerid][JobPickupPos][2] = -1532.5475;
												PlayerInfo[playerid][JobPickupPos][3] = 11.0991;
											}
											if(BizInfo[idxj][bType] == 3)
											{
											    PlayerInfo[playerid][JobVehicle2] = CreateVehicle(PlayerInfo[playerid][JobVehicleid2], 2394.6130,-2095.7573,14.7100, 271.2081, 6, 6, -1);
											    SendClientMessage(playerid, COLOR_BLUE, "Ammunation needs Restocking");
											    SetPlayerMapIcon(playerid, 41, 2850.9458,-1532.5475,11.0991, 41, 0, MAPICON_GLOBAL);
											    PlayerInfo[playerid][JobPickupPos][1] = 2850.9458;
												PlayerInfo[playerid][JobPickupPos][2] = -1532.5475;
												PlayerInfo[playerid][JobPickupPos][3] = 11.0991;
											}
											if(BizInfo[idxj][bType] == 4)
											{
											    PlayerInfo[playerid][JobVehicle2] = CreateVehicle(PlayerInfo[playerid][JobVehicleid2], 2394.6130,-2095.7573,14.7100, 271.2081, 6, 6, -1);
											    SetPlayerMapIcon(playerid, 41, 2850.9458,-1532.5475,11.0991, 41, 0, MAPICON_GLOBAL);
											    PlayerInfo[playerid][JobPickupPos][1] = 2850.9458;
												PlayerInfo[playerid][JobPickupPos][2] = -1532.5475;
												PlayerInfo[playerid][JobPickupPos][3] = 11.0991;
											}
											if(BizInfo[idxj][bType] == 5)
											{
											    PlayerInfo[playerid][JobVehicle2] = CreateVehicle(PlayerInfo[playerid][JobVehicleid2], 2394.6130,-2095.7573,14.7100, 271.2081, 6, 6, -1);
										    	SetPlayerMapIcon(playerid, 41, 2850.9458,-1532.5475,11.0991, 41, 0, MAPICON_GLOBAL);
										    	PlayerInfo[playerid][JobPickupPos][1] = 2850.9458;
												PlayerInfo[playerid][JobPickupPos][2] = -1532.5475;
												PlayerInfo[playerid][JobPickupPos][3] = 11.0991;
											}
											if(BizInfo[idxj][bType] == 6)
											{
											    PlayerInfo[playerid][JobVehicle2] = CreateVehicle(PlayerInfo[playerid][JobVehicleid2], 2394.6130,-2095.7573,14.7100, 271.2081, 6, 6, -1);
											    SetPlayerMapIcon(playerid, 41, 2850.9458,-1532.5475,11.0991, 41, 0, MAPICON_GLOBAL);
											    PlayerInfo[playerid][JobPickupPos][1] = 2850.9458;
												PlayerInfo[playerid][JobPickupPos][2] = -1532.5475;
												PlayerInfo[playerid][JobPickupPos][3] = 11.0991;
											}
											if(BizInfo[idxj][bType] == 7)
											{
											    PlayerInfo[playerid][JobVehicle2] = CreateVehicle(PlayerInfo[playerid][JobVehicleid2], 2394.6130,-2095.7573,14.7100, 271.2081, 6, 6, -1);
											    SetPlayerMapIcon(playerid, 41, 2850.9458,-1532.5475,11.0991, 41, 0, MAPICON_GLOBAL);
											    PlayerInfo[playerid][JobPickupPos][1] = 2850.9458;
												PlayerInfo[playerid][JobPickupPos][2] = -1532.5475;
												PlayerInfo[playerid][JobPickupPos][3] = 11.0991;
											}
											if(BizInfo[idxj][bType] == 8)
											{
											    PlayerInfo[playerid][JobVehicle2] = CreateVehicle(PlayerInfo[playerid][JobVehicleid2], 2394.6130,-2095.7573,14.7100, 271.2081, 6, 6, -1);
											    SetPlayerMapIcon(playerid, 41, 2850.9458,-1532.5475,11.0991, 41, 0, MAPICON_GLOBAL);
											    PlayerInfo[playerid][JobPickupPos][1] = 2850.9458;
												PlayerInfo[playerid][JobPickupPos][2] = -1532.5475;
												PlayerInfo[playerid][JobPickupPos][3] = 11.0991;
											}
									}
									else
									{
									SendClientMessage(playerid, COLOR_BLUE, "We have no delivery for you at this time");
									return 0;
									}
                            return 0;
    				        }
please help
Reply
#2

bumb please need help
Reply
#3

You need to add 'else if' to type 2 and higher


Example Below:

Код:
if(BizInfo[idxj][bType] == 1)
else if(BizInfo[idxj][bType] == 2)
else if(BizInfo[idxj][bType] == 3)
else if(BizInfo[idxj][bType] == 4)
else if(BizInfo[idxj][bType] == 5)
Reply
#4

still does it
Reply
#5

You are returning at the end of the for-loop.
Reply


Forum Jump:


Users browsing this thread: