04.01.2013, 01:11
Hello,
My question to you all is, what would the most effective way of writing out this code?
Simply it's placed under OnPlayerRequestClass and it rotates through textdraw showing and hiding them.
I don't like to use this method because it tends to cause some lag during the class selection.
The cases are listed in order - AddPlayerClass
My question to you all is, what would the most effective way of writing out this code?
Simply it's placed under OnPlayerRequestClass and it rotates through textdraw showing and hiding them.
I don't like to use this method because it tends to cause some lag during the class selection.
The cases are listed in order - AddPlayerClass
Код:
switch(classid) { case 0,1,2,3,4,5: { TextDrawHideForPlayer(playerid, TextdrawM0); TextDrawHideForPlayer(playerid, TextdrawM1); TextDrawHideForPlayer(playerid, TextdrawT0); TextDrawHideForPlayer(playerid, TextdrawT1); TextDrawShowForPlayer(playerid, TextdrawC2); TextDrawShowForPlayer(playerid, TextdrawC3); TextDrawShowForPlayer(playerid, TextdrawC4); TextDrawShowForPlayer(playerid, TextdrawC5); TextDrawShowForPlayer(playerid, TextdrawC6); TextDrawShowForPlayer(playerid, TextdrawC7); TextDrawShowForPlayer(playerid, TextdrawC8); TextDrawShowForPlayer(playerid, TextdrawC9); TextDrawHideForPlayer(playerid, TextdrawR2); TextDrawHideForPlayer(playerid, TextdrawR3); TextDrawHideForPlayer(playerid, TextdrawR4); TextDrawHideForPlayer(playerid, TextdrawR5); TextDrawHideForPlayer(playerid, TextdrawR6); //SendClientMessageToAll(COLOR_VIOLETBLUE,"CITY OFFICIER"); } case 6: { TextDrawHideForPlayer(playerid, TextdrawM0); TextDrawHideForPlayer(playerid, TextdrawM1); TextDrawHideForPlayer(playerid, TextdrawT0); TextDrawHideForPlayer(playerid, TextdrawT1); TextDrawShowForPlayer(playerid, TextdrawC2); TextDrawShowForPlayer(playerid, TextdrawC3); TextDrawShowForPlayer(playerid, TextdrawC4); TextDrawShowForPlayer(playerid, TextdrawC5); TextDrawShowForPlayer(playerid, TextdrawC6); TextDrawShowForPlayer(playerid, TextdrawC7); TextDrawShowForPlayer(playerid, TextdrawC8); TextDrawShowForPlayer(playerid, TextdrawC9); TextDrawHideForPlayer(playerid, TextdrawR2); TextDrawHideForPlayer(playerid, TextdrawR3); TextDrawHideForPlayer(playerid, TextdrawR4); TextDrawHideForPlayer(playerid, TextdrawR5); TextDrawHideForPlayer(playerid, TextdrawR6); //SendClientMessageToAll(COLOR_VIOLETBLUE,"SWAT"); } case 7: { TextDrawHideForPlayer(playerid, TextdrawM0); TextDrawHideForPlayer(playerid, TextdrawM1); TextDrawHideForPlayer(playerid, TextdrawT0); TextDrawHideForPlayer(playerid, TextdrawT1); TextDrawShowForPlayer(playerid, TextdrawC2); TextDrawShowForPlayer(playerid, TextdrawC3); TextDrawShowForPlayer(playerid, TextdrawC4); TextDrawShowForPlayer(playerid, TextdrawC5); TextDrawShowForPlayer(playerid, TextdrawC6); TextDrawShowForPlayer(playerid, TextdrawC7); TextDrawShowForPlayer(playerid, TextdrawC8); TextDrawShowForPlayer(playerid, TextdrawC9); TextDrawHideForPlayer(playerid, TextdrawR2); TextDrawHideForPlayer(playerid, TextdrawR3); TextDrawHideForPlayer(playerid, TextdrawR4); TextDrawHideForPlayer(playerid, TextdrawR5); TextDrawHideForPlayer(playerid, TextdrawR6); //SendClientMessageToAll(COLOR_VIOLETBLUE,"FBI"); } case 8: { TextDrawHideForPlayer(playerid, TextdrawM0); TextDrawHideForPlayer(playerid, TextdrawM1); TextDrawHideForPlayer(playerid, TextdrawT0); TextDrawHideForPlayer(playerid, TextdrawT1); TextDrawShowForPlayer(playerid, TextdrawC2); TextDrawShowForPlayer(playerid, TextdrawC3); TextDrawShowForPlayer(playerid, TextdrawC4); TextDrawShowForPlayer(playerid, TextdrawC5); TextDrawShowForPlayer(playerid, TextdrawC6); TextDrawShowForPlayer(playerid, TextdrawC7); TextDrawShowForPlayer(playerid, TextdrawC8); TextDrawShowForPlayer(playerid, TextdrawC9); TextDrawHideForPlayer(playerid, TextdrawR2); TextDrawHideForPlayer(playerid, TextdrawR3); TextDrawHideForPlayer(playerid, TextdrawR4); TextDrawHideForPlayer(playerid, TextdrawR5); TextDrawHideForPlayer(playerid, TextdrawR6); //SendClientMessageToAll(COLOR_VIOLETBLUE,"ARMY"); } case 9: { TextDrawHideForPlayer(playerid, TextdrawM0); TextDrawHideForPlayer(playerid, TextdrawM1); TextDrawHideForPlayer(playerid, TextdrawT0); TextDrawHideForPlayer(playerid, TextdrawT1); TextDrawShowForPlayer(playerid, TextdrawC2); TextDrawShowForPlayer(playerid, TextdrawC3); TextDrawShowForPlayer(playerid, TextdrawC4); TextDrawShowForPlayer(playerid, TextdrawC5); TextDrawShowForPlayer(playerid, TextdrawC6); TextDrawShowForPlayer(playerid, TextdrawC7); TextDrawShowForPlayer(playerid, TextdrawC8); TextDrawShowForPlayer(playerid, TextdrawC9); TextDrawHideForPlayer(playerid, TextdrawR2); TextDrawHideForPlayer(playerid, TextdrawR3); TextDrawHideForPlayer(playerid, TextdrawR4); TextDrawHideForPlayer(playerid, TextdrawR5); TextDrawHideForPlayer(playerid, TextdrawR6); //SendClientMessageToAll(COLOR_VIOLETBLUE,"CIA"); } case 10: { TextDrawHideForPlayer(playerid, TextdrawM0); TextDrawHideForPlayer(playerid, TextdrawM1); TextDrawHideForPlayer(playerid, TextdrawT0); TextDrawHideForPlayer(playerid, TextdrawT1); TextDrawShowForPlayer(playerid, TextdrawC2); TextDrawShowForPlayer(playerid, TextdrawC3); TextDrawShowForPlayer(playerid, TextdrawC4); TextDrawShowForPlayer(playerid, TextdrawC5); TextDrawShowForPlayer(playerid, TextdrawC6); TextDrawShowForPlayer(playerid, TextdrawC7); TextDrawShowForPlayer(playerid, TextdrawC8); TextDrawShowForPlayer(playerid, TextdrawC9); TextDrawHideForPlayer(playerid, TextdrawR2); TextDrawHideForPlayer(playerid, TextdrawR3); TextDrawHideForPlayer(playerid, TextdrawR4); TextDrawHideForPlayer(playerid, TextdrawR5); TextDrawHideForPlayer(playerid, TextdrawR6); //SendClientMessageToAll(COLOR_VIOLETBLUE,"CASUAL OFFICER - COP"); } case 11: { TextDrawHideForPlayer(playerid, TextdrawME0); TextDrawHideForPlayer(playerid, TextdrawME1); TextDrawHideForPlayer(playerid, TextdrawM0); TextDrawHideForPlayer(playerid, TextdrawM1); TextDrawHideForPlayer(playerid, TextdrawT0); TextDrawHideForPlayer(playerid, TextdrawT1); TextDrawShowForPlayer(playerid, TextdrawC2); TextDrawShowForPlayer(playerid, TextdrawC3); TextDrawShowForPlayer(playerid, TextdrawC4); TextDrawShowForPlayer(playerid, TextdrawC5); TextDrawShowForPlayer(playerid, TextdrawC6); TextDrawShowForPlayer(playerid, TextdrawC7); TextDrawShowForPlayer(playerid, TextdrawC8); TextDrawShowForPlayer(playerid, TextdrawC9); TextDrawHideForPlayer(playerid, TextdrawR2); TextDrawHideForPlayer(playerid, TextdrawR3); TextDrawHideForPlayer(playerid, TextdrawR4); TextDrawHideForPlayer(playerid, TextdrawR5); TextDrawHideForPlayer(playerid, TextdrawR6); //SendClientMessageToAll(COLOR_VIOLETBLUE,"AIR - COP"); } case 12: { TextDrawHideForPlayer(playerid, TextdrawME0); TextDrawHideForPlayer(playerid, TextdrawME1); TextDrawHideForPlayer(playerid, TextdrawM0); TextDrawHideForPlayer(playerid, TextdrawM1); TextDrawHideForPlayer(playerid, TextdrawT0); TextDrawHideForPlayer(playerid, TextdrawT1); TextDrawShowForPlayer(playerid, TextdrawC2); TextDrawShowForPlayer(playerid, TextdrawC3); TextDrawShowForPlayer(playerid, TextdrawC4); TextDrawShowForPlayer(playerid, TextdrawC5); TextDrawShowForPlayer(playerid, TextdrawC6); TextDrawShowForPlayer(playerid, TextdrawC7); TextDrawShowForPlayer(playerid, TextdrawC8); TextDrawShowForPlayer(playerid, TextdrawC9); TextDrawHideForPlayer(playerid, TextdrawR2); TextDrawHideForPlayer(playerid, TextdrawR3); TextDrawHideForPlayer(playerid, TextdrawR4); TextDrawHideForPlayer(playerid, TextdrawR5); TextDrawHideForPlayer(playerid, TextdrawR6); //SendClientMessageToAll(COLOR_VIOLETBLUE,"MARINE - COP"); } case 13: { TextDrawShowForPlayer(playerid, TextdrawME0); TextDrawShowForPlayer(playerid, TextdrawME1); TextDrawHideForPlayer(playerid, TextdrawM0); TextDrawHideForPlayer(playerid, TextdrawM1); TextDrawHideForPlayer(playerid, TextdrawT0); TextDrawHideForPlayer(playerid, TextdrawT1); TextDrawHideForPlayer(playerid, TextdrawC2); TextDrawHideForPlayer(playerid, TextdrawC3); TextDrawHideForPlayer(playerid, TextdrawC4); TextDrawHideForPlayer(playerid, TextdrawC5); TextDrawHideForPlayer(playerid, TextdrawC6); TextDrawHideForPlayer(playerid, TextdrawC7); TextDrawHideForPlayer(playerid, TextdrawC8); TextDrawHideForPlayer(playerid, TextdrawC9); TextDrawHideForPlayer(playerid, TextdrawR2); TextDrawHideForPlayer(playerid, TextdrawR3); TextDrawHideForPlayer(playerid, TextdrawR4); TextDrawHideForPlayer(playerid, TextdrawR5); TextDrawHideForPlayer(playerid, TextdrawR6); //SendClientMessageToAll(COLOR_VIOLETBLUE,"MEDIC"); } case 14, 15: { TextDrawHideForPlayer(playerid, TextdrawME0); TextDrawHideForPlayer(playerid, TextdrawME1); TextDrawShowForPlayer(playerid, TextdrawM0); TextDrawShowForPlayer(playerid, TextdrawM1); TextDrawHideForPlayer(playerid, TextdrawT0); TextDrawHideForPlayer(playerid, TextdrawT1); TextDrawHideForPlayer(playerid, TextdrawC2); TextDrawHideForPlayer(playerid, TextdrawC3); TextDrawHideForPlayer(playerid, TextdrawC4); TextDrawHideForPlayer(playerid, TextdrawC5); TextDrawHideForPlayer(playerid, TextdrawC6); TextDrawHideForPlayer(playerid, TextdrawC7); TextDrawHideForPlayer(playerid, TextdrawC8); TextDrawHideForPlayer(playerid, TextdrawC9); TextDrawHideForPlayer(playerid, TextdrawR2); TextDrawHideForPlayer(playerid, TextdrawR3); TextDrawHideForPlayer(playerid, TextdrawR4); TextDrawHideForPlayer(playerid, TextdrawR5); TextDrawHideForPlayer(playerid, TextdrawR6); //SendClientMessageToAll(COLOR_VIOLETBLUE,"MECHANIC"); } case 16,17: { TextDrawHideForPlayer(playerid, TextdrawME0); TextDrawHideForPlayer(playerid, TextdrawME1); TextDrawHideForPlayer(playerid, TextdrawM0); TextDrawHideForPlayer(playerid, TextdrawM1); TextDrawShowForPlayer(playerid, TextdrawT0); TextDrawShowForPlayer(playerid, TextdrawT1); TextDrawHideForPlayer(playerid, TextdrawC2); TextDrawHideForPlayer(playerid, TextdrawC3); TextDrawHideForPlayer(playerid, TextdrawC4); TextDrawHideForPlayer(playerid, TextdrawC5); TextDrawHideForPlayer(playerid, TextdrawC6); TextDrawHideForPlayer(playerid, TextdrawC7); TextDrawHideForPlayer(playerid, TextdrawC8); TextDrawHideForPlayer(playerid, TextdrawC9); TextDrawHideForPlayer(playerid, TextdrawR2); TextDrawHideForPlayer(playerid, TextdrawR3); TextDrawHideForPlayer(playerid, TextdrawR4); TextDrawHideForPlayer(playerid, TextdrawR5); TextDrawHideForPlayer(playerid, TextdrawR6); //SendClientMessageToAll(COLOR_VIOLETBLUE,"TAXI"); } case 18,19,20,21,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103: { TextDrawHideForPlayer(playerid, TextdrawME0); TextDrawHideForPlayer(playerid, TextdrawME1); TextDrawHideForPlayer(playerid, TextdrawM0); TextDrawHideForPlayer(playerid, TextdrawM1); TextDrawHideForPlayer(playerid, TextdrawT0); TextDrawHideForPlayer(playerid, TextdrawT1); TextDrawHideForPlayer(playerid, TextdrawC2); TextDrawHideForPlayer(playerid, TextdrawC3); TextDrawHideForPlayer(playerid, TextdrawC4); TextDrawHideForPlayer(playerid, TextdrawC5); TextDrawHideForPlayer(playerid, TextdrawC6); TextDrawHideForPlayer(playerid, TextdrawC7); TextDrawHideForPlayer(playerid, TextdrawC8); TextDrawHideForPlayer(playerid, TextdrawC9); TextDrawShowForPlayer(playerid, TextdrawR2); TextDrawShowForPlayer(playerid, TextdrawR3); TextDrawShowForPlayer(playerid, TextdrawR4); TextDrawShowForPlayer(playerid, TextdrawR5); TextDrawShowForPlayer(playerid, TextdrawR6); //SendClientMessageToAll(COLOR_VIOLETBLUE,"CIVILIAN"); } } TextDrawShowForPlayer(playerid, TextdrawC0); TextDrawShowForPlayer(playerid, TextdrawC1); TextDrawShowForPlayer(playerid, TextdrawCB2); TextDrawShowForPlayer(playerid, TextdrawCB3); TextDrawShowForPlayer(playerid, TextdrawCB4); TextDrawShowForPlayer(playerid, TextdrawCB5); TextDrawShowForPlayer(playerid, TextdrawCB6); TextDrawShowForPlayer(playerid, TextdrawCB7); TextDrawShowForPlayer(playerid, TextdrawCB8); TextDrawShowForPlayer(playerid, TextdrawCB9); TextDrawShowForPlayer(playerid, TextdrawC10); TextDrawShowForPlayer(playerid, TextdrawC11); TextDrawShowForPlayer(playerid, TextdrawC12); TextDrawShowForPlayer(playerid, TextdrawC13); TextDrawShowForPlayer(playerid, TextdrawC14); TextDrawShowForPlayer(playerid, TextdrawC15); TextDrawShowForPlayer(playerid, TextdrawC16); TextDrawShowForPlayer(playerid, TextdrawC17);