30.07.2012, 06:38
What you did wrong.
So the correct way would be.
pawn Код:
if(strcmp("/closetank47", cmdtext, false, 10) == 0)
{
// if the player is in range of the point
if(IsPlayerInRangeOfPoint(playerid, 2, 652.20001220703, -1506.3000488281, 23.5))
{
// this code will be ran
SendClientMessage(playerid, 0x10F441AA, "Tank Closed!");
Create3DTextLabel("Tank Closed!", 0x10F441AA, 658.70001220703, -1507.5999755859, 22, 40.0, 0, 1);
// and returning 1 here stops the rest of the command from processing
return 1;
}
// if the player is not in range of the point
else
{
// this code is ran
SendClientMessage(playerid, 0xAFAFAFAA, "Get Closer to the Tank!");
// and returning 1 here stops the code
return 1;
}
// since both statements stop the rest of the command
// the code below will never be reachable, that explains the "unreachable code" error.
return 1;
}
pawn Код:
if(strcmp("/closetank47", cmdtext, false, 10) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 2, 652.20001220703, -1506.3000488281, 23.5))
{
SendClientMessage(playerid, 0x10F441AA, "Tank Closed!");
Create3DTextLabel("Tank Closed!", 0x10F441AA, 658.70001220703, -1507.5999755859, 22, 40.0, 0, 1);
return 1;
}
else
{
SendClientMessage(playerid, 0xAFAFAFAA, "Get Closer to the Tank!");
}
return 1;
}