Warning Unreachable Code?
#1

http://gyazo.com/9428fa4d21f5ca0b2c94c63bfefb30f8


Fix for this?
Thanks
Reply
#2

Mind coping that code here? Line 2317 -- 2326 so I can correct it for you?
Reply
#3

Код:
	if(dialogid == 8)
	{
	  	if(!response){ RemoveDriverFromVehicle(playerid); return 1; }
		{
		    GameTextForPlayer(playerid, "Please Wait...", 3000, 1);
		    ShowPlayerDialog(playerid,8,DIALOG_STYLE_MSGBOX,"Hotwire Vehicle","You don't have the keys to this vehicle, But this can be hotwired!","Hotwire","Cancel");
       		return 1;
		}
	  	if(engine[GetPlayerVehicleID(playerid)-1] == 0)
    {
Reply
#4

Indentation, identation, identation. What a horrible mess this is. Let's write that out, shall we? This is YOUR code, I have changed nothing, but the formatting.
PHP код:
if(dialogid == 8)
{
    if(!
response)
    { 
        
RemoveDriverFromVehicle(playerid); 
        return 
1
    }
    { 
// <-- this block is unconditional, so it always gets executed
        
GameTextForPlayer(playerid"Please Wait..."30001);
        
ShowPlayerDialog(playerid,8,DIALOG_STYLE_MSGBOX,"Hotwire Vehicle","You don't have the keys to this vehicle, But this can be hotwired!","Hotwire","Cancel");
        return 
1// <-- hence, this return always gets executed
    
}
    if(
engine[GetPlayerVehicleID(playerid)-1] == 0// <-- hence, this code can never be reached
    

Reply
#5

Quote:
Originally Posted by Vince
Посмотреть сообщение
Indentation, identation, identation. What a horrible mess this is. Let's write that out, shall we? This is YOUR code, I have changed nothing, but the formatting.
PHP код:
if(dialogid == 8)
{
    if(!
response)
    { 
        
RemoveDriverFromVehicle(playerid); 
        return 
1
    }
    { 
// <-- this block is unconditional, so it always gets executed
        
GameTextForPlayer(playerid"Please Wait..."30001);
        
ShowPlayerDialog(playerid,8,DIALOG_STYLE_MSGBOX,"Hotwire Vehicle","You don't have the keys to this vehicle, But this can be hotwired!","Hotwire","Cancel");
        return 
1// <-- hence, this return always gets executed
    
}
    if(
engine[GetPlayerVehicleID(playerid)-1] == 0// <-- hence, this code can never be reached
    

So.. What, it works now? Or..?
Reply
#6

No, I am trying to show you your mistake and the importance of proper indentation. If I (or someone else) fixes your code now you learn nothing and you'll be back here with another problem before you know it, and that doesn't help you, nor us.

Give a man a fish and you'll feed him for a day. Teach a man to fish and you'll feed him for a lifetime.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)