PHP код:
#define days_of_week(%0,%1,%2) \
(7000 + (%2 + (%0 -= (14 - %1) / 12) + %0 / 4 - %0 / 100 + %0 / 400 + (31 * (%1 + 12 * (14 - %1) / 12 - 2)) / 12)) % 7
PHP код:
new Text:Clock_time[3];
new Text:Box_time[6];
PHP код:
forward CloseTime(playerid);
public CloseTime(playerid)
{
for(new CT; CT != 3; CT++) TextDrawHideForPlayer(playerid, Clock_time[CT]);
for(new BT; BT != 6; BT++) TextDrawHideForPlayer(playerid, Box_time[BT]);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
RemovePlayerAttachedObject(playerid, 0);
return 1;
}
PHP код:
Box_time[0] = TextDrawCreate(590.125000, 190.500000, "_");
TextDrawLetterSize(Box_time[0], 0.000000, 16.600000);
TextDrawTextSize(Box_time[0], 469.250000, 0.000000);
TextDrawUseBox(Box_time[0], 1);
TextDrawBoxColor(Box_time[0], 102);
Box_time[1] = TextDrawCreate(585.750000, 204.500015, "_");
TextDrawLetterSize(Box_time[1], 0.000000, 12.192594);
TextDrawTextSize(Box_time[1], 474.250000, 0.000000);
TextDrawUseBox(Box_time[1], 1);
TextDrawBoxColor(Box_time[1], 102);
Box_time[2] = TextDrawCreate(543.250000, 196.333343, "_");
TextDrawLetterSize(Box_time[2], 0.000000, -0.187038);
TextDrawTextSize(Box_time[2], 517.375000, 0.000000);
TextDrawUseBox(Box_time[2], 1);
TextDrawBoxColor(Box_time[2], 102);
Box_time[3] = TextDrawCreate(512.500000, 315.583374, "LD_BEAT:chit");
TextDrawLetterSize(Box_time[3], 0.000000, 0.000000);
TextDrawTextSize(Box_time[3], 33.125000, 26.833333);
TextDrawColor(Box_time[3], 149);
TextDrawFont(Box_time[3], 4);
Box_time[4] = TextDrawCreate(507.500000, 191.333343, "LD_BEAT:chit");
TextDrawLetterSize(Box_time[4], 0.000000, 0.000000);
TextDrawTextSize(Box_time[4], 9.375000, 8.750000);
TextDrawColor(Box_time[4], 102);
TextDrawFont(Box_time[4], 4);
Box_time[5] = TextDrawCreate(535.750000, 327.583343, "_");
TextDrawLetterSize(Box_time[5], 0.000000, 0.387041);
TextDrawTextSize(Box_time[5], 521.750000, 0.000000);
TextDrawUseBox(Box_time[5], 1);
TextDrawBoxColor(Box_time[5], 0xFFFFFF60);
Clock_time[0] = TextDrawCreate(478.750000, 266.833404, "_");
Clock_time[1] = TextDrawCreate(478.750000, 282.916748, "_");
Clock_time[2] = TextDrawCreate(478.750000, 298.500091, "_");
for(new CT; CT != 3; CT++)
{
TextDrawLetterSize(Clock_time[CT], 0.309375, 1.395833);
TextDrawSetShadow(Clock_time[CT], 0);
TextDrawFont(Clock_time[CT], 3);
TextDrawColor(Clock_time[CT], -1);
}
PHP код:
CMD:time(playerid, params[])
{
static const days_of_week_name[][] =
{
"Thursday",
"Friday",
"Saturday",
"Sunday",
"Monday",
"Tuesday",
"Wednesday"
};
static const Month_name[12][10] =
{
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
};
new Hour, Minute, Second, Day, Month, Year;
gettime(Hour, Minute, Second);
getdate(Year, Month, Day);
new string[9], str[18], fmt_str[10];
format(string, sizeof(string), "%02d:%02d:%02d", Hour, Minute, Second);
TextDrawSetString(Clock_time[0], string);
format(str, sizeof(str), "%02d %s %d", Day, Month_name[Month - 1], Year);
TextDrawSetString(Clock_time[1], str);
format(fmt_str, sizeof(fmt_str), "%s", days_of_week_name[days_of_week(Year, Month, Day)]);
TextDrawSetString(Clock_time[2], fmt_str);
for(new CT; CT != 3; CT++) TextDrawShowForPlayer(playerid, Clock_time[CT]);
for(new BT; BT != 6; BT++) TextDrawShowForPlayer(playerid, Box_time[BT]);
SetPlayerAttachedObject(playerid, 0, 18868, 6, 0.092596, 0.000000, 0.000000, 276.267120, 0.000000, 164.175506, 1.000000, 1.000000, 1.000000);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
SetTimerEx("CloseTime", 5000, false, "i", playerid);
return 1;
}