TextDraw help please.
#1

Hi all i want to ask something.
i am using IPLEOMAX's TextDraw editor, i want to know that how can i add a PLAYER Textdraw Box at side of main TD which will show player his current skin image. i am using it as a ID card.

and also how can i make it that when player types cmd /id then he get these text draws?
Thanks

EDIT: also tell me that i can setplayer's info using PlayerInfo[playerid]]pInfo]...
for eg: in Name: it should be shown
PHP код:
Name George 
EDIT 2: in short something like this: [see attachments]
this i what i was looking for. i saw this in one of server please please tell me how to do like this?
Reply
#2

For the first question, you have to use a newer updated version of a textdraw editor which supports model previews. Search to find it.

Second, when the player types the /id command show him the textdraws using TextDrawShowForPlayer.

Third, the best way to "copy" strings is to use a hand-written function called strcpy.
Just define it and use it as: new name[MAX_PLAYER_NAME]; strcpy(name, "George");
Don't use format (or strmid) for copying strings! It's slower. Use it for it's intended purpose - formatting a string.
Reply
#3

Well, can you give me a example of strcpy into TD so that i can understand more better?
Thank you
Reply
#4

Right, so, create your textdraw, lets name it "gTextDraw".
Код:
// Somewhere not in a function or callback
new TextDraw:gTextdraw;

// Under OnGameModeInit or in a command or somewhere else
TextDrawCreate(gTextdraw, ...);

// Preferably in your command
// This is rather done directly when the player "logs in", if such system exists
GetPlayerName(playerid, PlayerInfo[playerid][pName], MAX_PLAYER_NAME); // note: pName in enum must be MAX_PLAYER_NAME sized

// By creating another variable and getting the players name:
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);

// Copying strings, but that's for another purpose
new name[MAX_PLAYER_NAME];
strcpy(name, "George's Account"); // not the best example, but better than "format"

// Setting the textdraw string:
TextDrawSetString(gTextdraw, PlayerInfo[playerid][pName]);

// or
TextDrawSetString(gTextdraw, name);

// be sure to show your textdraw to the player to update it
TextDrawShowForPlayer(playerid, gTextdraw);
The Wiki is a great place to start if you're new to coding.
Reply
#5

Quote:

new name[MAX_PLAYER_NAME];
strcpy(name, "George's Account"); // not the best example, but better than "format"

So, output of this will be like:
PHP код:
George's Account George_McReary 
in TD?

EDIT: most important how can i Set Preview model to his Current skin?

i am using THIS TD editor.. is it ok now?

Can you also tell me other TD editor if this is not good!!
Reply
#6

Quote:
Originally Posted by GeorgeMcReary
Посмотреть сообщение
So, output of this will be like:
PHP код:
George's Account George_McReary 
in TD?

EDIT: most important how can i SetPreview model to his Current skin?

i am using THIS TD editor.. is it ok now?
Not quite, like I said, it's just for copying strings, but way better than using format.
The "name" string would hold "George's Account". If you need to concatenate (add to) the player's name use string-concatenate, strcat. But like I said, why not just use GetPlayerName and directly save to a variable?

As for your other part of the question, I'm not really familiar with that TextDraw editor but it is way simpler to use it, I think. Just read through the topic and get familiar with using it. It should be pretty straightforward.
Select "model preview" somewhere and add a skin id to preview it (you need to know the skin id's).
Then export your textdraws to PAWN code and start editing
Reply
#7

Got that can can i add, GetPlayerSkin in Preview model so that it displays player skin?
Reply
#8

I don't understand your last post. Yes, you use the same skin id's for the TextDrawSetPreviewModel function as you do for SetPlayerSkin. To view a list of skins, use the Wiki. Or use this list which I prefer to use, however it might not contain the newly added SA-MP skins.
Reply
#9

Quote:
Originally Posted by Virtual1ty
Посмотреть сообщение
I don't understand your last post. Yes, you use the same skin id's for the TextDrawSetPreviewModel function as you do for SetPlayerSkin. To view a list of skins, use the Wiki. Or use this list which I prefer to use, however it might not contain the newly added SA-MP skins.
sorry for that, i mean by that can i use it as:
PHP код:
new skin GetPlayerSkin(playerid);
    
Test CreatePlayerTextDraw(playerid320.0240.0"_");
    
PlayerTextDrawFont(playeridtextdrawTEXT_DRAW_FONT_MODEL_PREVIEW);
    
PlayerTextDrawUseBox(playeridtextdraw1);
    
PlayerTextDrawBoxColor(playeridtextdraw0x000000FF);
    
PlayerTextDrawTextSize(playeridtextdraw40.040.0);
    
PlayerTextDrawSetPreviewModel(playeridtextdrawskin); 
Reply
#10

Hm, yes you could. But if you're already saving stuff (information) about your players to variables,
why not just use: PlayerTextDrawSetPreviewModel(playerid, textdraw, PlayerInfo[playerid][pSkin]);
Where "textdraw" holds the textdraw id you create and "PlayerInfo[playerid][pSkin]" is a per-player variable holding the player skin which you first set somewhere (like, when you login): PlayerInfo[playerid][pSkin] = GetPlayerSkin(playerid);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)