07.02.2013, 17:37
clock is going so fast like this > 2:00 and then 2:20 > 2:40 > 3:00 > 3:20 > 3:40 >4:00 like this
here is script.
here is script.
PHP код:
#include <a_samp>
forward RealHourUpdate();
new T_MIN=0, T_HOUR=23, T_DAY=0;
new WorldTime;
new Text:DAN;
new 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(T_HOUR);
}
T_MIN++;
if(T_MIN == 60)
{
T_MIN=0;
T_HOUR++;
}
if(T_HOUR == 24)
{
T_HOUR=0;
T_DAY++;
}
if(T_DAY == 7)
{
T_DAY=0;
}
if(T_DAY == 0)
{
TextDrawSetString(DAN,"Monday");
new string[]="Monday";
new result[156];
format(result, sizeof(result), "worldtime %s %02d:%02d",string, T_HOUR, T_MIN);
SendRconCommand(result);
}
if(T_DAY == 1)
{
TextDrawSetString(DAN,"Tuesday");
new string[]="Tuesday";
new result[156];
format(result, sizeof(result), "worldtime %s %02d:%02d",string, T_HOUR, T_MIN);
SendRconCommand(result);
}
if(T_DAY == 2)
{
TextDrawSetString(DAN,"Wednesday");
new string[]="Wednesday";
new result[156];
format(result, sizeof(result), "worldtime %s %02d:%02d",string, T_HOUR, T_MIN);
SendRconCommand(result);
}
if(T_DAY == 3)
{
TextDrawSetString(DAN,"Thursday");
new string[]="Thursday";
new result[156];
format(result, sizeof(result), "worldtime %s %02d:%02d",string, T_HOUR, T_MIN);
SendRconCommand(result);
}
if(T_DAY == 4)
{
TextDrawSetString(DAN,"Friday");
new string[]="Friday";
new result[156];
format(result, sizeof(result), "worldtime %s %02d:%02d",string, T_HOUR, T_MIN);
SendRconCommand(result);
}
if(T_DAY == 5)
{
TextDrawSetString(DAN,"Saturday");
new string[]="Saturday";
new result[156];
format(result, sizeof(result), "worldtime %s %02d:%02d",string, T_HOUR, T_MIN);
SendRconCommand(result);
}
if(T_DAY == 6)
{
TextDrawSetString(DAN,"Sunday");
new string[]="Sunday";
new result[156];
format(result, sizeof(result), "worldtime %s %02d:%02d",string, T_HOUR, T_MIN);
SendRconCommand(result);
}
new string[256];
if(T_MIN < 10)
{
if(T_HOUR < 10)
{
format(string,sizeof(string),"0%d:0%d",T_HOUR,T_MIN);
TextDrawSetString(Clock,string);
}
else
{
format(string,sizeof(string),"%d:0%d",T_HOUR,T_MIN);
TextDrawSetString(Clock,string);
}
}
else
{
if(T_HOUR < 10)
{
format(string,sizeof(string),"0%d:%d",T_HOUR,T_MIN);
TextDrawSetString(Clock,string);
}
else
{
format(string,sizeof(string),"%d:%d",T_HOUR,T_MIN);
TextDrawSetString(Clock,string);
}
}
/*new str[256];
format(str, 256, "worldtime %02d:%02d", T_HOUR, T_MIN);
SendRconCommand(str);*/
for(new g=0;g<200;g++)
{
}
}