Textdraw
#1

Hey.. I want to make a textdraw when player reach a point..
like if he stand in front of a shop so textdraw will show up..
and if he move from that point the textdraw will hide...

I know I should do that with SetTimerEx.. but I already tried but I think I was doing something wrong..

someone can show me how to do it right?

Thanks..
Reply
#2

pawn Код:
new InPoint[MAX_PLAYERS];

if(IsPlayerInRangeOfPoint(playerid, 6, PosX, PosY, PosZ) && InPoint[playerid] != 1)
{
    ShowTextDrawStock(playerid);
    InPoint[playerid] = 1;
    return 1;
}
if(InPoint[playerid] == 1)
{
    InPoint[playerid] = 0;
    HideTextDrawStock(playerid);
}

stock ShowTextDrawStock(playerid)
{
    TextDrawShowForPlayer(playerid, textdrawidhere);
}

stock HideTextDrawStock(playerid)
{
    TextDrawHideForPlayer(playerid, textdrawidhere);
}
Something like this is what I'd do, although I do not know the most efficient ways.

Then I'd place the if statements inside a player timer that is close to 1 second, or just OnPlayerUpdate.

Hope I helped.

PS: The InPoint variable is there to prevent the stock from being used every second, seeing as it would be very inefficient to call a stock every second or few times a second with 10+ players online.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)