11.08.2009, 07:26
Can be way simpler:
Original code:
Admin only:
Saves a lot of code, saves messing with brackets/indentation and is simply cleaner.
Code:
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000AA, "This command can only be used by an admin!!");
Code:
if (strcmp("/cctv", cmdtext, true) == 0) { PlayerMenu[playerid] = 0; TogglePlayerControllable(playerid, 0); ShowMenuForPlayer(CCTVMenu[0], playerid); return 1; }
Code:
if (strcmp("/cctv", cmdtext, true) == 0) { if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000AA, "This command can only be used by an admin!!"); PlayerMenu[playerid] = 0; TogglePlayerControllable(playerid, 0); ShowMenuForPlayer(CCTVMenu[0], playerid); return 1; }