Problem with meters system
#1

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.625000428.583251"");
    
TextDrawLetterSize(tDistance0.3690001.250000);
    
TextDrawAlignment(tDistance1);
    
TextDrawColor(tDistance, -13057);
    
TextDrawSetShadow(tDistance0);
    
TextDrawSetOutline(tDistance0);
    
TextDrawBackgroundColor(tDistance255);
    
TextDrawFont(tDistance1);
    
TextDrawSetProportional(tDistance1);
    
TextDrawSetShadow(tDistance0); 

What is wrong
Reply
#2

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.
Reply
#3

Timer like SetTimer() or SetTimerEx ?
Reply
#4

SetTimerEx because you're setting a timer for each player who does the thing.
Reply
#5

ok, i use SetTimerEx but how to update te textdraw string ?
Reply
#6

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)