Всем Добрый день.
У меня вопрос
Как нибудь можно оптимизировать код ниже?
сократить количество строк?
Код:
if(weaponid == 0)
{
switch(armour)
{
case 0:
{
switch(bodypart)
{
case 3: SetPlayerHealth(playerid, health - 5); // Torso.
case 4: SetPlayerHealth(playerid, health - 5); // Groin.
case 5: SetPlayerHealth(playerid, health - 5); // Left Arm.
case 6: SetPlayerHealth(playerid, health - 5); // Right Arm.
case 7: SetPlayerHealth(playerid, health - 5); // Left Leg.
case 8: SetPlayerHealth(playerid, health - 5); // Right Leg.
case 9: SetPlayerHealth(playerid, health - 5); // Head.
}
}
default:
{
switch(bodypart)
{
case 3: SetPlayerHealth(playerid, health - 5); // Torso.
case 4: SetPlayerHealth(playerid, health - 5); // Groin.
case 5: SetPlayerHealth(playerid, health - 5); // Left Arm.
case 6: SetPlayerHealth(playerid, health - 5); // Right Arm.
case 7: SetPlayerHealth(playerid, health - 5); // Left Leg.
case 8: SetPlayerHealth(playerid, health - 5); // Right Leg.
case 9: SetPlayerHealth(playerid, health - 5); // Head.
}
}
}
}
Если возможно то покажите на этом примере.
- - - Добавлено - - -
Все разобрался тему можно закрыть .