SA-MP Forums Archive
Problem with Text draws - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with Text draws (/showthread.php?tid=68451)



Problem with Text draws - Kinetic - 10.03.2009

Ok, I am working on a clock for my game mode, so I made this function

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;
}
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.


Re: Problem with Text draws - saiberfun - 10.03.2009

since i got my problems with it too...
n ppl sumtimes help n then not....
i kno that u should use TextdrawSetString to update it...


Re: Problem with Text draws - Kinetic - 10.03.2009

I will try that and update you if it works.

Update: TextDrawSetString works. Thanks your awesome.

I also just realized my minute timer was set to go off every hour :P


Re: Problem with Text draws - saiberfun - 10.03.2009

no problem
watch my thread n please try to help k?


Re: Problem with Text draws - Kinetic - 10.03.2009

Where is your thread?

Update: im such a noob, I just realized I called my Minute timer "MintueTimer" instead of "MinuteTimer"


Re: Problem with Text draws - saiberfun - 10.03.2009

http://forum.sa-mp.com/index.php?topic=92529.0 my thread
n btw u got msn if ye pm me it or post it here^_^