05.01.2016, 11:50
You could make a switch:
If you plan to change the times later on, or add some extra hour-values, you can easily add them to that list.
Otherwise you need to extends and possibly rewrite the entire if-statement.
Perhaps you want to run that code at hour 6 and 15 later on as well, you could easily do:
Using "if" would make it pretty long and more complex:
pawn Код:
select hour
{
case 20, 21, 22:
{
// Your code here
}
}
Otherwise you need to extends and possibly rewrite the entire if-statement.
Perhaps you want to run that code at hour 6 and 15 later on as well, you could easily do:
pawn Код:
select hour
{
case 6, 15, 20, 21, 22:
{
// Your code here
}
}
pawn Код:
if (((hour >=20 && hour <=22)) || (hour == 6) || (hour == 15))