[Include] Text Draw Box Messages
#1

A include which adds a function to create Text Draw Box messages with only one line of code.




Overview
Код:
native TD_SendMessage(playerid, const string_[], header[], hide_in = 5000, bgcolor = 12840, Float:padding = 24.0000, Float:BaseX = 319.000000, Float:BaseY = 231.000000, length = 90);
native TD_HideMessage(playerid);
TD_SendMessage
Sends a message box to a playerid.
Note:
  1. If the input text is to long the function stops writing, creates a new line and continues.
  2. If you wish to send the text without the background box just use an invisible color for the box (e.g. 0xFFAAFF00).
  3. If you want to change the text color use as following ~y~, ~r~
  4. If the text exceeds the screen the function auto aligns the position of the box!
  5. If 'hide_in' is set to 0 the box will first disappear when TD_SendMessage is used a second time or TD_HideMessage is used
Params:
  1. playerid: Playerid who will see the text draw messages.
  2. const string_[]: Message that has to be send to playerid.
  3. header: Message Box header.
  4. hide_in[]: Amount of time till the box disappears.
  5. bgcolor[]: Color of the background box.
  6. padding[]: Space between the box border and actual text.
  7. BaseX[]: X coordinate to start the box with.
  8. BaseY[]: Y coordinate to start the box with.
  9. length[]: Length of a line till the text jumps into the next line.
TD_HideMessage
  1. playerid: Playerid for whom the box will be hidden.

Things to do:
  • Fade box out/in
Download
Include+Example Script:
Reply
#2

This will definitely become helpful to some folks. Nice job!
Reply
#3

That should help yourself. not having to do everything manually!
Reply
#4

Helpful to newbies in Textdraws.Nice FS.A rep for you
Reply
#5

Nice
Reply
#6

It could become a nice filterscript with dialogs and more options.
Like moving the box in game and edit it's styles, fonts.

Good job
Reply
#7

This looks very, very nice.
Reply
#8

You make it so if you type -1 for hide_in it never goes away.

Example:
pawn Код:
TD_SendMessage(playerid, const string_[], header[], -1, bgcolor = 12840, Float:padding = 24.0000, Float:BaseX = 319.000000, Float:BaseY = 231.000000, length = 90); //The -1 was where hide_in was at.
Reply
#9

Please, make for russian language !!!!
Reply
#10

Crashed when using it.

Crash log:
Код:
SA-MP 0.3x-R1-2
Exception At Address: 0x00727B45
Base: 0x03CE0000

Registers:
EAX: 0xFFFFFF3F	EBX: 0x0F600001	ECX: 0x00C71AD0	EDX: 0x00C6C4E0
ESI: 0x0F607D69	EDI: 0x0F60D105	EBP: 0x0F60D105	ESP: 0x0028F9AC
EFLAGS: 0x00010286

Stack:
+0000: 0x00719867   0x0F600001   0x00000000   0x00719C84
+0010: 0x0063C0E2   0x4396AB6E   0x0F607D69   0x00000000
+0020: 0x00719F48   0x0F60D105   0x0F60D108   0x0F607D69
+0030: 0x0F607D00   0xFFFFFFFF   0x00000001   0x0071A3DD
+0040: 0x4352A000   0x43960000   0x00000001   0xFFFFFFFF
+0050: 0x00000000   0x4352A000   0x43960000   0x756A6C30
+0060: 0x0F607D69   0x79000000   0x43D34332   0x4352A000
+0070: 0x00000001   0x43D87665   0x0000000B   0x43960000
+0080: 0x43D34332   0x00000000   0xFFFFFFFF   0x00000000
+0090: 0x00000000   0x00000000   0x00000000   0x00000000
+00A0: 0x00000000   0x00000000   0x00000000   0x00000000
+00B0: 0x00000000   0x00000000   0x00000000   0x00000000
+00C0: 0x00000000   0x00000000   0x00000000   0x00000000
+00D0: 0x00000000   0x00000000   0x00000000   0x00000000
+00E0: 0x00000000   0x00000000   0x00000000   0x00000000
+00F0: 0x00000000   0x00000000   0x00000000   0x00000000
+0100: 0x00000000   0x00000000   0x00000000   0x00000000
+0110: 0x00000000   0x00000000   0x00000000   0x00000000
+0120: 0x00000000   0x00000000   0x00000000   0x00000000
+0130: 0x00000000   0x00000000   0x00000000   0x00000000
+0140: 0x00000000   0x00000000   0x00000000   0x00000000
+0150: 0x00000000   0x00000000   0x00000000   0x00000000
+0160: 0x00000000   0x00000000   0x00000000   0x00000000
+0170: 0x00000000   0x00000000   0x00000000   0x00000000
+0180: 0x00000000   0x00000000   0x00000000   0x00000000
+0190: 0x0071A807   0x00000001   0x4352A000   0x43960000
+01A0: 0x0F607D69   0x0F607D69   0x0F607968   0x00000000
+01B0: 0x00000000   0x00000000   0x00000000   0x00000000
+01C0: 0x03D52ECE   0x4352A000   0x43960000   0x0F607D69
+01D0: 0x0F607D69   0x0F607D69   0xFFFFFFFF   0xFFFFFFFF
+01E0: 0xFFFFFFFF   0xFFFFFFFF   0xFFFFFFFF   0xFFFFFFFF
+01F0: 0x0F607D69   0x00000002   0x0F5B55F0   0x00000002
+0200: 0x4352A000   0x43960000   0x44C80000   0x3ACCCCCD
+0210: 0x44C80000   0x3B124925   0x03CF8916   0x00000000
+0220: 0x00000000   0x03D458AB   0x0028FBF0   0x68782E7C
+0230: 0x008E2EC0   0x00000040   0x00B5DCA0   0x0028FC00
+0240: 0x00822A23   0x00B5DCA0   0xFFFFFFFF   0x0028FC9C
+0250: 0x0028FC9C   0x0028FD4C   0x004D395E   0x00B5DCA0
+0260: 0x0028FC9C   0x000004EE   0x00B7358C   0x00B735BC
+0270: 0x0028FC74   0x779B004A   0x7652EEAE   0xFFFFFFFF

SCM Op: 0x248, lDbg: 0 LastRendObj: 0

Game Version: EU 1.0

State Information: Ped Context: 0
And can we only use ~y~ and ~r~? I used other colors that you can use in textdraws, is that why I crashed?
Reply
#11

Quote:
Originally Posted by JamesH
Посмотреть сообщение
It could become a nice filterscript with dialogs and more options.
Like moving the box in game and edit it's styles, fonts.

Good job
I like the idea. Will make such a version when my studies allow it

Quote:
Originally Posted by stormchaser206
Посмотреть сообщение
You make it so if you type -1 for hide_in it never goes away.

Example:
pawn Код:
TD_SendMessage(playerid, const string_[], header[], -1, bgcolor = 12840, Float:padding = 24.0000, Float:BaseX = 319.000000, Float:BaseY = 231.000000, length = 90); //The -1 was where hide_in was at.
Oh yea thanks for poiting that out. It's because I use hide_in in SetTimer(); Will upload a fixed version asap.

Quote:
Originally Posted by stormchaser206
Посмотреть сообщение
Crashed when using it.

Crash log:
Код:
SA-MP 0.3x-R1-2
Exception At Address: 0x00727B45
Base: 0x03CE0000

Registers:
EAX: 0xFFFFFF3F	EBX: 0x0F600001	ECX: 0x00C71AD0	EDX: 0x00C6C4E0
ESI: 0x0F607D69	EDI: 0x0F60D105	EBP: 0x0F60D105	ESP: 0x0028F9AC
EFLAGS: 0x00010286

Stack:
+0000: 0x00719867   0x0F600001   0x00000000   0x00719C84
+0010: 0x0063C0E2   0x4396AB6E   0x0F607D69   0x00000000
+0020: 0x00719F48   0x0F60D105   0x0F60D108   0x0F607D69
+0030: 0x0F607D00   0xFFFFFFFF   0x00000001   0x0071A3DD
+0040: 0x4352A000   0x43960000   0x00000001   0xFFFFFFFF
+0050: 0x00000000   0x4352A000   0x43960000   0x756A6C30
+0060: 0x0F607D69   0x79000000   0x43D34332   0x4352A000
+0070: 0x00000001   0x43D87665   0x0000000B   0x43960000
+0080: 0x43D34332   0x00000000   0xFFFFFFFF   0x00000000
+0090: 0x00000000   0x00000000   0x00000000   0x00000000
+00A0: 0x00000000   0x00000000   0x00000000   0x00000000
+00B0: 0x00000000   0x00000000   0x00000000   0x00000000
+00C0: 0x00000000   0x00000000   0x00000000   0x00000000
+00D0: 0x00000000   0x00000000   0x00000000   0x00000000
+00E0: 0x00000000   0x00000000   0x00000000   0x00000000
+00F0: 0x00000000   0x00000000   0x00000000   0x00000000
+0100: 0x00000000   0x00000000   0x00000000   0x00000000
+0110: 0x00000000   0x00000000   0x00000000   0x00000000
+0120: 0x00000000   0x00000000   0x00000000   0x00000000
+0130: 0x00000000   0x00000000   0x00000000   0x00000000
+0140: 0x00000000   0x00000000   0x00000000   0x00000000
+0150: 0x00000000   0x00000000   0x00000000   0x00000000
+0160: 0x00000000   0x00000000   0x00000000   0x00000000
+0170: 0x00000000   0x00000000   0x00000000   0x00000000
+0180: 0x00000000   0x00000000   0x00000000   0x00000000
+0190: 0x0071A807   0x00000001   0x4352A000   0x43960000
+01A0: 0x0F607D69   0x0F607D69   0x0F607968   0x00000000
+01B0: 0x00000000   0x00000000   0x00000000   0x00000000
+01C0: 0x03D52ECE   0x4352A000   0x43960000   0x0F607D69
+01D0: 0x0F607D69   0x0F607D69   0xFFFFFFFF   0xFFFFFFFF
+01E0: 0xFFFFFFFF   0xFFFFFFFF   0xFFFFFFFF   0xFFFFFFFF
+01F0: 0x0F607D69   0x00000002   0x0F5B55F0   0x00000002
+0200: 0x4352A000   0x43960000   0x44C80000   0x3ACCCCCD
+0210: 0x44C80000   0x3B124925   0x03CF8916   0x00000000
+0220: 0x00000000   0x03D458AB   0x0028FBF0   0x68782E7C
+0230: 0x008E2EC0   0x00000040   0x00B5DCA0   0x0028FC00
+0240: 0x00822A23   0x00B5DCA0   0xFFFFFFFF   0x0028FC9C
+0250: 0x0028FC9C   0x0028FD4C   0x004D395E   0x00B5DCA0
+0260: 0x0028FC9C   0x000004EE   0x00B7358C   0x00B735BC
+0270: 0x0028FC74   0x779B004A   0x7652EEAE   0xFFFFFFFF

SCM Op: 0x248, lDbg: 0 LastRendObj: 0

Game Version: EU 1.0

State Information: Ped Context: 0
And can we only use ~y~ and ~r~? I used other colors that you can use in textdraws, is that why I crashed?
Yes you can use all textdraw colors.
Hmm I did never experience a crash while using this :-/
Maybe this occured?
Quote:

If you use color codes (such as ~R~ ~G~) beyond 255th character the client will crash trying to display the textdraw.

https://sampwiki.blast.hk/wiki/TextDrawCreate
Reply
#12

Simple yet cool looking! nice!!!
Reply
#13

Still don't get it, can you give me example of format text?
Reply
#14

How to
Quote:

\n

?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)