07.02.2013, 20:07
Your code hurts my eyes
@e: removed unnecessary boolean
pawn Код:
#include <a_samp>
forward RealHourUpdate();
new T_DAY = 0, WorldTime, Text:DAN, Text:Clock;
public OnPlayerSpawn(playerid)
{
TextDrawShowForAll(DAN);
TextDrawShowForAll(Clock);
return 1;
}
public OnGameModeInit()
{
SetTimer("SetRandomWeather", 420000, true);
SetTimer("RealHourUpdate", 1000, true);
DAN = TextDrawCreate(497.000000, 5.000000, "/");
TextDrawFont(DAN, 3);
TextDrawLetterSize(DAN, 0.6, 1.5);
TextDrawSetOutline(DAN, 2);
TextDrawSetProportional(DAN, 1);
TextDrawSetShadow(DAN, 1);
Clock = TextDrawCreate(546.9, 21.0, "/");
TextDrawSetShadow(Clock, 1);
TextDrawSetOutline(Clock, 2);
TextDrawLetterSize(Clock, 0.6, 2.4);
TextDrawFont(Clock, 3);
TextDrawSetProportional(Clock, 1);
return 1;
}
public RealHourUpdate()
{
new h, m, sc;
gettime(h, m, sc);
if(WorldTime != h)
{
WorldTime = h;
SetWorldTime(WorldTime);
}
if(0 == h && 0 == m && 0 == sc) ++T_DAY;
new string[16];
switch(T_DAY) {
case 0: strcat(string, "Monday");
case 1: strcat(string, "Tuesday");
case 2: strcat(string, "Wednesday");
case 3: strcat(string, "Thursday");
case 4: strcat(string, "Friday");
case 5: strcat(string, "Saturday");
case 6: strcat(string, "Sunday");
}
TextDrawSetString(DAN, string);
new result[33];
format(result, sizeof(result), "worldtime %s %02d:%02d",string, h, m);
SendRconCommand(result);
format(string,sizeof(string),"%02d:%02d",h,m);
TextDrawSetString(Clock, string);
}