3D Text Label formatting problem [+rep]
#1

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

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?
Reply
#3

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

You only need to change it to new maticalreasion[128];, no need to have it be 256.
Reply
#5

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).
Reply
#6

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

Yeah it helped, i was thinking it should of been somewhere in that range, Thank you for your reply
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)