3D Text Label formatting problem [+rep] -
Swarn - 09.05.2016
Hello, i'm having a problem with detecting characters for my deathreasons, when a player dies it only displays "(( This player has been" but it should display the full text inside of the two brackets here is my code,
Код:
format(maticalreason,sizeof(maticalreason),"(( This player has been injured, /damages %i for more information))", playerid);
DeathReason[playerid] = Create3DTextLabel(maticalreason, COLOR_LIGHTRED, 30.0, 40.0, 50.0, 15.0, 0, 1);
Attach3DTextLabelToPlayer(DeathReason[playerid], playerid, 0.0, 0.0, 0.5);
i have defined the Max Length of one line of text to 100.
#define MAXLEN 100
I'm really stumped on whats causing this problem.
Re: 3D Text Label formatting problem [+rep] -
Dayrion - 09.05.2016
Quote:
Originally Posted by Swarn
Hello, i'm having a problem with detecting characters for my deathreasons, when a player dies it only displays "(( This player has been" but it should display the full text inside of the two brackets here is my code,
Код:
format(maticalreason,sizeof(maticalreason),"(( This player has been injured, /damages %i for more information))", playerid);
DeathReason[playerid] = Create3DTextLabel(maticalreason, COLOR_LIGHTRED, 30.0, 40.0, 50.0, 15.0, 0, 1);
Attach3DTextLabelToPlayer(DeathReason[playerid], playerid, 0.0, 0.0, 0.5);
i have defined the Max Length of one line of text to 100.
#define MAXLEN 100
I'm really stumped on whats causing this problem.
|
Show the size of "maticalreason" and why do you have defined the max lenght of one line? I don't get it. Can you give me more explication?
Re: 3D Text Label formatting problem [+rep] -
Matical - 09.05.2016
new maticalreason[MAX_PLAYER_NAME];
Im guessing i should change to new maticalreason[256];
and i defined maxlen to cut a message if it reaches 100 characters to cut the line and start a new one.
Re: 3D Text Label formatting problem [+rep] -
DTV - 10.05.2016
You only need to change it to new maticalreasion[128];, no need to have it be 256.
Re: 3D Text Label formatting problem [+rep] -
Dayrion - 10.05.2016
Quote:
Originally Posted by DTV
You only need to change it to new maticalreasion[128];, no need to have it be 256.
|
False. If he wants to add some colors, he might need more than 128.
And yes, you need at least 128. MAX_PLAYER_NAME is 24 characters (the length of a name on SA: MP).
Re: 3D Text Label formatting problem [+rep] -
MBilal - 10.05.2016
Quote:
Originally Posted by Swarn
Hello, i'm having a problem with detecting characters for my deathreasons, when a player dies it only displays "(( This player has been" but it should display the full text inside of the two brackets here is my code,
Код:
format(maticalreason,sizeof(maticalreason),"(( This player has been injured, /damages %i for more information))", playerid);
DeathReason[playerid] = Create3DTextLabel(maticalreason, COLOR_LIGHTRED, 30.0, 40.0, 50.0, 15.0, 0, 1);
Attach3DTextLabelToPlayer(DeathReason[playerid], playerid, 0.0, 0.0, 0.5);
i have defined the Max Length of one line of text to 100.
#define MAXLEN 100
I'm really stumped on whats causing this problem.
|
First this can only display player id like this
This player has been injured, /damages "playerid in game his id" for more information
this is correct : maticalreason[128];
this is not needed : maticalreason[MAX_PLAYERS_NAME];
This code only edit that string and attach that create3dtext with that playerid who got damage.
Код:
new maticalreason[128];
format(maticalreason,sizeof(maticalreason),"(( This player has been injured,\n/damages %i for more information))", playerid);
DeathReason[playerid] = Create3DTextLabel(maticalreason, COLOR_LIGHTRED, 30.0, 40.0, 50.0, 15.0, 0, 1);
Attach3DTextLabelToPlayer(DeathReason[playerid], playerid, 0.0, 0.0, 0.5);
I hope it help u.
Re: 3D Text Label formatting problem [+rep] -
Matical - 10.05.2016
Yeah it helped, i was thinking it should of been somewhere in that range, Thank you for your reply