One warning.
#1

Hi there. I have a command, /v register it s something that puts on a car a plate. So-.. I made the command simply, then I thought that I should add something new and make it more "professional" .. Now I have a warning that I just don't F'n now how to repair-.. It looks reallllly ok in pawno-.. Only I get that error.

Код:
C:\Users\SpikeSpigel\Desktop\GM + comenzi\/IBP/Publics/OnPlayerCommandReceived.pwn(27782) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Код:
  			else if(strcmp(x_vehicle, "register", true) == 0)
			{
				if (PlayerToPoint(20.0,playerid,2521.7505,-1546.5853,24.0859) || PlayerToPoint(20.0,playerid,1314.6570,-863.1125,39.3507))
				{
					if(!IsPlayerInAnyVehicle(playerid))
					{
   						return 1;
					}
					else
					{
						SendClientMessage(playerid, COLOR_GRAD2, "Trebuie sa fi intr-o masina pentru a folosi aceasta comanda.");
						return 1;
					}
					if(GetPlayerCash(playerid) < 300)
					{
            			SendClientMessage(playerid, COLOR_GREY, "Ai nevoie de 300$ pentru a inmatricula masina.");
						return 1;
					}
					if (PlayerInfo[playerid][pFaction] == 8)
					{
						ShowPlayerDialog(playerid,572,DIALOG_STYLE_INPUT,"{00ABFF}Numar de inmatriculare","{FFFFFF}Introdu numarul.","Ok","Refuza");
					}
					else
					{
						SendClientMessage(playerid, COLOR_GREY, "Nu esti membru LSVR");
						return 1;
					}
				}
			}
The red one is bugged-.. It only looks like that on the forum, on pawno looks OK.

Image of the code in pawno>>


http://i.imgur.com/dxqhBIP.png
Reply
#2

The code will never reached because you're using return 1; in the two blocks above, so the code will stop in either cases. Remove one of the return 1; I suppose here:
Код:
if(!IsPlayerInAnyVehicle(playerid))
					{
   						return 1;
					}
Reply
#3

I repair that. It should look like that:

Код:
  			else if(strcmp(x_vehicle, "register", true) == 0)
			{
				if (PlayerToPoint(20.0,playerid,2521.7505,-1546.5853,24.0859) || PlayerToPoint(20.0,playerid,1314.6570,-863.1125,39.3507))
				{
					if(!IsPlayerInAnyVehicle(playerid))
					{
						if(GetPlayerCash(playerid) < 300)
						{
	            			SendClientMessage(playerid, COLOR_GREY, "Ai nevoie de 300$ pentru a inmatricula masina.");
							return 1;
						}
						if (PlayerInfo[playerid][pFaction] == 8)
						{
							ShowPlayerDialog(playerid,572,DIALOG_STYLE_INPUT,"{00ABFF}Numar de inmatriculare","{FFFFFF}Introdu numarul.","Ok","Refuza");
						}
						else
						{
							SendClientMessage(playerid, COLOR_GREY, "Nu esti membru LSVR");
							return 1;
						}
						return 1;
					}
					else
					{
					    SendClientMessage(playerid, COLOR_GRAD2, "Trebuie sa fi intr-o masina pentru a folosi aceasta comanda.");
					    return 1;
					}
				}
			}
Not like that-..

Код:
			else if(strcmp(x_vehicle, "register", true) == 0)
			{
				if (PlayerToPoint(20.0,playerid,2521.7505,-1546.5853,24.0859) || PlayerToPoint(20.0,playerid,1314.6570,-863.1125,39.3507))
				{
					if(!IsPlayerInAnyVehicle(playerid))
					{
   						return 1;
					}
					else
					{
						SendClientMessage(playerid, COLOR_GRAD2, "Trebuie sa fi intr-o masina pentru a folosi aceasta comanda.");
						return 1;
					}
					if(GetPlayerCash(playerid) < 300)
					{
            			SendClientMessage(playerid, COLOR_GREY, "Ai nevoie de 300$ pentru a inmatricula masina.");
						return 1;
					}
					if (PlayerInfo[playerid][pFaction] == 8)
					{
						ShowPlayerDialog(playerid,572,DIALOG_STYLE_INPUT,"{00ABFF}Numar de inmatriculare","{FFFFFF}Introdu numarul.","Ok","Refuza");
					}
					else
					{
						SendClientMessage(playerid, COLOR_GREY, "Nu esti membru LSVR");
						return 1;
					}
				}
			}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)