[HELP]TextDraw
#2

First of all, when you're passing the variable into a function you don't need to specify a tag every single time, you should simply be doing:

pawn Код:
TextDrawDestroy(OwnerShip1);
The only time you should be specifying a tag like "Text:" is when you're actually initializing the variable.

As far as the issue goes, is this piece of code being run in a timer?

pawn Код:
else if(GetPlayerState(i) == 1 && PlayerToPoint(2,i,1531.0088,-1738.5283,13.5469))
            {
                    format(string,sizeof(string),"~g~For buy type~n~~w~/kiosk.");
                    TextDrawSetString(OwnerShip2,string);
                    TextDrawShowForPlayer(i,OwnerShip1);
                    TextDrawShowForPlayer(i,OwnerShip2);
                    SetTimerEx("UnistiTDKuce",6000,0,"d",i);
            }
If it is, you need to consider the fact that it will probably be called multiple times, therefore that SetTimerEx at the will be called multiple times, creating multiple, unnecessary timers.

Instead, why not consider adding a simple else to your current statement to hide the textdraws?

pawn Код:
else if(GetPlayerState(i) == 1 && PlayerToPoint(2,i,1531.0088,-1738.5283,13.5469))
{
    format(string,sizeof(string),"~g~For buy type~n~~w~/kiosk.");
    TextDrawSetString(OwnerShip2,string);
    TextDrawShowForPlayer(i,OwnerShip1);
    TextDrawShowForPlayer(i,OwnerShip2);
}
else
{
    // Hide the textdraws!
}
Then it will hide the textdraws once you go out of range of those co-ordinates, or when your player state changes from that (don't know why you didn't use the definition PLAYER_STATE_ONFOOT).

No need for another timer then!
Reply


Messages In This Thread
[HELP]TextDraw - by SoaD123 - 04.05.2012, 12:54
Re: [HELP]TextDraw - by JaTochNietDan - 04.05.2012, 17:41

Forum Jump:


Users browsing this thread: 1 Guest(s)