07.02.2013, 20:28
Nope, timer is fine
@e: Ok, so you want minute ingame equal to second in real world. We can't use gettime then
pawn Код:
//change
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);
//to
new result[40];
format(result, sizeof(result), "worldtime %s %02d:%02d:%02d",string, h, m, sc);
SendRconCommand(result);
format(string,sizeof(string),"%02d:%02d:%02d", h, m, sc);
TextDrawSetString(Clock, string);
pawn Код:
#include <a_samp>
forward RealHourUpdate();
new T_DAY, h, m, 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()
{
//No need for flooring, as the integer will do it itself
m++;
m %= 60;
h = (sc / 60) % 24;
if(WorldTime != h)
{
WorldTime = h;
SetWorldTime(WorldTime);
}
if(0 == h && 0 == m) ++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);
}