TextDraws won't show
#1

I'v never worked with textdraws, and used Zamaroht's editor to try and hide the HUD features.

They won't show.

pawn Code:
new
    Text:MainMenu[2];

forward TextDrawsInit();
public TextDrawsInit()
{
    /* Bottom Bar */
    MainMenu[0] = TextDrawCreate(250.000000, 343.000000, "~n~~n~~n~~n~~n~BottomHalf");
    TextDrawAlignment(MainMenu[0], 2);
    TextDrawBackgroundColor(MainMenu[0], 255);
    TextDrawFont(MainMenu[0], 1);
    TextDrawLetterSize(MainMenu[0], 1.000000, 2.000000);
    TextDrawColor(MainMenu[0], 255);
    TextDrawSetOutline(MainMenu[0], 1);
    TextDrawSetProportional(MainMenu[0], 1);
    TextDrawUseBox(MainMenu[0], 1);
    TextDrawBoxColor(MainMenu[0], 255);
    TextDrawTextSize(MainMenu[0], 90.000000, 803.000000);

    /* Top Bar */
    MainMenu[1] = TextDrawCreate(250.000000, -8.000000, "~n~~n~~n~~n~~n~TopHalf");
    TextDrawAlignment(MainMenu[1], 2);
    TextDrawBackgroundColor(MainMenu[1], 255);
    TextDrawFont(MainMenu[1], 1);
    TextDrawLetterSize(MainMenu[1], 1.000000, 2.000000);
    TextDrawColor(MainMenu[1], 255);
    TextDrawSetOutline(MainMenu[1], 1);
    TextDrawSetProportional(MainMenu[1], 1);
    TextDrawUseBox(MainMenu[1], 1);
    TextDrawBoxColor(MainMenu[1], 255);
    TextDrawTextSize(MainMenu[1], 90.000000, 803.000000);
   
    return 1;
}
I use this function to toggle them.
pawn Code:
stock TogglePlayerMainMenu(playerid, toggle = 0)
{
    if(toggle) {
        TextDrawShowForPlayer(playerid, MainMenu[0]);
        TextDrawShowForPlayer(playerid, MainMenu[1]);
    }
   
    else {
        TextDrawHideForPlayer(playerid, MainMenu[0]);
        TextDrawHideForPlayer(playerid, MainMenu[1]);
    }
   
    printf("MainMenu for player has been toggled: %d", toggle);
    return 1;
}
and I'm trying to show it on a 1 sec delay timer on OnPlayerConnect.
pawn Code:
public OnPlayerConnect(playerid)
{
    SetTimerEx("OnPlayerConnectEx", 1000, false, "d", playerid);
    return 1;
}

forward OnPlayerConnectEx(playerid);
public OnPlayerConnectEx(playerid)
{
    TogglePlayerMainMenu(playerid, 1);
    return 1;
}
Server console prints
Code:
[17:49:11] MainMenu for player has been toggled: 1
They also worked fine using the Textdraw editor.
Reply
#2

Where TextDrawsInit is called?
Reply
#3



Forgot to call TextDrawsInit() when the gamemode loads. Thank you Viniborn.
Reply
#4

This happens sometimes : D


Good luck
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)