SA-MP Forums Archive
How to make a 3d label have a new line? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to make a 3d label have a new line? (/showthread.php?tid=452522)



How to make a 3d label have a new line? - jueix - 21.07.2013

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?


Re: How to make a 3d label have a new line? - ConnorHunter - 21.07.2013

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);



Re: How to make a 3d label have a new line? - jueix - 21.07.2013

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.


AW: How to make a 3d label have a new line? - NaS - 21.07.2013

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.