How to make a 3d label have a new line?
#1

Ok, So I have made a 3d text label but can't seem to give it a new line.

I have so far

pawn Код:
format(string, sizeof(string), "Owned by: %s Rented by: %s Cost: %d", hInfo[housenumber][Name], hInfo[housenumber][Renter], hInfo[housenumber][Cost]);
    Delete3DTextLabel(HouseLabel[housenumber]);
    HouseLabel[housenumber] = Create3DTextLabel(string, 0x008080FF, iconA,iconB,iconC, 10.0, 0, 1);
I have tryed this code but it doesn't give me a new line.

pawn Код:
format(string, sizeof(string), "Owned by: %s\n Rented by: %s \n Cost: %d", hInfo[housenumber][Name], hInfo[housenumber][Renter], hInfo[housenumber][Cost]);
    Delete3DTextLabel(HouseLabel[housenumber]);
    HouseLabel[housenumber] = Create3DTextLabel(string, 0x008080FF, iconA,iconB,iconC, 10.0, 0, 1);
I am wanting it so that it basicly say's this.

Owned by: name
Rented by: name
Cost: Cost


instead of doing it all on one line like this

Owned by: name Rented by: name Cost: cost

any one can help?
Reply
#2

pawn Код:
format(string, sizeof(string), "Owned by: %s Rented by: %s Cost: %d", hInfo[housenumber][Name], hInfo[housenumber][Renter], hInfo[housenumber][Cost]);
    Delete3DTextLabel(HouseLabel[housenumber]);
    HouseLabel[housenumber] = Create3DTextLabel(string, 0x008080FF, iconA,iconB,iconC, 10.0, 0, 1);
Try

pawn Код:
format(string, sizeof(string), "Owned by: %s", hInfo[housenumber][Name]);
format(string, sizeof(string), "Rented by: %s", hInfo[housenumber][Renter]);
format(string, sizeof(string), "Cost: %d", hInfo[housenumber][Cost]);
Delete3DTextLabel(HouseLabel[housenumber]);
HouseLabel[housenumber] = Create3DTextLabel(string, 0x008080FF, iconA,iconB,iconC, 10.0, 0, 1);
Reply
#3

Quote:
Originally Posted by ConnorHunter
Посмотреть сообщение
pawn Код:
format(string, sizeof(string), "Owned by: %s Rented by: %s Cost: %d", hInfo[housenumber][Name], hInfo[housenumber][Renter], hInfo[housenumber][Cost]);
    Delete3DTextLabel(HouseLabel[housenumber]);
    HouseLabel[housenumber] = Create3DTextLabel(string, 0x008080FF, iconA,iconB,iconC, 10.0, 0, 1);
Try

pawn Код:
format(string, sizeof(string), "Owned by: %s", hInfo[housenumber][Name]);
format(string, sizeof(string), "Rented by: %s", hInfo[housenumber][Renter]);
format(string, sizeof(string), "Cost: %d", hInfo[housenumber][Cost]);
Delete3DTextLabel(HouseLabel[housenumber]);
HouseLabel[housenumber] = Create3DTextLabel(string, 0x008080FF, iconA,iconB,iconC, 10.0, 0, 1);
Thank's for the reply, Got it working with the \n way, weren't working at first tho lol.
Reply
#4

The above code is totally wrong.
The string will only contain "Cost: 500" (or similar) at the end because format will overwrite the content of string everytime you use it.

Use \n simply.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)