Doubt Texdraws.
#1

My question is when to use CreateTextDraws and CreatePlayerTextDraw and why.

Thank you.
Reply
#2

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(playerid320.0240.0"Welcome to my SA-MP server");
 
    
// Now show it
    
PlayerTextDrawShow(playeridwelcomeText[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!
Reply
#3

If I create a record with TextDrawCreate I have to show them all or I can show it to a single player??.
Reply
#4

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)