[Include] PlayerTextDrawStreamer
#1

PlayerTextDrawStreamer


Introduction

By default, SA-MP allows servers to create just 256 player textdraws per player. Many scripters, including myself have run into the issue of hitting that limit. While attempting to solve the issue, I found an old include created by theYiin that he had created for the same reason. Due to the include being abandoned and having many issues, I had to make many changes to it and now I've decided to release it give something back to the community.


Dependencies
  • foreach - Used to keep track of the player textdraw slots used and to iterate through them.
Installation

Simply install to your project:

Код:
sampctl package install kristoisberg/PlayerTextDrawStreamer
Include in your code and begin using the library:

PHP код:
#include <PlayerTextDrawStreamer> 
Usage

The include is completely plug & play. Simply follow the installation steps and your player textdraw limit has magically* been doubled.

The new limit of player textdraws has been set to 512 by default. If you wanna change it, simply define MAX_PLAYER_TEXTDRAWS with your own value before including PlayerTextDrawStreamer.

* - The player textdraws are only created when they are visible on the player's screen.


Functions

The following functions are added by the include and are completely compatible with YSF when it's also being used.

PHP код:
native IsValidPlayerTextDraw(playeridPlayerText:text);
native IsPlayerTextDrawVisible(playeridPlayerText:text);
native PlayerTextDrawGetString(playeridPlayerText:textstring[], len sizeof(string));
native PlayerTextDrawGetLetterSize(playeridPlayerText:text, &Float:x, &Float:y);
native PlayerTextDrawGetTextSize(playeridPlayerText:text, &Float:x, &Float:y);
native PlayerTextDrawSetPos(playeridPlayerText:textFloat:xFloat:y);
native PlayerTextDrawGetPos(playeridPlayerText:text, &Float:x, &Float:y);
native PlayerTextDrawGetColor(playeridPlayerText:text);
native PlayerTextDrawGetBoxColor(playeridPlayerText:text);
native PlayerTextDrawGetBackgroundCol(playeridPlayerText:text);
native PlayerTextDrawGetShadow(playeridPlayerText:text);
native PlayerTextDrawGetOutline(playeridPlayerText:text);
native PlayerTextDrawGetFont(playeridPlayerText:text);
native PlayerTextDrawIsBox(playeridPlayerText:text);
native PlayerTextDrawIsProportional(playeridPlayerText:text);
native PlayerTextDrawIsSelectable(playeridPlayerText:text);
native PlayerTextDrawGetAlignment(playeridPlayerText:text);
native PlayerTextDrawGetPreviewModel(playeridPlayerText:text);
native PlayerTextDrawGetPreviewRot(playeridPlayerText:text, &Float:fRotX, &Float:fRotY, &Float:fRotZ, &Float:fZoom);
native PlayerTextDrawGetPreviewVehCol(playeridPlayerText:text, &color1, &color2); 
Notes
  • Other SA-MP limits still apply to player textdraws:
    • Only 256 player textdraws can be displayed at once per player.
    • Textdraw strings are limited to 1024 characters. Color codes can't be used beyond the 255th character.
  • In case YSF is used alongside PlayerTextDrawStreamer, YSF must be included before PlayerTextDrawStreamer.

Credits
  • theYiin - The original author of the include.
  • kvann - The current maintainer.
  • Southclaws - Added sampctl support.

Download

https://github.com/kristoisberg/PlayerTextDrawStreamer
Reply
#2

Work good? No crash game or lag server?
Reply
#3

Quote:
Originally Posted by Florin48
Посмотреть сообщение
Work good? No crash game or lag server?
Quote:

Only 256 player textdraws can be displayed at once per player.

i'd say yeah.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)