A Textdraw isn't showing (script 100% right)
#1

Hello,

I've been searching for this bug now days (yes, serious, days), and I can't find any script bug. Maybe it's a SA-MP bug? The positions of my textdraw are all allright. Here is some script:

pawn Code:
new Text:InfoBoxDraw[MAX_PLAYERS]; // (located at top of script)
pawn Code:
for(new i = 0; i < MAX_PLAYERS; i ++) // MAX_PLAYERS is 100 here. (located in OnGameModeInit)
{
    InfoBoxDraw[i] = TextDrawCreate(500.000000, 130.000000, "~w~bladi"); // 500 - 130
    TextDrawBackgroundColor(InfoBoxDraw[i], 255);
    TextDrawFont(InfoBoxDraw[i], 1);
    TextDrawLetterSize(InfoBoxDraw[i], 0.260000, 0.899999);
    TextDrawColor(InfoBoxDraw[i], -1);
    TextDrawSetOutline(InfoBoxDraw[i], 1);
    TextDrawSetProportional(InfoBoxDraw[i], 1);
    TextDrawUseBox(InfoBoxDraw[i], 1);
    TextDrawBoxColor(InfoBoxDraw[i], 1734837503);
    TextDrawTextSize(InfoBoxDraw[i], 636.000000, 0.000000);
}
pawn Code:
stock SetInfoBoxMessage(playerid,message[],time = -1)
{
    if(GetPVarInt(playerid,"ShowingInfoBox") == 1) KillTimer(GetPVarInt(playerid,"InfoBoxTimer"));
    TextDrawShowForPlayer(playerid,InfoBoxDraw[playerid]);
    TextDrawSetString(InfoBoxDraw[playerid],message);
    PlayerPlaySound(playerid,1083,0.0,0.0,0.0);
    if(time != -1)
    {
        SetPVarInt(playerid,"InfoBoxTimer",SetTimerEx("OnInfoBoxHide",time,0,"i",playerid));
        SetPVarInt(playerid,"ShowingInfoBox",1);
    }
    return 1;
}
The draw isn't out-screen at all? I wonder why it is no working, since everything is pretty ok. The textdraw is made with Zamaroht's Textdraw Creator.

Jochem
Reply
#2

https://sampwiki.blast.hk/wiki/Limits

Textdraws Limit

Have you passed over that limit ? In your code, you're allready creating 100

EDIT: I might have got this wrong.. The TD isn't displayed at all or the position is wrong ?
Reply
#3

It;'s not displaying at all.
Reply
#4

500.000000, 130.000000? isnt 500 off screen? try like 370.0 just for testing

wait i think its 600+

what about your textsize x? 636? maybe its that..
Reply
#5

It works with that editor, good pos.
Reply
#6

try creating it when a player connects, then destroying when they disconnect.
Reply
#7

I've already tried that
Reply
#8

Quote:
Originally Posted by Donya
View Post
try creating it when a player connects, then destroying when they disconnect.
Quote:
Originally Posted by Jochemd
View Post
I've already tried that
Did you use loop in OnPlayerConnect?
Reply
#9

OnGameModeInit (before creating any textdraw):
pawn Code:
TextDrawCreate(0.0, 0.0, " ");
Reply
#10

Quote:
Originally Posted by Miguel
View Post
OnGameModeInit (before creating any textdraw):
pawn Code:
TextDrawCreate(0.0, 0.0, " ");
Actually you don't have to do this because me myself never do this and my TD is works perfectly.
Reply
#11

Mine used to work pefectly until somehow, I managed to reproduce this random bug that wouldn't let some textdraws show. I searched a bit and I found that work around posted above. I suggest using that line, even if your textdraws are working correctly.
Reply
#12

Too bad, this didnt help.
Reply
#13

I fixed it somehow by putting the textdraw as the first creating.
Reply
#14

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
I fixed it somehow by putting the textdraw as the first creating.
I've found similar problems as yours, and the solution is to initialise the arrays.
pawn Код:
new Text:InfoBoxDraw[MAX_PLAYERS] = {Text:INVALID_TEXT_DRAW,...}; // (located at top of script)
I still don't very understand why it is required, but it really fixes it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)