Intrebare cod
Posted: 05 Jan 2018, 05:58
Am si eu o intrebare. Cat de optim e? eu zic ca altceva n-ar avea ce sa ii faca
GetDay arata numele dayului, cum as putea sa fac sa il arate? eu m-am gandit la un string si dupa il returnez.
Code: Select all
/*IsDay = 1 Zombie Day
IsDay = 2 Reverse Zombie Day
IsDay = 3 Knife Day
IsDay = 4 Fotball
IsDay = 5 Gun Day
IsDay = 6 Sparta Day
IsDay = 7 GodMode Day
IsDay = 8 Paintball Day
IsDay = 9 Nightcrawler
IsDay = 10 Nightcrawler Reverse
IsDay = 11 HNS
IsDay = 12 HNS reverse
IsDay = 13 Shark Day
IsDay = 14 Space Day*/
switch(IsDay)
{
case 1..2: player_hudmessage(0, 2, HUD_DELAY + 1.0, {0, 255, 0}, "%L", LANG_SERVER, "JBE_IS_DAY", GetDay(1))
case 3: player_hudmessage(0, 2, HUD_DELAY + 1.0, {0, 255, 0}, "%L", LANG_SERVER, "JBE_IS_DAY", GetDay(3))
case 4: player_hudmessage(0, 2, HUD_DELAY + 1.0, {0, 255, 0}, "%L", LANG_SERVER, "JBE_IS_DAY", GetDay(4))
case 5: player_hudmessage(0, 2, HUD_DELAY + 1.0, {0, 255, 0}, "%L", LANG_SERVER, "JBE_IS_DAY", GetDay(5))
case 6: player_hudmessage(0, 2, HUD_DELAY + 1.0, {0, 255, 0}, "%L", LANG_SERVER, "JBE_IS_DAY", GetDay(6))
case 7: player_hudmessage(0, 2, HUD_DELAY + 1.0, {0, 255, 0}, "%L", LANG_SERVER, "JBE_IS_DAY", GetDay(7))
case 8: player_hudmessage(0, 2, HUD_DELAY + 1.0, {0, 255, 0}, "%L", LANG_SERVER, "JBE_IS_DAY", GetDay(8))
case 9..10: player_hudmessage(0, 2, HUD_DELAY + 1.0, {0, 255, 0}, "%L", LANG_SERVER, "JBE_IS_DAY", GetDay(9))
case 11..12: player_hudmessage(0, 2, HUD_DELAY + 1.0, {0, 255, 0}, "%L", LANG_SERVER, "JBE_IS_DAY", GetDay(11))
case 13: player_hudmessage(0, 2, HUD_DELAY + 1.0, {0, 255, 0}, "%L", LANG_SERVER, "JBE_IS_DAY", GetDay(13))
case 14: player_hudmessage(0, 2, HUD_DELAY + 1.0, {0, 255, 0}, "%L", LANG_SERVER, "JBE_IS_DAY", GetDay(14))
}
Code: Select all
public GetDay(day)
{
switch(day)
{
case 1:
{
switch(IsDay)
{
case 1: //zombie
case 2: // reverse
}
}
case 3:
case 4
case 5:
case 6:
case 7:
case 8:
case 9:
{
switch(IsDay)
{
case 9: // Nightcrawler
case 10: // Nightcrawler reverse
}
}
case 11:
{
switch(IsDay)
{
case 11: // hns
case 12: // hns reverse
}
}
case 13:
case 14:
}
}