04.01.2011, 04:13
Ok so this code is simple as we all know thanks to the function
But im not sure how i should do it to make it more efficient.
This is what i have so far,Can someone with experience tell me if the way im doing it is correct and will it work and if possible show me how to make it more efficient and faster please.
What i want exactly is the clock to change like In-Game every min is 1 in-game hour and announce the time in main chat and change it using SetWorldTime.
Heres my code:
Thanks in advanced!
Код:
SetWorldTime
This is what i have so far,Can someone with experience tell me if the way im doing it is correct and will it work and if possible show me how to make it more efficient and faster please.
What i want exactly is the clock to change like In-Game every min is 1 in-game hour and announce the time in main chat and change it using SetWorldTime.
Heres my code:
pawn Код:
//Clock Test
#include <a_samp>
new GameHour;
forward timechange();
public OnGameModeInit()
{
SetWorldTime(12);
GameHour = 12;
SetTimer("timechange",60000,true);
}
public timechange()
{
if(GameHour == 1)
{
SendClientMessageToAll(0x0,"[Time]: 1.00 am");
}
else if(GameHour == 2)
{
SendClientMessageToAll(0x0,"[Time]: 2.00 am");
}
else if(GameHour == 3)
{
SendClientMessageToAll(0x0,"[Time]: 3.00 am");
}
else if(GameHour == 4)
{
SendClientMessageToAll(0x0,"[Time]: 4.00 am");
}
else if(GameHour == 5)
{
SendClientMessageToAll(0x0,"[Time]: 5.00 am");
}
else if(GameHour == 6)
{
SendClientMessageToAll(0x0,"[Time]: 6.00 am");
}
else if(GameHour == 7)
{
SendClientMessageToAll(0x0,"[Time]: 7.00 am");
}
else if(GameHour == 8)
{
SendClientMessageToAll(0x0,"[Time]: 8.00 am");
}
else if(GameHour == 9)
{
SendClientMessageToAll(0x0,"[Time]: 9.00 am");
}
else if(GameHour == 10)
{
SendClientMessageToAll(0x0,"[Time]: 10.00 am");
}
else if(GameHour == 11)
{
SendClientMessageToAll(0x0,"[Time]: 11.00 am");
}
else if(GameHour == 12)
{
SendClientMessageToAll(0x0,"[Time]: 12.00 pm");
}
else if(GameHour == 13)
{
SendClientMessageToAll(0x0,"[Time]: 1.00 pm");
}
else if(GameHour == 14)
{
SendClientMessageToAll(0x0,"[Time]: 2.00 pm");
}
else if(GameHour == 15)
{
SendClientMessageToAll(0x0,"[Time]: 3.00 pm");
}
else if(GameHour == 16)
{
SendClientMessageToAll(0x0,"[Time]: 4.00 pm");
}
else if(GameHour == 17)
{
SendClientMessageToAll(0x0,"[Time]: 5.00 pm");
}
else if(GameHour == 18)
{
SendClientMessageToAll(0x0,"[Time]: 6.00 pm");
}
else if(GameHour == 19)
{
SendClientMessageToAll(0x0,"[Time]: 7.00 pm");
}
else if(GameHour == 20)
{
SendClientMessageToAll(0x0,"[Time]: 8.00 pm");
}
else if(GameHour == 21)
{
SendClientMessageToAll(0x0,"[Time]: 9.00 pm");
}
else if(GameHour == 22)
{
SendClientMessageToAll(0x0,"[Time]: 10.00 pm");
}
else if(GameHour == 23)
{
SendClientMessageToAll(0x0,"[Time]: 11.00 pm");
}
else if(GameHour == 24)
{
SendClientMessageToAll(0x0,"[Time]: 12.00 am");
}
}
//While the server is running and its cycling the time will people join at w/e time its upto or will it set it to 12?