19.06.2012, 18:17
Create a TextDraw box. This is about as accurate as I could get it.
If x1/2 or y1/2 is negative, the values will be relative to the bottom-right corner. For example, this will create a box in the middle of the screen:
If x1/2 or y1/2 is negative, the values will be relative to the bottom-right corner. For example, this will create a box in the middle of the screen:
pawn Код:
new Text:td = TextDrawCreateBox(0x00000099, 100.0, 100.0, -100.0, -100.0);
TextDrawShowForAll(td);
pawn Код:
stock Text:TextDrawCreateBox(color, Float:x1, Float:y1, Float:x2, Float:y2) {
new Text:td, Float:height;
// Coords less than 0 will be relative to the bottom-right corner
if (x1 < 0.0) x1 += 640.0;
if (x2 < 0.0) x2 += 640.0;
if (y1 < 0.0) y1 += 480.0;
if (y2 < 0.0) y2 += 480.0;
// Make sure the box is from top/left towards right/bottom
// If not, swap the variables (XOR swap).
if (x1 > x2) x1 ^= x2, x2 ^= x1, x1 ^= x2;
if (y1 > y2) y1 ^= y2, y2 ^= y1, y1 ^= y2;
height = y2 - y1;
td = TextDrawCreate(x1 * 1.003, y1 * 0.941, "_");
TextDrawUseBox(td, true);
TextDrawSetShadow(td, 0);
TextDrawAlignment(td, 1);
TextDrawSetOutline(td, 0);
TextDrawBoxColor(td, color);
TextDrawColor(td, 0);
TextDrawBackgroundColor(td, 0);
TextDrawTextSize(td, (x2 - 4.7) * 1.0025, 0.0);
TextDrawLetterSize(td, 0.0, height * 0.1045 - 0.55);
return td;
}