Posts: 734
Threads: 8
Joined: Jun 2009
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.
Posts: 184
Threads: 41
Joined: May 2015
Reputation:
0
Well, can you give me a example of strcpy into TD so that i can understand more better?
Thank you
Posts: 734
Threads: 8
Joined: Jun 2009
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.
Posts: 734
Threads: 8
Joined: Jun 2009
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
Posts: 184
Threads: 41
Joined: May 2015
Reputation:
0
Got that can can i add, GetPlayerSkin in Preview model so that it displays player skin?
Posts: 734
Threads: 8
Joined: Jun 2009
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.
Posts: 734
Threads: 8
Joined: Jun 2009
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);