18.06.2013, 14:56
They will work but are not needed and out of place that is what is wrong. It messes up your program flow too take the following statement.
You tell me what makes more sense in practice.
This way.
Or This way
I don't know about you but the second makes more sense our functions are in alignment now instead of being offset by the return; in readability terms this is much better. Secondly there is only one return 1; it is the last function call in the scope of this function and will always be called once.
This is a bad reason;
This is how it should look.
Your only going to return 1; so the command processor knows the command was successful.
You tell me what makes more sense in practice.
This way.
pawn Код:
SomeCheck()
{
if(a == 1)
{
DoSomeThing();
return 1;
}
DoSomeThingElse();
return 1;
}
pawn Код:
SomeCheck()
{
if(a == 1)
{
DoSomething();
}
else
{
DoSomethingElse();
}
return 1;
}
Quote:
Read the comments.
return 1; // This is to prevent the code from further executing. |
This is how it should look.
pawn Код:
CMD:adminroof(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, 1847.7333,-1761.9608,13.5469))
{
SetPlayerPos(playerid, 1889.0286,-1782.9777,25.7911);//Naar boven
SetPlayerInterior(playerid, 0);
SendClientMessage(playerid, COLOR_GREEN, "*You use the elevator to get on the roof*");
}
else SendClientMessage(playerid,0xFFFFFF00,"DEBUG: Not in range!"); //If the IsPlayerInRangeOfPoint check fails,
return 1;
}