Warning ignoring large textdraw size как исправить самп

Долго тянул с тем, чтобы выложить этот худ в паблик, а не скидывать кому-то как-то лично. Работает ТОЛЬКО на сервере GHW Project. [/SPOILER] Cкачать архив Скачать скрипт отдельно(для обновлений) Инструкция по установке лежит внутри архива, в файле README.txt. Автор скрипта...

Andrinall


  • #1

aa_logo.png

Долго тянул с тем, чтобы выложить этот худ в паблик, а не скидывать кому-то как-то лично.
Работает ТОЛЬКО на сервере GHW Project.

Показ даты и времени(синхронизировано с серверными текстдравами)
Кастомный логотип.
Отображение таких параметров, как: Nickname, ID и Ping

Полоски статистик персонажа:
Синяя — кислород
Жёлтая — выносливость(пешком), ХП транспорта(за рулём)
Сероватая — Броня
Красная — ХП персонажа

HD иконки оружия с возможностью замены(но это не точно)
Отображение общего кол-ва патронов

Отображение денег на руках.

Отображение розыска
( Полученный розыск подсвечивается синими звёздами, если все серые — розыска нет )

Полоски потребностей:
Жёлтая — Усталость
Зелёная — Голод
Болотного цвета(что это за цвет вообще?) — Жажда.

Если все полоски на 100% или близко к тому — всё окей.
Если полоски уйдут ниже 50% или 10% — поменяется иконка возле соответствующей полоски.

/hudset - откроет окно настроек скрипта

Cкачать архив Скачать скрипт отдельно(для обновлений)
Инструкция по установке лежит внутри архива, в файле README.txt.

Автор скрипта: Andrinall
При публикации где-либо — указывайте ссылку …
… на эту тему, изначального автора скрипта.
logoBlue.png

Важно!

— Для корректной работы скрипта в настройках аккаунта, на сервере, обязательно должны быть включены следующие пункты:
1638524660749.png
— Для корректной работы скриптового спидометра, серверный спидометр должен находиться СПРАВА.

— Все вопросы или информацию о найденных багах можете писать — в этой теме, в VK( vk.me/glreallife ) или в Discord( Andrinall#5512 )
— В случае обращения с информацией о каком-либо баге в данном скрипте — нужно приложить:

скриншот или видео-запись проявления бага или moonloader.log, при падении(краше) скрипта.​

OFFTOP

( За качество картинки извиняюсь, чего только не мудрил с сглаживанием — ничего не помогло, пришлось просто блюром замазывать )

Последнее редактирование: 30.06.2022

Andrinall


  • #2

Hot Fix от 03.12.2021:

  • Исправлен редкий баг, при котором не регистрировалось время с серверных текстдравов, при этом выдавая самповские варнинги.
  • Исправлено выравнивание текста времени, при переключении между серверным и московским временем через настройки аккаунта.

    Обновлённый файл доступен для загрузки.

    Скачать

Последнее редактирование: 22.12.2021

Andrinall


  • #3

Fix от 21.12.2021:

  • Исправлено пропадание времени на худе при доставке скоропортящихся или иных грузов с ограничением времени доставки.

Обновлённый файл доступен для загрузки.​

Последнее редактирование: 22.12.2021

Andrinall


  • #4

Update от 4.02.2022

  • Исправлено возможное неправильное получение данных с текстдравов.
  • Исправлены некоторые моменты в коде, некоторые оптимизированы.
  • Переписана некоторая часть окна худа.
  • Добавлен спидометр. ( Некоторые иконки динамически изменяются в зависимости от значений )
  • Удалена команда /tHud
  • Добавлена команда /hudset ( настройки скрипта )
    • Настройка отображения трёх окон ( худ, потребности и спидометр )
    • Переключение безопасного режима интерфейса. ( Позволяет нажимать на текстдравы под интерфейсом. Перемещение интерфейса с этим режимом невозможно )
    • Настройка отображения шкалы скорости на спидометре.
    • Показаны условные обозначения на спидометре.

Внимание!

Для корректной работы спидометра, серверный спидометр должен находиться СПРАВА.

Если у вас будут проблемы с работой скрипта после установки — попробуйте выйти из игры и удалить файл по пути «moonloaderresourceGHWConfigsHud.json»

Обновлённый файл доступен для скачивания по кнопке ниже или в заголовке темы.​

Последнее редактирование: 04.02.2022

Andrinall


  • #5

Hot Fix
— Исправлены варнинги «Warning: ignoring large TextDraw size=*«, флудящие в чат, при посадке в авто, у некоторых игроков.
Файл обновлён, скачать можно в сообщении выше или в заголовке темы.
— Добавлена проверка, что игрок находится на водительском месте.

Последнее редактирование: 30.06.2022

Crisp


  • #6

Скачал архив со всеми файлами
При заходе на сервер худ работает, а вот как только я уже зашёл на сервер, то худ пропадает
sa-mp-030.png

Andrinall


  • #7

Скачал архив со всеми файлами
При заходе на сервер худ работает, а вот как только я уже зашёл на сервер, то худ пропадает
Посмотреть вложение 1073

После переезда сервера забыл пару строк заменить.
Обновил файлы.

Архив Скрипт отдельно

Вообщем в моде есть файл .pwn, в нем весь скрипт текстдрава, хочу поменять логотип, все меняю, но при компиляции выдает ошибки, ошибки снизу, прошу помочь.
 

Спойлер

E:DesktopAhegao rp projectFreak RP 1 (Only RP)gamemodesmodulestextdrawsm_td.pwn(1) : error 010: invalid function or declaration
E:DesktopAhegao rp projectFreak RP 1 (Only RP)gamemodesmodulestextdrawsm_td.pwn(3) : error 070: rational number support was not enabled
E:DesktopAhegao rp projectFreak RP 1 (Only RP)gamemodesmodulestextdrawsm_td.pwn(4) : error 010: invalid function or declaration
E:DesktopAhegao rp projectFreak RP 1 (Only RP)gamemodesmodulestextdrawsm_td.pwn(5) : error 010: invalid function or declaration
E:DesktopAhegao rp projectFreak RP 1 (Only RP)gamemodesmodulestextdrawsm_td.pwn(6) : error 010: invalid function or declaration
E:DesktopAhegao rp projectFreak RP 1 (Only RP)gamemodesmodulestextdrawsm_td.pwn(7) : error 010: invalid function or declaration
E:DesktopAhegao rp projectFreak RP 1 (Only RP)gamemodesmodulestextdrawsm_td.pwn(8) : error 010: invalid function or declaration
E:DesktopAhegao rp projectFreak RP 1 (Only RP)gamemodesmodulestextdrawsm_td.pwn(9) : error 010: invalid function or declaration
E:DesktopAhegao rp projectFreak RP 1 (Only RP)gamemodesmodulestextdrawsm_td.pwn(10) : error 010: invalid function or declaration
E:DesktopAhegao rp projectFreak RP 1 (Only RP)gamemodesmodulestextdrawsm_td.pwn(11) : error 010: invalid function or declaration
E:DesktopAhegao rp projectFreak RP 1 (Only RP)gamemodesmodulestextdrawsm_td.pwn(13) : error 010: invalid function or declaration
E:DesktopAhegao rp projectFreak RP 1 (Only RP)gamemodesmodulestextdrawsm_td.pwn(15) : error 025: function heading differs from prototype
E:DesktopAhegao rp projectFreak RP 1 (Only RP)gamemodesmodulestextdrawsm_td.pwn(16) : error 025: function heading differs from prototype
E:DesktopAhegao rp projectFreak RP 1 (Only RP)gamemodesmodulestextdrawsm_td.pwn(17) : error 025: function heading differs from prototype
E:DesktopAhegao rp projectFreak RP 1 (Only RP)gamemodesmodulestextdrawsm_td.pwn(18) : error 025: function heading differs from prototype
E:DesktopAhegao rp projectFreak RP 1 (Only RP)gamemodesmodulestextdrawsm_td.pwn(19) : error 025: function heading differs from prototype
E:DesktopAhegao rp projectFreak RP 1 (Only RP)gamemodesmodulestextdrawsm_td.pwn(20) : error 025: function heading differs from prototype
E:DesktopAhegao rp projectFreak RP 1 (Only RP)gamemodesmodulestextdrawsm_td.pwn(21) : error 025: function heading differs from prototype
E:DesktopAhegao rp projectFreak RP 1 (Only RP)gamemodesmodulestextdrawsm_td.pwn(22) : error 025: function heading differs from prototype
E:DesktopAhegao rp projectFreak RP 1 (Only RP)gamemodesmodulestextdrawsm_td.pwn(23) : error 025: function heading differs from prototype
E:DesktopAhegao rp projectFreak RP 1 (Only RP)gamemodesmodulestextdrawsm_td.pwn(25) : error 010: invalid function or declaration
E:DesktopAhegao rp projectFreak RP 1 (Only RP)gamemodesmodulestextdrawsm_td.pwn(27) : error 025: function heading differs from prototype
E:DesktopAhegao rp projectFreak RP 1 (Only RP)gamemodesmodulestextdrawsm_td.pwn(28) : error 025: function heading differs from prototype
E:DesktopAhegao rp projectFreak RP 1 (Only RP)gamemodesmodulestextdrawsm_td.pwn(29) : error 025: function heading differs from prototype
E:DesktopAhegao rp projectFreak RP 1 (Only RP)gamemodesmodulestextdrawsm_td.pwn(30) : error 025: function heading differs from prototype
E:DesktopAhegao rp projectFreak RP 1 (Only RP)gamemodesmodulestextdrawsm_td.pwn(31) : error 025: function heading differs from prototype

Отредактировано 23 июля, 2021 пользователем Jawn

Обновлено: 09.02.2023

Приветствую, форумчане, недавно наткнулся на один очень интересный скрипт (названием в заголовке).
После пары недель использования я понял, что это самый лучший редактор для текстдравов , почему? Читайте ниже

  1. Кликабельный интерфейс.
  2. Никаких плагинов не требуется!
  3. Многоязычная поддержка (английский, польский и немецкий языки изначально включены)
  4. Поддержка прогресс-бара игрока (с настройками цвета и максимального процента!)
  5. Встроенный селектор спрайтов(более 300 спрайтов!).
  6. Предварительный просмотр модели и поддержка спрайтов.
  7. Изменяемое имя переменной TextDraw в игре.
  8. Более 35 готовых цветов на выбор.
  9. Полностью настраиваемый интерфейс(цвета кнопок, переопределение цветов и положение интерфейса).
  10. Шаблоны TextDraw (готовые текстовые рисунки, чтобы выбрать и создать свой собственный!).
  11. Инструмент быстрого выбора(просто выберите свой TextDraw! Нет необходимости искать в диалоговом окне!).
  12. Опция видимости TextDraw (если вы хотите показать другим игрокам свою работу!).
  13. Полностью редактируемая модель предварительного просмотра(вращение, масштабирование, идентификатор и цвета!).
  14. Легкий экспорт вашего проекта (простой экспорт или самодостаточный скрипт).
  15. Быстрая, текучая и стабильная рабочая среда.
  16. Файловый язык и система шаблонов(добавление новых языков без взаимодействия с кодом!).
  17. Режим экспорта массива (сворачивает текстовые чертежи с именем переменной по умолчанию в массив, сокращая объем кода!).
  18. TextDraw layering (изменение слоя TextDraw в игре!).
  19. Редактор Compact mode (создает уменьшенную версию интерфейса, чтобы облегчить работу).
  20. И многое другое!

Но ярые фанаты IPLEO или TDE скажут — ну и что же тут особенного? Да в том, что этот редактор и сделан на основе TDE и IPLEO, но априори лучше и современней.

Парочка скриншотов (Это версия 5.0, а сейчас уже есть 6.1)

Так же видео на ютубе (Это версия 5.0, а сейчас уже есть 6.1)

Итак, всем привет! Очень много мне писали в Skype или же просто видел темы на форуме, что, сейчас многие любят делать все на TextDrawах. На самом деле не так давно я сам еще не очень разбирался в них но постепенно я все нашел сам. Мне никто не помогал и поэтому я знаю как чувствуют себя те бедолаги которые желают научится работать и создавать отличные Textdraw’ы. Итак, для того чтобы отлично делать Textdraw’ы и понять с чем их едят вам нужно:
1. Действительно прямые руки, чтобы вы все делали проделанно!
2. Хоть малейший стаж работы в Павно
3. Хоть малейший стаж работы с любыми текстдравами.
4. Два скрипта (любой на выбор) ссылка будет в самом низу ↓

1. Простейшие (Круг, Полоски)

1.1. В скачанном архиве вы найдете два скрипта, советую для создания всего использовать именно скрипт TD.AMX, один минус скрипта, создать прозрачный бокс не получится, для этого прийдется делать его с помощью iTD.AMX. Итак. Запускаем ваш сервер, вводим /text и видим:
[=======================================================]

[=======================================================]
Вводим любое название, например: Test. Снова наблюдаем такую картину:
[=======================================================]

[=======================================================]
Все, приступаем. Хочу сразу обратить ваше внимание на то что в этом уроке мы будем создавать только картинки, и прочие интересные штуки, и текстов тут не будет. Клацаем на Create new textdraw. Опять видим:
[=======================================================]

[=======================================================]
У нас создался текстдрав появился он вверху вввиде: New Textdraw, и сейчас мы с вами начнем работу с первого объекта. Круг.

Итак, жмем на нашем текстдрав который выделен на скриншоте и видим это:
[=======================================================]

[=======================================================]
Итак, если вы имеете хоть какое то знание англ. языка вам будет не так трудно. А если нет тогда делайте дальше по шагам.
Итак, жмем на Change Font и выбираем там FONT TYPE 4.
Далее жмем EDIT BOX, и выбираем BOX ON. Теперь видим строку CHANGE TEXT STRING и вписываем туда:
ld_pool:ball

и ничего не произошло, теперь возврашаемся в EDIT BOX и выбираем BOX SIZE.

А дальше просто растягиваем сколько нам нужно с помощью клавиш W D S A, для более быстрого редактирования советую зажать SHIFT. И у вас получится это:

Если вы это усвоили, то теперь обьясняю в чем легкость рисования этим способом, весь путь которй вы сейчас проделали, мы будем делать снова, только вместо LD_POOL:BALL мы будем вписывать кое что другое. А теперь спросите вы, как же найти название что вводить. Все очень просто друзья. Вам понадобится программа TXD WORK SHOP. Заходим в папку с игрой, находим папку TXD и видим там это:

как вы успели заметить у нас там лежат файлы по такому формату: LD_. вот это и есть название номер один, а теперь открываем файл, и видим там:

как вы видите я выбрал файл LD_BEAT: и теперь ищем нужную нам «Картинку» и вписываем в игре вместо LD_POOL:Ball например:
LD_BEAT:up, и у нас получится уже вот это:

Вот так вы сможете вставлять различные картинки. А теперь поговорим о «картинках» которые вы не найдете в папке TXD.

для этого вам понадобится такой код: ld_otb2:butnc

для создание сплошных полос, или например если вам нужно будет «закрасить» весь ваш экран для чего либо используйте это.

А теперь пойведу речь о «Картинках» тоесть например изображаем текстдрав машины на спидометре.

Для этого делаем следующее: Create new textdraw > CHANGE FONT > FONT 5 > EDIT BOX > BOX ON > BOX SIZE. А после

в главном меню редактирования текстдрава жмем Textdraw previev model options.. Извините уже без скриншотов так как уже слишком много кинул.

Спасибо всем! Надеюсь у вас все получится.

Вот пример того какие вы сможете делать меню персонажа для сервера (это я накидал в этом редакторе за 20 минут где то)

автор скрипта: Zamarohit
ВСЕМ СПАСИБО! ЕСЛИ НЕ ЖАЛКО СПАСИБО НАЖМИ)

Variable Declaration

When creating a textdraw, you should always decide if the textdraw you’re going to create has to be global (eg. your website address, global annoucement) or if it’s going to differ per player (eg. kills, deaths, score).

Global Textdraw

A global textdraw is the easiest to create and requires only one variable. This variable is needed to modify the textdraw and to show it to the players later on. The declaration for such a textdraw needs to be a global variable in most cases. The textdraw variable also needs to be prefixed with the Text: tag and should be initialized with the value Text:INVALID_TEXT_DRAW. If you omit the initialization, the textdraw may conflict with others as you add more textdraws.

Per-Player Textdraw

A per-player textdraw is exactly the same as a regular ‘global’ textdraw, but only creates the textdraw for a single player. This is useful for textdraws that are unique to each player, such as a ‘stats’ bar showing their kills or score. This can be used to avoid going over the global-textdraw limit, as you can create 256 (as of 0.3e R2) textdraws per player. They are also easier to manage, as they automatically destroy themselves when the player disconnects.

IMPORTANT NOTE: An array is still needed for the variable, as the ID of the textdraws may differ from player to player, as other players may have more or less textdraws created than the other.

The function names only differ slightly, with ‘TextDraw’ becoming ‘PlayerTextDraw’, with one exception: CreatePlayerTextDraw (‘TextDrawSetString’ becomes ‘PlayerTextDrawSetString’).

Global Textdraws

Global textdraws can be created, then shown to all players. There is a limit as to how many can be created, though. This means if you have a server with 500 players, creating more than 4 textdraws per-player is not possible. That’s where player-textdraws come in. See further down. Here is a list of all the functions related to global textdraws:

  • TextDrawCreate: Create a textdraw.
  • TextDrawDestroy: Destroy a textdraw.
  • TextDrawColor: Set the color of the text in a textdraw.
  • TextDrawBoxColor: Set the color of the box in a textdraw.
  • TextDrawBackgroundColor: Set the background color of a textdraw.
  • TextDrawAlignment: Set the alignment of a textdraw.
  • TextDrawFont: Set the font of a textdraw.
  • TextDrawLetterSize: Set the letter size of the text in a textdraw.
  • TextDrawTextSize: Set the size of a textdraw box.
  • TextDrawSetOutline: Choose whether the text has an outline.
  • TextDrawSetShadow: Toggle shadows on a textdraw.
  • TextDrawSetProportional: Scale the text spacing in a textdraw to a proportional ratio.
  • TextDrawUseBox: Toggle if the textdraw has a box or not.
  • TextDrawSetString: Set the text in an existing textdraw.
  • TextDrawShowForPlayer: Show a textdraw for a certain player.
  • TextDrawHideForPlayer: Hide a textdraw for a certain player.
  • TextDrawShowForAll: Show a textdraw for all players.
  • TextDrawHideForAll: Hide a textdraw for all players.

Creating the Textdraw

Dimension map.

Once you’ve declared a variable/array to store the ID of your textdraw(s) in, you can proceed to create the textdraw itself. For global textdraws that are always created, the code should be placed under OnGameModeInit. To create the textdraw, the function TextDrawCreate must be used.

Note that this function merely creates the textdraw, other functions are used to modify it and to show it to the player(s).

Let’s proceed to create the textdraw:

We have created a textdraw in the center of the screen that says «Hello World!».

Showing the textdraw

For this example, the textdraw has been created globally under OnGameModeInit and will be shown to player when they join the server.

To show a textdraw for a single player, the function TextDrawShowForPlayer is used.

playerid The ID of the player to show the textdraw for

The playerid is passed through OnPlayerConnect, and the text-draw ID is stored in the ‘gMyText’ variable.

Определение textdraw

Вы используете устаревший браузер. Этот и другие сайты могут отображаться в нём некорректно.
Вам необходимо обновить браузер или попробовать использовать другой.

Hlebychet
Участник

Хочу создать ЛУА для StageRp. Там есть такие работы: рыбалка, завод. Они схожи тем, что чтобы сделать успешно что-то нужно нажимать y или n, что мне скажет сервер. Для этого там есть textdraw. Хочу узнать вот что: можно ли узнать ID текстдрова, или его надпись (которая известна), чтобы бот нажимал нужные клавиши. И какая функция, событие для этого есть. Для определния текстдрова, как мне кается, на них построена работа.

4el0ve4ik
Жыве Беларусь!

Хочу создать ЛУА для StageRp. Там есть такие работы: рыбалка, завод. Они схожи тем, что чтобы сделать успешно что-то нужно нажимать y или n, что мне скажет сервер. Для этого там есть textdraw. Хочу узнать вот что: можно ли узнать ID текстдрова, или его надпись (которая известна), чтобы бот нажимал нужные клавиши. И какая функция, событие для этого есть. Для определния текстдрова, как мне кается, на них построена работа.

TextDraw

As the name implies, a textdraw is text that is drawn on a player’s screen. Unlike client messages or gametext however, textdraws can be shown on a player’s screen for an indefinite period of time. Textdraws can be simple text on the screen such as a website address, or complex scripted dynamic textdraws such as progress bars.

Setting the font

There are 4 fonts available for textdraw text:

ID Info Tips
0 The San Andreas Font. Use for header or titles, not a whole page.
1 Clear font that includes both upper and lower case characters. Can be used for a lot of text.
2 Clear font, but includes only capital letters. Can be used in various instances.
3 GTA font Retains quality when enlarged. Useful for large texts.

As of SA-MP 0.3d, a new font (id 4) can be set. This is used in combination with the TextDrawCreate and TextDrawTextSize functions to show a texture ‘sprite’ on the player’s screen. We’ll cover this later.

Player-textdraws

Player-textdraws are only created for one specific player. Up to 256 textdraws can be created PER-PLAYER. That’s 128,000 on a server with 500 players. A little more than 2048. Player-textdraws should be used for things that are not ‘static’. Do not use them to display a website address for example, but for a vehicle health indicator.

  • CreatePlayerTextDraw: Create a player-textdraw.
  • PlayerTextDrawDestroy: Destroy a player-textdraw.
  • PlayerTextDrawColor: Set the color of the text in a player-textdraw.
  • PlayerTextDrawBoxColor: Set the color of a player-textdraw’s box.
  • PlayerTextDrawBackgroundColor: Set the background color of a player-textdraw.
  • PlayerTextDrawAlignment: Set the alignment of a player-textdraw.
  • PlayerTextDrawFont: Set the font of a player-textdraw.
  • PlayerTextDrawLetterSize: Set the letter size of the text in a player-textdraw.
  • PlayerTextDrawTextSize: Set the size of a player-textdraw box (or clickable area for PlayerTextDrawSetSelectable).
  • PlayerTextDrawSetOutline: Toggle the outline on a player-textdraw.
  • PlayerTextDrawSetShadow: Set the shadow on a player-textdraw.
  • PlayerTextDrawSetProportional: Scale the text spacing in a player-textdraw to a proportional ratio.
  • PlayerTextDrawUseBox: Toggle the box on a player-textdraw.
  • PlayerTextDrawSetString: Set the text of a player-textdraw.
  • PlayerTextDrawShow: Show a player-textdraw.
  • PlayerTextDrawHide: Hide a player-textdraw.

Читайте также:

      

  • Как увеличить энергию в crossout
  •   

  • Корсары каждому свое как использовать пистолет
  •   

  • Где растет авокадо архейдж
  •   

  • Можно ли оплатить госпошлину за другого человека со своей карты
  •   

  • Как в майнкрафте приручить пиглина
This article is currently a Work In Progress. It is therefore possible that the content of this article is currently incomplete or incorrect.

What is a Textdraw?

As the name implies, a textdraw is text that is drawn on a player’s screen. Unlike client messages or gametext however, textdraws can be shown on a player’s screen for an indefinite period of time. Textdraws can be simple text on the screen such as a website address, or complex scripted dynamic textdraws such as progress bars.

This ‘textdraw editor’ tool can make designing textdraws much easier: http://forum.sa-mp.com/showthread.php?t=290640

Global Textdraws

Global textdraws can be created, then shown to all players. There is a limit as to how many can be created, though. This means if you have a server with 500 players, creating more than 4 textdraws per-player is not possible. That’s where player-textdraws come in. See further down. Here is a list of all the functions related to global textdraws:
TextDrawCreate: Create a textdraw.

  • TextDrawDestroy: Destroy a textdraw.
  • TextDrawColor: Set the color of the text in a textdraw.
  • TextDrawBoxColor: Set the color of the box in a textdraw.
  • TextDrawBackgroundColor: Set the background color of a textdraw.
  • TextDrawAlignment: Set the alignment of a textdraw.
  • TextDrawFont: Set the font of a textdraw.
  • TextDrawLetterSize: Set the letter size of the text in a textdraw.
  • TextDrawTextSize: Set the size of a textdraw box.
  • TextDrawSetOutline: Choose whether the text has an outline.
  • TextDrawSetShadow: Toggle shadows on a textdraw.
  • TextDrawSetProportional: Scale the text spacing in a textdraw to a proportional ratio.
  • TextDrawUseBox: Toggle if the textdraw has a box or not.
  • TextDrawSetString: Set the text in an existing textdraw.
  • TextDrawShowForPlayer: Show a textdraw for a certain player.
  • TextDrawHideForPlayer: Hide a textdraw for a certain player.
  • TextDrawShowForAll: Show a textdraw for all players.
  • TextDrawHideForAll: Hide a textdraw for all players.

Player-textdraws

Player-textdraws are only created for one specific player. Up to 256 textdraws can be created PER-PLAYER. That’s 128,000 on a server with 500 players. A little more than 2048. Player-textdraws should be used for things that are not ‘static’. Do not use them to display a website address for example, but for a vehicle health indicator.

  • CreatePlayerTextDraw: Create a player-textdraw.
  • PlayerTextDrawDestroy: Destroy a player-textdraw.
  • PlayerTextDrawColor: Set the color of the text in a player-textdraw.
  • PlayerTextDrawBoxColor: Set the color of a player-textdraw’s box.
  • PlayerTextDrawBackgroundColor: Set the background color of a player-textdraw.
  • PlayerTextDrawAlignment: Set the alignment of a player-textdraw.
  • PlayerTextDrawFont: Set the font of a player-textdraw.
  • PlayerTextDrawLetterSize: Set the letter size of the text in a player-textdraw.
  • PlayerTextDrawTextSize: Set the size of a player-textdraw box (or clickable area for PlayerTextDrawSetSelectable).
  • PlayerTextDrawSetOutline: Toggle the outline on a player-textdraw.
  • PlayerTextDrawSetShadow: Set the shadow on a player-textdraw.
  • PlayerTextDrawSetProportional: Scale the text spacing in a player-textdraw to a proportional ratio.
  • PlayerTextDrawUseBox: Toggle the box on a player-textdraw.
  • PlayerTextDrawSetString: Set the text of a player-textdraw.
  • PlayerTextDrawShow: Show a player-textdraw.
  • PlayerTextDrawHide: Hide a player-textdraw.

Variable Declaration

When creating a textdraw, you should always decide if the textdraw you’re going to create has to be global (eg. your website address, global annoucement) or if it’s going to differ per player (eg. kills, deaths, score).

Global Textdraw

A global textdraw is the easiest to create and requires only one variable. This variable is needed to modify the textdraw and to show it to the players later on. The declaration for such a textdraw needs to be a global variable in most cases. The textdraw variable also needs to be prefixed with the Text: tag and should be initialized with the value Text:INVALID_TEXT_DRAW. If you omit the initialization, the textdraw may conflict with others as you add more textdraws.

new Text:gMyText = Text:INVALID_TEXT_DRAW;

Per-Player Textdraw

A per-player textdraw is exactly the same as a regular ‘global’ textdraw, but only creates the textdraw for a single player. This is useful for textdraws that are unique to each player, such as a ‘stats’ bar showing their kills or score. This can be used to avoid going over the global-textdraw limit, as you can create 256 (as of 0.3e R2) textdraws per player. They are also easier to manage, as they automatically destroy themselves when the player disconnects.

new PlayerText:gMyPlayerText = PlayerText:INVALID_TEXT_DRAW;

IMPORTANT NOTE: An array is still needed for the variable, as the ID of the textdraws may differ from player to player, as other players may have more or less textdraws created than the other.

The function names only differ slightly, with ‘TextDraw’ becoming ‘PlayerTextDraw’, with one exception: CreatePlayerTextDraw (‘TextDrawSetString’ becomes ‘PlayerTextDrawSetString’).

Creating the Textdraw

Once you’ve declared a variable/array to store the ID of your textdraw(s) in, you can proceed to create the textdraw itself. For global textdraws that are always created, the code should be placed under OnGameModeInit. To create the textdraw, the function TextDrawCreate must be used.

that this function merely creates the textdraw, other functions are used to modify it and to show it to the player(s).

Textdraw map.png

Parameters:

(TextDrawCreate(Float:x, Float:y, text[]))

float x X coordinate at which to create the textdraw.
float y Y coordinate at which to create the textdraw.
string text The text in the textdraw.
Return Values:

The ID of the created textdraw

Examples:
public OnGameModeInit()
{
    gMyText = TextDrawCreate(320.0, 240.0, "Hello World!");
    return 1;
}

We have created a textdraw in the center of the screen that says «Hello World!».

Setting the font

There are 4 fonts available for textdraw text:

Textdraw font styles.png

ID Info Tips
0 The San Andreas Font. Use for header or titles, not a whole page.
1 Clear font that includes both upper and lower case characters. Can be used for a lot of text.
2 Clear font, but includes only capital letters. Can be used in various instances.
3 GTA font Retains quality when enlarged. Useful for large texts.

As of SA-MP 0.3d, a new font (id 4) can be set. This is used in combination with the TextDrawCreate and TextDrawTextSize functions to show a texture ‘sprite’ on the player’s screen. We’ll cover this later.

Showing the textdraw

For this example, the textdraw has been created globally under OnGameModeInit and will be shown to player when they join the server.
To show a textdraw for a single player, the function TextDrawShowForPlayer is used.

Parameters:

(TextDrawShowForPlayer(playerid, Text:text)

int playerid The ID of the player to show the textdraw for.
int text The ID of the textdraw to show.
Return Values:

This function does not return any specific values.

The playerid is passed through OnPlayerConnect, and the text-draw ID is stored in the ‘gMyText’ variable.

Examples:
public OnGameModeInit()
{
    gMyText = TextDrawCreate(320.0, 320.0, "Hello World!");
    return 1;
}
 
public OnPlayerConnect(playerid)
{
    TextDrawShowForPlayer(playerid, gMyText);
    return 1;
}

Assorted Tips

  • Try to use whole number when specifying positions, this ensures the best compatibility on different resolutions.
  • Fonts appear to look the best with an X to Y ratio of 1 to 4 (e.g. if x = 0.5 then y should be 2).

Понравилась статья? Поделить с друзьями:
  • Warning fatal error 824 occurred
  • Watch dogs 2 ошибка dbghelp dll
  • Warning fan error асик
  • Wasteland 2 как изменить разрешение
  • Warning failed to get wu exemption info from nlm assuming not exempt error 0x80240037