Problem with meters system - 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)
+--- Thread: Problem with meters system (
/showthread.php?tid=585160)
Problem with meters system -
Sn4ke2 - 11.08.2015
Hello, i make a sistem to count how meters it's remaning until player reached destination, but i have a problem, the meters not count down if i'm going to checkpoint ! here is the pawno code
PHP код:
                       if(listitem == 0)
            {
                new Distance[126];Â
                new Float:fDistance = GetPlayerDistanceFromPoint(playerid,237.9 , 115.6 , 1010.2 ); // example
               Â
                format(Distance,sizeof(Distance),"Meters remaining: %0.2f ",fDistance);
                TextDrawSetString(tDistance,Distance);
                TextDrawShowForPlayer(playerid,tDistance);
               Â
            }Â
TextDraw (dosen't need...)
PHP код:
tDistance = TextDrawCreate(145.625000, 428.583251, "");
    TextDrawLetterSize(tDistance, 0.369000, 1.250000);
    TextDrawAlignment(tDistance, 1);
    TextDrawColor(tDistance, -13057);
    TextDrawSetShadow(tDistance, 0);
    TextDrawSetOutline(tDistance, 0);
    TextDrawBackgroundColor(tDistance, 255);
    TextDrawFont(tDistance, 1);
    TextDrawSetProportional(tDistance, 1);
    TextDrawSetShadow(tDistance, 0);Â
What is wrong



Re: Problem with meters system -
fordawinzz - 11.08.2015
You need to set a timer which will be repeating every X seconds (you decide how often it should repeat) and then reset the textdraw string. Your code is not wrong.
Re: Problem with meters system -
Sn4ke2 - 11.08.2015
Timer like SetTimer() or SetTimerEx ?
Re: Problem with meters system -
fordawinzz - 11.08.2015
SetTimerEx because you're setting a timer for each player who does the thing.
Re: Problem with meters system -
Sn4ke2 - 11.08.2015
ok, i use SetTimerEx but how to update te textdraw string ?
Re: Problem with meters system -
MarvinPWN - 11.08.2015
You can update the textdraw with this function:
PHP код:
TextDrawSetStringÂ
You can use the wiki page to get any information about this function how you exactly use it.