09.03.2017, 00:38
Who is code optimization
or
Код:
stock ShowEvents(playerid) { if(EventID == 0) { new string[467], str1[208], str2[217], str3[35]; format(str1, sizeof(str1), "......................................."); format(str2, sizeof(str2), "......................................."); format(str3, sizeof(str3), "......................................."); format(string, sizeof(string), "%s%s%s", str1, str2, str3); ShowPlayerDialog(playerid, 10004, DIALOG_STYLE_LIST, "Events", string, "Ok", "Exit"); } else if(EventID > 0) { new string[28]; new EventDialog[14] = { 0,10008,10009,10010,10011,10014,10015,10016,10017,10018,10019,10020,10021,10022 }; format(string, sizeof(string), "%s", EInfo[EventID][eName]); ShowPlayerDialog(playerid, EventDialog[EventID], DIALOG_STYLE_LIST, string, "Open\nClose\nCount", "Ok", "Exit"); } return 1; }
Код:
stock ShowEvents(playerid) { switch(EventID) { case 0: { new string[467], str1[208], str2[217], str3[35]; format(str1, sizeof(str1), "......................................."); format(str2, sizeof(str2), "......................................."); format(str3, sizeof(str3), "......................................."); format(string, sizeof(string), "%s%s%s", str1, str2, str3); ShowPlayerDialog(playerid, 10004, DIALOG_STYLE_LIST, "Events", string, "Ok", "Exit"); } case 1: ShowPlayerDialog(playerid, 10008, DIALOG_STYLE_LIST, "Events", "Open\nClose\nCount", "Ok", "Exit"); case 2: ShowPlayerDialog(playerid, 10009, DIALOG_STYLE_LIST, "Events", "Open\nClose\nCount", "Ok", "Exit"); case 3: ShowPlayerDialog(playerid, 10010, DIALOG_STYLE_LIST, "Events", "Open\nClose\nCount", "Ok", "Exit"); case 4: ShowPlayerDialog(playerid, 10011, DIALOG_STYLE_LIST, "Events", "Open\nClose\nCount", "Ok", "Exit"); case 5: ShowPlayerDialog(playerid, 10014, DIALOG_STYLE_LIST, "Events", "Open\nClose\nCount", "Ok", "Exit"); case 6: ShowPlayerDialog(playerid, 10015, DIALOG_STYLE_LIST, "Events", "Open\nClose\nCount", "Ok", "Exit"); case 7: ShowPlayerDialog(playerid, 10016, DIALOG_STYLE_LIST, "Events", "Open\nClose\nCount", "Ok", "Exit"); case 8: ShowPlayerDialog(playerid, 10017, DIALOG_STYLE_LIST, "Events", "Open\nClose\nCount", "Ok", "Exit"); case 9: ShowPlayerDialog(playerid, 10018, DIALOG_STYLE_LIST, "Events ", "Open\nClose\nCount", "Ok", "Exit"); case 10: ShowPlayerDialog(playerid, 10019, DIALOG_STYLE_LIST, "Events ", "Open\nClose\nCount", "Ok", "Exit"); case 11: ShowPlayerDialog(playerid, 10020, DIALOG_STYLE_LIST, "Events ", "Open\nClose\nCount", "Ok", "Exit"); case 12: ShowPlayerDialog(playerid, 10021, DIALOG_STYLE_LIST, "Events", "Open\nClose\nCount", "Ok", "Exit"); case 13: ShowPlayerDialog(playerid, 10022, DIALOG_STYLE_LIST, "Events", "Open\nClose\nCount", "Ok", "Exit"); } return 1; }