Textdraw Isn't Showing
#1

Right, I've spent days at this, ******d and looked at over 20 threads about similar matters on the forums and all of them do not have any solution to it.

So here I am.


I have created 4 textdraws in the bottom right corner, they all have the correct dimensions and all fit within the screen (I know this because it used to appear). They display as

Speed: (Speed)
Fuel: (Fuel)

Example below of when it DID WORK



Then suddenly... The Speed just vanished one day and no matter what I try to do, it will NOT re-appear. Any suggestions?


Code:

Top of script
pawn Код:
new PlayerText:SpeedText[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW,...},
    PlayerText:FuelText[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW,...};
Under 'OnPlayerConnect'

pawn Код:
SpeedText[playerid] = CreatePlayerTextDraw(playerid, 380.000000, 432.000000, "~r~Speed:");

    PlayerTextDrawBackgroundColor(playerid, SpeedText[playerid], 255);
    PlayerTextDrawFont(playerid, SpeedText[playerid], 1);
    PlayerTextDrawLetterSize(playerid, SpeedText[playerid], 0.509999, 1.200000);
    PlayerTextDrawColor(playerid, SpeedText[playerid], 559817215);
    PlayerTextDrawSetOutline(playerid, SpeedText[playerid], 1);
    PlayerTextDrawSetProportional(playerid, SpeedText[playerid], 1);
    PlayerTextDrawHide(playerid, SpeedText[playerid]);

    FuelText[playerid] = CreatePlayerTextDraw(playerid, 550.000000, 432.000000, "~b~Fuel:");

    PlayerTextDrawBackgroundColor(playerid, FuelText[playerid], 255);
    PlayerTextDrawFont(playerid, FuelText[playerid], 1);
    PlayerTextDrawLetterSize(playerid, FuelText[playerid], 0.539999, 1.200000);
    PlayerTextDrawColor(playerid, FuelText[playerid], -353718529);
    PlayerTextDrawSetOutline(playerid, FuelText[playerid], 1);
    PlayerTextDrawSetProportional(playerid, FuelText[playerid], 1);
    PlayerTextDrawHide(playerid, FuelText[playerid]);

Under OnPlayerStateChange

pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
    {

        PlayerTextDrawShow(playerid, SpeedText[playerid]);
        PlayerTextDrawShow(playerid, FuelText[playerid]);
        }

Any help would be good, as you can see EVERY other textdraw appears as normal for everyone in the server, except for Speed: which randomly vanished.
I also tried removing other textdraws in case it was to do with the amount on screen however, the only ones displayed are these ones and an in-game clock.

Many thanks.
Reply
#2

Can you verify that all color- and keycodes in all textdraws are correct? A misplaced tilde is often the cause of such bugs.
Reply
#3

Quote:
Originally Posted by Vince
Посмотреть сообщение
Can you verify that all color- and keycodes in all textdraws are correct? A misplaced tilde is often the cause of such bugs.
Ah Vince, I always feel like there is hope when I get a response from yourself. However on topic, I did try and change the colors as well as mimic the same colors as the Fuel text draw and nothing changed. It's still not appearing. Any further suggestions?
Reply
#4

Perhaps a variable somewhere else in the code is modifying or deleting the Speed textdraw. Are you 100% sure their are no other PlayerText's with the same textdraw ID?

If this sounds like the problem you could use a loop to print all the player textdraw id's the user has. A real bruteforce way to find your bug.

Are you cleaning up after yourself in OnPlayerDisconnect ?
Reply
#5

Hi, Chris,

I have CTRL + F the script and searched for 'SpeedText[playerid]' just to make sure they are all being used in the correct places in which they are!
Yes I have destroyed the textdraw upon a player disconnecting but still no fix.

Your suggestion to do a loop to view active textdraws is an absolutely fantastic idea, I'll run a loop through a command so once I've spawned in and entered a vehicle I can see exactly what is showing and what isn't. I'll update you on this comment once I've received the results.



UPDATE
So I ran a loop and it wasn't creating the speed textdraw AT ALL, so I decided to move ALL of my textdraw creations to the OnPlayerConnect callback right at the top, even if it wasn't to be displayed, I just created it there and then hid it. And somehow that got it working. Very strange.. but it's working now!
Thanks to everyone to helped and anyone else having this problem in the future, I placed my solution here to offer some sort of help seeing as many don't do that when they find a solution!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)