Textdraw string not changing
#1

On my Login textdraw I have a texdtraw that says "Welcome, PlayerName" I have did this but it is not working textdraw still says "Welcome," and that was his default string


Код:
public OnPlayerConnect(playerid)
{
    new string[100], nameic[MAX_PLAYER_NAME];
    GetPlayerName(playerid, nameic, MAX_PLAYER_NAME);
    format(string, sizeof(string),"Welcome, %s", nameic);
    PlayerTextDrawSetString(playerid, LoginTD[playerid][21], string);
    return 1;
}
This is that textdraw
Код:
	LoginTD[playerid][21] = CreatePlayerTextDraw(playerid, 156.550186, 382.041595, "Welcome,");
	PlayerTextDrawLetterSize(playerid, LoginTD[playerid][21], 0.126249, 0.649167);
	PlayerTextDrawAlignment(playerid, LoginTD[playerid][21], 1);
	PlayerTextDrawColor(playerid, LoginTD[playerid][21], -1);
	PlayerTextDrawUseBox(playerid, LoginTD[playerid][21], true);
	PlayerTextDrawBoxColor(playerid, LoginTD[playerid][21], 0);
	PlayerTextDrawSetShadow(playerid, LoginTD[playerid][21], 0);
	PlayerTextDrawSetOutline(playerid, LoginTD[playerid][21], 1);
	PlayerTextDrawFont(playerid, LoginTD[playerid][21], 2);
	PlayerTextDrawSetProportional(playerid, LoginTD[playerid][21], 1);
Reply
#2

Bump
Reply
#3

use at OnPlayerRequestClass
Reply
#4

like this
Quote:

public OnPlayerRequestClass(playerid, classid)
{
new string[100], nameic[MAX_PLAYER_NAME];
GetPlayerName(playerid, nameic, MAX_PLAYER_NAME);
format(string, sizeof(string),"Welcome, %s", nameic);
PlayerTextDrawSetString(playerid, LoginTD[playerid][21], string);
PlayerTextDrawShow(playerid, LoginTD[playerid][21]);
return 1;
}

Reply
#5

Just an intermediary note:
Код:
new nameic[MAX_PLAYER_NAME + 1]; //Account for null terminator
GetPlayerName(playerid, nameic, sizeof(nameic));

new string[9 + MAX_PLAYER_NAME + 1]; //Because 'Welcome, ' is 9 characters long
format(string, sizeof(string), "Welcome, %s", nameic);
Of course, if you change the string, you need to change its length as well or it will only show parts of it.
Reply
#6

Ok thanks I'll try
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)