PDA

View Full Version : TextDraws won't show


ReneG
18/07/2012, 01:22 AM
I'v never worked with textdraws, and used Zamaroht's editor to try and hide the HUD features.

They won't show.

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.
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.
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
[17:49:11] MainMenu for player has been toggled: 1

They also worked fine using the Textdraw editor.

ViniBorn
18/07/2012, 01:25 AM
Where TextDrawsInit is called?

ReneG
18/07/2012, 01:31 AM
:picard:

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

ViniBorn
18/07/2012, 01:34 AM
This happens sometimes : D


Good luck