samp.directory
← Скрипты и библиотеки

devbluen/textdraw-simple-click

This include shortens and simplifies the creation of actions for textdraws. It also reduces response time.

Библиотека★ 9обновлён 25 дней назадБез лицензииPawnsampctl
Открыть на GitHub

В этом репозитории нет файла лицензии. Код открыт для чтения, но само по себе это не даёт права использовать его.

Установка через sampctl

sampctl package install devbluen/textdraw-simple-click

Выполните в папке проекта. sampctl скачает пакет и его зависимости.

Попробовать в компиляторе Pawn →

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

README.md

🫧 Textdraw Simple Click

This include will streamline your modding and creation of textdraw clicks, eliminating the need for hooks or ALS. With this small change, the clicks will be 200% faster and more efficient, thereby reducing CPU usage and improving your server's responsiveness.

📃 Usage example

Registering the clicks, see example below

stock CreateTextdraw(playerid) {

    // A simple example of textdraw creation, just to illustrate SetClick.
    new PlayerText:id = CreatePlayerTextDraw(playerid, 0.0, 0.0, "LD_SPAC:white") // or box, whatever
    PlayerTextDrawSetSelectable(playerid, id, true);

    PlayerTextDrawSetClick(playerid, "ClickLogin", id);
    SelectTextDraw(playerid, -1);
}

PlayerTextDrawClick:ClickLogin(playerid, params) {

    // your code
    return true;
}

Now a click registration with parameters (can be used with loops, for example, inventory slots, etc.)

stock CreateTextdraw(playerid) {

    // A simple example of textdraw creation, just to illustrate SetClick.
    new PlayerText:inventario_slot[3];
    
    inventario_slot[0] = CreatePlayerTextDraw(playerid, 0.0, 0.0, "LD_SPAC:white")
    PlayerTextDrawSetSelectable(playerid, inventario_slot[0], true);

    inventario_slot[1] = CreatePlayerTextDraw(playerid, 0.0, 0.0, "LD_SPAC:white")
    PlayerTextDrawSetSelectable(playerid, inventario_slot[1], true);

    inventario_slot[2] = CreatePlayerTextDraw(playerid, 0.0, 0.0, "LD_SPAC:white")
    PlayerTextDrawSetSelectable(playerid, inventario_slot[2], true);

    for(new i = 0; i < sizeof inventario_slot; i++)
        PlayerTextDrawSetClick(playerid, "InventorySlot", inventario_slot[i], i);

    SelectTextDraw(playerid, -1);
}

PlayerTextDrawClick:InventorySlot(playerid, slot_inventory) {

    // your code
    return true;
}

🔨 Results

In tests I conducted, the clicks became extremely more responsive and faster because the code doesn't need to search for the correct PlayerText to run the code. If you encounter any problems, please open an issue so I can assist you. 😊

Страница собрана из того, что GitHub публикует о репозитории. samp.directory не хранит этот код. Сообщить о проблеме с этой записью

devbluen/textdraw-simple-click: Библиотека для SA-MP | samp.directory