Doubt Texdraws. - 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: Doubt Texdraws. (
/showthread.php?tid=659201)
Doubt Texdraws. -
Jose_grana - 27.09.2018
My question is when to use CreateTextDraws and CreatePlayerTextDraw and why.
Thank you.
Re: Doubt Texdraws. -
Mazio - 27.09.2018
CreatePlayerTextDraw
It creates a textdraw for a player.
PHP код:
// This variable is used to store the id of the textdraw
// so that we can use it throught the script
new PlayerText:welcomeText[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
// First, create the textdraw
welcomeText[playerid] = CreatePlayerTextDraw(playerid, 320.0, 240.0, "Welcome to my SA-MP server");
// Now show it
PlayerTextDrawShow(playerid, welcomeText[playerid]);
}
CreateTextDraws:
It creates a TextDraw (Globally)
For eg:
PHP код:
// This variable is used to store the id of the textdraw
// so that we can use it throught the script
new Text:welcomeText;
public OnGameModeInit()
{
// This line is used to create the textdraw.
// Note: This creates a textdraw without any formatting.
welcomeText = TextDrawCreate(240.0,580.0,"Welcome to my SA-MP server");
return 1;
}
public OnPlayerConnect(playerid)
{
//This is used to show the player the textdraw when they connect.
TextDrawShowForPlayer(playerid,welcomeText);
}
Now you will ask, what do you mean by this line?
It creates a TextDraw (Globally)
By this line, I mean Global Textdraws.
Global Textdraws
Global textdraws can be created, then shown to all players. There is a limit as to how many can be created, though. This means if you have a server with 500 players, creating more than 4 textdraws per-player is not possible. That's where player-textdraws come in.
I hope that I was able to give you a rough idea about this.
Sources:
https://sampwiki.blast.hk/wiki/CreatePlayerTextDraw
https://sampwiki.blast.hk/wiki/TextDrawCreate
https://sampwiki.blast.hk/wiki/TextDraws
Have a nice day!
Re: Doubt Texdraws. -
Jose_grana - 27.09.2018
If I create a record with TextDrawCreate I have to show them all or I can show it to a single player??.
Re: Doubt Texdraws. -
Mazio - 27.09.2018
Quote:
Originally Posted by Jose_grana
If I create a record with TextDrawCreate I have to show them all or I can show it to a single player??.
|
TextDrawCreate is for everyone who will enter the server, I repeat this example
if you have a server with 500 players, creating more than 4 textdraws per-player is not possible.
That's where TextDrawCreate come in.