Streamer Plugin

From SA-MP Wiki

Jump to: navigation, search
Image:32px-Ambox_warning_orange.png This article is currently a Work In Progress. It is therefore possible that the content of this article is currently incomplete or incorrect.


Plugin developed by Incognito, download is available on the release page.


This plugin streams objects, pickups, checkpoints, race checkpoints, map icons, and 3D text labels at user-defined server ticks. Basic area detection is also included. Because it is written entirely in C++, much of the overhead from PAWN is avoided. This streamer, as a result, is quite a bit faster than any other implementation currently available in PAWN.

Contents

Streaming

For those of you who don't know how streamers work (The people who always asked why there wasn't an AttachDynamicObjectToVehicle when it wasn't available (It's added now in the latest 0.3e version))

Image:32px-Ambox_warning_orange.png

Note

Hereafter, the term 'item' will be used to refer to any thing that can be streamed by the plugin: objects, pickups, checkpoints, map icons and areas.


Streamers create player items instead of global ones (except for pickups for which no 'per-player' version exists), and only show them for the players they are created for if that player is near by. The plugin is a little more advanced than the Pawn streamers but the concept is basically the same. A repeating timer loops through each item, checks if the item's respecting player is within it's stream distance and creates the object if they are.

A good example of how streamers work is here you can see how in that grid of objects, only the ones within a certain radius of the player are created.


Plugin Functions

Streamer_TickRate

Description:

The tick rate does not represent any specific measurement of time and varies depending on the server's processing power. If items stream too slowly, lower the tick rate; if CPU usage gets too high, raise the tick rate. The default tick rate is 50.


Parameters:
(rate)
rateSet the tickrate.


Return Values:

This function does not return any specific values.



Streamer_MaxItems

Description:

Set the maximum amount of items that can be streamed for a specific type (object, area, ...). There is generally no need to use this. The default amount is unlimited.


Parameters:
(type, items)
typeThe type to set the maximum items for. Refer to the definitions.
itemsThe maximum amount of items to stream.


Return Values:

This function does not return any specific values.



Streamer_VisibleItems

Description:

Set the maximum amount of items that can be visible for a specific player at any one time, for a specific type. The default values are 500 objects, 4096 pickups and 1024 3D text labels.


Parameters:
(type, items)
typeThe type of streamed item (object, pickup, 3d text label etc.) to set the maximum visible items for. Refer to the definitions.
itemsThe maximum amount of items that can be visible.


Return Values:

This function does not return any specific values.



Streamer_CellDistance

Description:

This function is used to determine whether or not an item needs to be put in a cell for spatial indexing purposes. The default value is 600.0. If an item's streaming distance (or, in the case of areas, an item's size) exceeds that of the cell distance, it will be streamed from any point on the map. For example, if a map icon's streaming distance is set to 100.0, it will only be visible if the player is in the same cell as the map icon or in an adjacent cell (assuming the default cell distance of 600.0 has not been changed). However, if the map icon's streaming distance is set to 1000.0, it will be visible no matter where the player is.


Parameters:
(Float:streamdistance)
streamdistanceThe cell distance to set.


Return Values:

This function does not return any specific values.



Streamer_CellSize

Description:

This function is used to determine the size of each cell in the grid. The default is 300.0.


Parameters:
(Float:size)
sizeThe cell size to set.


Return Values:

This function does not return any specific values.
Personal tools
Navigation
Toolbox