SA-MP Forums Archive
Adding textdraw when player connects - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Adding textdraw when player connects (/showthread.php?tid=620787)



Adding textdraw when player connects - Sublime - 03.11.2016

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?


Re: Adding textdraw when player connects - Jelly23 - 03.11.2016

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.


Re: Adding textdraw when player connects - Sublime - 03.11.2016

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.


Re: Adding textdraw when player connects - Jelly23 - 03.11.2016

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


Re: Adding textdraw when player connects - NeXoR - 03.11.2016

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


Re: Adding textdraw when player connects - Jelly23 - 03.11.2016

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.


Re: Adding textdraw when player connects - Sublime - 03.11.2016

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];



Re: Adding textdraw when player connects - Jelly23 - 03.11.2016

My bad, this is how you use it:

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



Re: Adding textdraw when player connects - Sublime - 03.11.2016

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.


Re: Adding textdraw when player connects - Jelly23 - 03.11.2016

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]);