Adding textdraw when player connects
#1

I add this per-player textdraw to OnPlayerConnect:

Код:
    new PlayerText:TDEditor_PTD[MAX_PLAYERS][4];

	TDEditor_PTD[playerid][0] = CreatePlayerTextDraw(playerid, 319.200073, 73.520034, "Loguetown");
	PlayerTextDrawLetterSize(playerid, TDEditor_PTD[playerid][0], 0.697600, 3.237692);
	PlayerTextDrawAlignment(playerid, TDEditor_PTD[playerid][0], 2);
	PlayerTextDrawColor(playerid, TDEditor_PTD[playerid][0], -1963817217);
	PlayerTextDrawSetShadow(playerid, TDEditor_PTD[playerid][0], 1);
	PlayerTextDrawSetOutline(playerid, TDEditor_PTD[playerid][0], 1);
	PlayerTextDrawBackgroundColor(playerid, TDEditor_PTD[playerid][0], 255);
	PlayerTextDrawFont(playerid, TDEditor_PTD[playerid][0], 0);
	PlayerTextDrawSetProportional(playerid, TDEditor_PTD[playerid][0], 1);
	PlayerTextDrawSetShadow(playerid, TDEditor_PTD[playerid][0], 1);

	TDEditor_PTD[playerid][1] = CreatePlayerTextDraw(playerid, 317.600097, 107.866683, "A_Fresh_Experience");
	PlayerTextDrawLetterSize(playerid, TDEditor_PTD[playerid][1], 0.500000, 2.092803);
	PlayerTextDrawAlignment(playerid, TDEditor_PTD[playerid][1], 2);
	PlayerTextDrawColor(playerid, TDEditor_PTD[playerid][1], -1973270273);
	PlayerTextDrawSetShadow(playerid, TDEditor_PTD[playerid][1], 1);
	PlayerTextDrawSetOutline(playerid, TDEditor_PTD[playerid][1], 1);
	PlayerTextDrawBackgroundColor(playerid, TDEditor_PTD[playerid][1], 255);
	PlayerTextDrawFont(playerid, TDEditor_PTD[playerid][1], 0);
	PlayerTextDrawSetProportional(playerid, TDEditor_PTD[playerid][1], 1);
	PlayerTextDrawSetShadow(playerid, TDEditor_PTD[playerid][1], 1);

	TDEditor_PTD[playerid][2] = CreatePlayerTextDraw(playerid, 375.999969, 45.488937, "");
	PlayerTextDrawLetterSize(playerid, TDEditor_PTD[playerid][2], 0.000000, 0.000000);
	PlayerTextDrawTextSize(playerid, TDEditor_PTD[playerid][2], 118.000000, 132.000000);
	PlayerTextDrawAlignment(playerid, TDEditor_PTD[playerid][2], 1);
	PlayerTextDrawColor(playerid, TDEditor_PTD[playerid][2], -1);
	PlayerTextDrawSetShadow(playerid, TDEditor_PTD[playerid][2], 0);
	PlayerTextDrawSetOutline(playerid, TDEditor_PTD[playerid][2], 0);
	PlayerTextDrawBackgroundColor(playerid, TDEditor_PTD[playerid][2], 0);
	PlayerTextDrawFont(playerid, TDEditor_PTD[playerid][2], 5);
	PlayerTextDrawSetProportional(playerid, TDEditor_PTD[playerid][2], 0);
	PlayerTextDrawSetShadow(playerid, TDEditor_PTD[playerid][2], 0);
	PlayerTextDrawSetPreviewModel(playerid, TDEditor_PTD[playerid][2], 595);
	PlayerTextDrawSetPreviewRot(playerid, TDEditor_PTD[playerid][2], -20.000000, 0.000000, -50.000000, 0.200000);
	PlayerTextDrawSetPreviewVehCol(playerid, TDEditor_PTD[playerid][2], 1, 1);

	TDEditor_PTD[playerid][3] = CreatePlayerTextDraw(playerid, 158.999923, 62.413387, "");
	PlayerTextDrawLetterSize(playerid, TDEditor_PTD[playerid][3], 0.000000, 0.000000);
	PlayerTextDrawTextSize(playerid, TDEditor_PTD[playerid][3], 84.000000, 103.000000);
	PlayerTextDrawAlignment(playerid, TDEditor_PTD[playerid][3], 1);
	PlayerTextDrawColor(playerid, TDEditor_PTD[playerid][3], -1);
	PlayerTextDrawSetShadow(playerid, TDEditor_PTD[playerid][3], 0);
	PlayerTextDrawSetOutline(playerid, TDEditor_PTD[playerid][3], 0);
	PlayerTextDrawBackgroundColor(playerid, TDEditor_PTD[playerid][3], 0);
	PlayerTextDrawFont(playerid, TDEditor_PTD[playerid][3], 5);
	PlayerTextDrawSetProportional(playerid, TDEditor_PTD[playerid][3], 0);
	PlayerTextDrawSetShadow(playerid, TDEditor_PTD[playerid][3], 0);
	PlayerTextDrawSetPreviewModel(playerid, TDEditor_PTD[playerid][3], 484);
	PlayerTextDrawSetPreviewRot(playerid, TDEditor_PTD[playerid][3], -30.000000, 0.000000, 63.000000, 0.200000);
	PlayerTextDrawSetPreviewVehCol(playerid, TDEditor_PTD[playerid][3], 1, 1);
It doesn't really show the textdraw when I am connected and greeted with the login dialog. Am I doing something wrong or?
Reply
#2

After creating them, you gotta show them by using PlayerTextDrawShow, and no, they are just created under OnPlayerConnect, doesn't mean they will show up.
Reply
#3

Quote:
Originally Posted by Jelly23
Посмотреть сообщение
After creating them, you gotta show them by using PlayerTextDrawShow, and no, they are just created under OnPlayerConnect, doesn't mean they will show up.
Код:
    new PlayerText:TDEditor_PTD[MAX_PLAYERS][4];

	TDEditor_PTD[playerid][0] = CreatePlayerTextDraw(playerid, 319.200073, 73.520034, "Loguetown");
	PlayerTextDrawLetterSize(playerid, TDEditor_PTD[playerid][0], 0.697600, 3.237692);
	PlayerTextDrawAlignment(playerid, TDEditor_PTD[playerid][0], 2);
	PlayerTextDrawColor(playerid, TDEditor_PTD[playerid][0], -1963817217);
	PlayerTextDrawSetShadow(playerid, TDEditor_PTD[playerid][0], 1);
	PlayerTextDrawSetOutline(playerid, TDEditor_PTD[playerid][0], 1);
	PlayerTextDrawBackgroundColor(playerid, TDEditor_PTD[playerid][0], 255);
	PlayerTextDrawFont(playerid, TDEditor_PTD[playerid][0], 0);
	PlayerTextDrawSetProportional(playerid, TDEditor_PTD[playerid][0], 1);
	PlayerTextDrawSetShadow(playerid, TDEditor_PTD[playerid][0], 1);

	TDEditor_PTD[playerid][1] = CreatePlayerTextDraw(playerid, 317.600097, 107.866683, "A_Fresh_Experience");
	PlayerTextDrawLetterSize(playerid, TDEditor_PTD[playerid][1], 0.500000, 2.092803);
	PlayerTextDrawAlignment(playerid, TDEditor_PTD[playerid][1], 2);
	PlayerTextDrawColor(playerid, TDEditor_PTD[playerid][1], -1973270273);
	PlayerTextDrawSetShadow(playerid, TDEditor_PTD[playerid][1], 1);
	PlayerTextDrawSetOutline(playerid, TDEditor_PTD[playerid][1], 1);
	PlayerTextDrawBackgroundColor(playerid, TDEditor_PTD[playerid][1], 255);
	PlayerTextDrawFont(playerid, TDEditor_PTD[playerid][1], 0);
	PlayerTextDrawSetProportional(playerid, TDEditor_PTD[playerid][1], 1);
	PlayerTextDrawSetShadow(playerid, TDEditor_PTD[playerid][1], 1);

	TDEditor_PTD[playerid][2] = CreatePlayerTextDraw(playerid, 375.999969, 45.488937, "");
	PlayerTextDrawLetterSize(playerid, TDEditor_PTD[playerid][2], 0.000000, 0.000000);
	PlayerTextDrawTextSize(playerid, TDEditor_PTD[playerid][2], 118.000000, 132.000000);
	PlayerTextDrawAlignment(playerid, TDEditor_PTD[playerid][2], 1);
	PlayerTextDrawColor(playerid, TDEditor_PTD[playerid][2], -1);
	PlayerTextDrawSetShadow(playerid, TDEditor_PTD[playerid][2], 0);
	PlayerTextDrawSetOutline(playerid, TDEditor_PTD[playerid][2], 0);
	PlayerTextDrawBackgroundColor(playerid, TDEditor_PTD[playerid][2], 0);
	PlayerTextDrawFont(playerid, TDEditor_PTD[playerid][2], 5);
	PlayerTextDrawSetProportional(playerid, TDEditor_PTD[playerid][2], 0);
	PlayerTextDrawSetShadow(playerid, TDEditor_PTD[playerid][2], 0);
	PlayerTextDrawSetPreviewModel(playerid, TDEditor_PTD[playerid][2], 595);
	PlayerTextDrawSetPreviewRot(playerid, TDEditor_PTD[playerid][2], -20.000000, 0.000000, -50.000000, 0.200000);
	PlayerTextDrawSetPreviewVehCol(playerid, TDEditor_PTD[playerid][2], 1, 1);

	TDEditor_PTD[playerid][3] = CreatePlayerTextDraw(playerid, 158.999923, 62.413387, "");
	PlayerTextDrawLetterSize(playerid, TDEditor_PTD[playerid][3], 0.000000, 0.000000);
	PlayerTextDrawTextSize(playerid, TDEditor_PTD[playerid][3], 84.000000, 103.000000);
	PlayerTextDrawAlignment(playerid, TDEditor_PTD[playerid][3], 1);
	PlayerTextDrawColor(playerid, TDEditor_PTD[playerid][3], -1);
	PlayerTextDrawSetShadow(playerid, TDEditor_PTD[playerid][3], 0);
	PlayerTextDrawSetOutline(playerid, TDEditor_PTD[playerid][3], 0);
	PlayerTextDrawBackgroundColor(playerid, TDEditor_PTD[playerid][3], 0);
	PlayerTextDrawFont(playerid, TDEditor_PTD[playerid][3], 5);
	PlayerTextDrawSetProportional(playerid, TDEditor_PTD[playerid][3], 0);
	PlayerTextDrawSetShadow(playerid, TDEditor_PTD[playerid][3], 0);
	PlayerTextDrawSetPreviewModel(playerid, TDEditor_PTD[playerid][3], 484);
	PlayerTextDrawSetPreviewRot(playerid, TDEditor_PTD[playerid][3], -30.000000, 0.000000, 63.000000, 0.200000);
	PlayerTextDrawSetPreviewVehCol(playerid, TDEditor_PTD[playerid][3], 1, 1);
	
	PlayerTextDrawShow(playerid, TDEditor_PTD);
Код:
	PlayerTextDrawShow(playerid, TDEditor_PTD);
gives an "argument type mismatch (argument 2)" error when compiling.
Reply
#4

There's a typo in the textdraw editor. In the top of the gm where u declared the Textdraw, change ''Text:" to "PlayerText:".
Reply
#5

for(new I = 0; I < sizeof(TDEditor_PTD[playerid]); I++) PlayerTextDrawShow(playerid, TDEditor_PTD[playerid][I]);
Reply
#6

Quote:
Originally Posted by NeXoR
Посмотреть сообщение
for(new I = 0; I < sizeof(TDEditor_PTD[playerid]); I++) PlayerTextDrawShow(playerid, TDEditor_PTD[playerid][I]);
Not the solution, TDEditor declares player textdraws as global tds when you export them, so you get that warning if you do not change it.
Reply
#7

Quote:
Originally Posted by Jelly23
Посмотреть сообщение
There's a typo in the textdraw editor. In the top of the gm where u declared the Textdraw, change ''Text:" to "PlayerText:".
It's already declared as PlayerText, if you haven't noticed.

Код:
new PlayerText:TDEditor_PTD[MAX_PLAYERS][4];
Reply
#8

My bad, this is how you use it:

PHP код:
Example:
PlayerTextDrawShow(playeridTDEditor_PTD[0]); 
Reply
#9

Quote:
Originally Posted by Jelly23
Посмотреть сообщение
My bad, this is how you use it:

PHP код:
Example:
PlayerTextDrawShow(playeridTDEditor_PTD[0]); 
Weird, it still doesn't work. Also shows the same argument mismatch error.
Reply
#10

Quote:
Originally Posted by Sublime
Посмотреть сообщение
Weird, it still doesn't work. Also shows the same argument mismatch error.
I'm high, forgive me.

correct way:

PlayerTextDrawShow(playerid,TDEditor_PTD[playerid][0]);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)