help for warning 225: unreachable code
#1

Hi ,

please help me


Код:
C:\Documents and Settings\Administrateur\Bureau\Test rp\filterscripts\a.pwn(206) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/opengatefire", cmdtext, true, 10) == 0)
	{
		if(IsPlayerInRangeOfPoint(playerid, 2, 688.91492, -1576.63770, 14.49800)) return SendClientMessage(playerid, 0xFF6600FF, "   You are not near the door !");
  		{
			MoveObject(Gatefire1, 688.9149, -1576.6377, 11.2180, 1.5);
			SendClientMessage(playerid, 0xFF6600FF, "This Gate has open Now");
			SetTimer("closegatefire1", 10000, false);
			return 1;
		}
		if(IsPlayerInRangeOfPoint(playerid, 2, 699.57281, -1576.63770, 14.16830)) return SendClientMessage(playerid, 0xFF6600FF, "   You are not near the door !");
		{
			MoveObject(Gatefire2, 699.5728, -1576.6377, 10.9980, 1.5);
			SendClientMessage(playerid, 0xFF6600FF, "This Gate has open Now");
			SetTimer("closegatefir2", 10000, false);
			return 1;
		}
	}
	return 0;
}
Link 206

Код:
		if(IsPlayerInRangeOfPoint(playerid, 2, 699.57281, -1576.63770, 14.16830)) return SendClientMessage(playerid, 0xFF6600FF, "   You are not near the door !");
thanks guys
Reply
#2

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/opengatefire", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid, 2, 688.91492, -1576.63770, 14.49800))
        {
            SendClientMessage(playerid, 0xFF6600FF, "   You are not near the door !");
        }
        else
        {
            MoveObject(Gatefire1, 688.9149, -1576.6377, 11.2180, 1.5);
            SendClientMessage(playerid, 0xFF6600FF, "This Gate has open Now");
            SetTimer("closegatefire1", 10000, false);
            return 1;
        }
        if(IsPlayerInRangeOfPoint(playerid, 2, 699.57281, -1576.63770, 14.16830))
        {
            SendClientMessage(playerid, 0xFF6600FF, "   You are not near the door !");
        }
        else
        {
            MoveObject(Gatefire2, 699.5728, -1576.6377, 10.9980, 1.5);
            SendClientMessage(playerid, 0xFF6600FF, "This Gate has open Now");
            SetTimer("closegatefir2", 10000, false);
            return 1;
        }
    }
    return 0;
}
Reply
#3

Thank you !!


edit

But i can open this gates from any place
Reply
#4

This is a prime example of why multiple returns are bullshit, I can understand in this manner having a return 1; after each command is completed but having your code littered with returns is for donkey scripters.

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/opengatefire", cmdtext, true, 10) == 0)
	{
		if(IsPlayerInRangeOfPoint(playerid, 2, 688.91492, -1576.63770, 14.49800))
  		{
			MoveObject(Gatefire1, 688.9149, -1576.6377, 11.2180, 1.5);
			SendClientMessage(playerid, 0xFF6600FF, "This Gate has open Now");
			SetTimer("closegatefire1", 10000, false);
		}
		else if(IsPlayerInRangeOfPoint(playerid, 2, 699.57281, -1576.63770, 14.16830))
		{
			MoveObject(Gatefire2, 699.5728, -1576.6377, 10.9980, 1.5);
			SendClientMessage(playerid, 0xFF6600FF, "This Gate has open Now");
			SetTimer("closegatefir2", 10000, false);
		}
		else SendClientMessage(playerid, 0xFF6600FF, "   You are not near the door !");
		return 1;
	}
	return 0;
}
Reply
#5

@Pottus thanks

i fix it
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/opengatefire", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid, 2, 688.91492, -1576.63770, 14.49800))
        {
            MoveObject(Gatefire1, 688.9149, -1576.6377, 11.2180, 1.5);
            SendClientMessage(playerid, 0xFF6600FF, "This Gate has open Now");
            SetTimer("closegatefire1", 10000, false);
            return 1;
        }
        else if(IsPlayerInRangeOfPoint(playerid, 2, 699.57281, -1576.63770, 14.16830))
        {
            MoveObject(Gatefire2, 699.5728, -1576.6377, 10.9980, 1.5);
            SendClientMessage(playerid, 0xFF6600FF, "This Gate has open Now");
            SetTimer("closegatefir2", 10000, false);
            return 1;
        }
		else
		{
			SendClientMessage(playerid, 0xFF6600FF,"* Not near a Gate that you can use.");
			return 1;
		}
    }
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)