TextDraw Help
#4

Quote:
Originally Posted by ALiScripter
Посмотреть сообщение
I wonder how people still use global textdraws with global variables for players when you need to use player text draws that does the job and are made for it.

Player textdraw code (taken from my gamemode):
How i create textdraws, using player textdraws
PHP код:
// top of the script
new PlayerText:PlayerTD;
// creating it on OPConnect
PlayerTD CreatePlayerTextDraw(playeridXXX.000000XXX.000000" ");
PlayerTextDrawBackgroundColor(playeridPlayerTDXXX);
PlayerTextDrawFont(playeridPlayerTDX);
PlayerTextDrawColor(playeridPlayerTDXX);
PlayerTextDrawSetOutline(playeridPlayerTDXX);
PlayerTextDrawSetShadow(playeridPlayerTDX);
PlayerTextDrawLetterSize(playeridPlayerTDXXXXXX);
PlayerTextDrawSetSelectable(playeridPlayerTDXX);
// destroying it on OPDisconnect
PlayerTextDrawDestroy(playeridPlayerTD);
// how to display it
PlayerTextDrawSetString(playeridPlayerTD"~r~ XXXXX");
PlayerTextDrawShow(playeridPlayerTD); 
This is wrong... Player who use global textdraws for players, use this method which causes bugs and isn't recommended.
PHP код:
new PlayerText:Zones[MAX_PLAYERS]; /* or */ new Text:Zones[MAX_PLAYERS]; // wrong method
Zones[playerid] = CreatePlayerTextDraw(playerid,6.5425.4"_"); 
it should be like
PHP код:
new PlayerText:Zones//right method
Zones CreatePlayerTextDraw(playerid,6.5425.4"_"); 
Your code is wrong... if you want to edit your player textdraws when there are more than 1 player online, how do you expect to do that if the textdraw ID gets overwritten every time a new player connects?

Correction:
pawn Код:
// top of the script
new PlayerText:PlayerTD[MAX_PLAYERS];

// creating it on OPConnect
PlayerTD[playerid] = CreatePlayerTextDraw(playerid, XXX.000000, XXX.000000, " ");
PlayerTextDrawBackgroundColor(playerid, PlayerTD[playerid], XXX);
PlayerTextDrawFont(playerid, PlayerTD[playerid], X);
PlayerTextDrawColor(playerid, PlayerTD[playerid], XX);
PlayerTextDrawSetOutline(playerid, PlayerTD[playerid], XX);
PlayerTextDrawSetShadow(playerid, PlayerTD[playerid], X);
PlayerTextDrawLetterSize(playerid, PlayerTD[playerid], XXX, XXX);
PlayerTextDrawSetSelectable(playerid, PlayerTD[playerid], XX);

// destroying it on OPDisconnect
PlayerTextDrawDestroy(playerid, PlayerTD[playerid]);

// how to display it
PlayerTextDrawSetString(playerid, PlayerTD[playerid], "~r~ XXXXX");
PlayerTextDrawShow(playerid, PlayerTD[playerid]);
Reply


Messages In This Thread
TextDraw Help - by Tass007 - 20.07.2016, 04:15
Re: TextDraw Help - by Shaktimaan - 20.07.2016, 05:46
Re: TextDraw Help - by Logic_ - 20.07.2016, 06:01
Re: TextDraw Help - by Threshold - 20.07.2016, 07:07
Re: TextDraw Help - by Tass007 - 20.07.2016, 07:08
Re: TextDraw Help - by Threshold - 20.07.2016, 07:27
Re: TextDraw Help - by SSRenz - 20.07.2016, 07:35
Re: TextDraw Help - by Tass007 - 20.07.2016, 07:41
Re: TextDraw Help - by Shaktimaan - 20.07.2016, 08:42
Re: TextDraw Help - by Threshold - 20.07.2016, 08:58

Forum Jump:


Users browsing this thread: 2 Guest(s)