10.03.2009, 15:14
Ok, I am working on a clock for my game mode, so I made this function
I have set the UpdateClock inside one of my timer functions that is called every minute. I know this works because my second timer works and they are exactly the same other than the interval on the second is 1000 and on the minute it is 100000.
So, I know this function is called because the clock does show up. But the problem is that it doesnt update. I include the TextDrawDestroy and I Create a whole new text draw with a new format, but it always stays the same.
Any one got any ideas? If you need more areas of the code to figure it out, just ask.
pawn Код:
public UpdateClock()
{
TextDrawDestroy(ClockText);
new str[5];
new tmphour;
new tmpminute;
new tmpsecond;
gettime(tmphour, tmpminute, tmpsecond);
if(tmphour <= 12)
{
if(tmpminute < 10)
{
format(str, sizeof(str), "%d:0%d", tmphour, tmpminute);
}
if(tmpminute >= 10)
{
format(str, sizeof(str), "%d:%d", tmphour, tmpminute);
}
}
if(tmphour > 12)
{
if(tmpminute < 10)
{
format(str, sizeof(str), "%d:0%d", tmphour - 12, tmpminute);
}
if(tmpminute >= 10)
{
format(str, sizeof(str), "%d:%d", tmphour - 12, tmpminute);
}
}
ClockText = TextDrawCreate(557, 30, str);
TextDrawSetOutline(ClockText, 1);
TextDrawFont(ClockText, 2);
TextDrawColor(ClockText, 0xffffffff);
for(new i=0; i<=GetMaxPlayers(); i++)
{
TextDrawShowForPlayer(i, ClockText);
}
if(tmphour <= 12)
{
printf("ServerTime:%d:%d", tmphour, tmpminute);
}
if(tmphour > 12)
{
printf("ServerTime:%d:%d", tmphour - 12, tmpminute);
}
return 1;
}
So, I know this function is called because the clock does show up. But the problem is that it doesnt update. I include the TextDrawDestroy and I Create a whole new text draw with a new format, but it always stays the same.
Any one got any ideas? If you need more areas of the code to figure it out, just ask.