12.04.2013, 13:44
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; }