Streamer Plugin v2.5.2

Post Reply
RoberTo
Global Moderator
Global Moderator
Posts: 1380
Joined: Sun Dec 26, 2010 9:31 pm
Jucator SA:MP ?: Da
Nick:: RoberTo
Jucator CS ?: Da
Location: Craiova
Contact:

Streamer Plugin v2.5.2

Post by RoberTo »

Streamer Plugin v2.5.2

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.

Changelog

v2.5.2:
- Fixed some minor bugs
- Added support for map icon styles in 0.3c

Refer to readme.txt in the server package for the full changelog.


Natives

Settings:

Code: Select all

native Streamer_TickRate(rate);
native Streamer_MaxItems(type, items);
native Streamer_VisibleItems(type, items);
native Streamer_CellDistance(Float:distance);
native Streamer_CellSize(Float:size); 
Updates:

Code: Select all

native Streamer_Update(playerid);
native Streamer_UpdateEx(playerid, Float:x, Float:y, Float:z); 
Data Manipulation:

Code: Select all

native Streamer_GetFloatData(type, {Text3D,_}:id, data, &Float:result);
native Streamer_SetFloatData(type, {Text3D,_}:id, data, Float:value);
native Streamer_GetIntData(type, {Text3D,_}:id, data);
native Streamer_SetIntData(type, {Text3D,_}:id, data, value);
native Streamer_IsInArrayData(type, {Text3D,_}:id, data, value);
native Streamer_AppendArrayData(type, {Text3D,_}:id, data, value);
native Streamer_RemoveArrayData(type, {Text3D,_}:id, data, value);
native Streamer_GetUpperBound(type); 
Miscellaneous:

Code: Select all

native Streamer_IsItemVisible(playerid, type, {Text3D,_}:id);
native Streamer_DestroyAllVisibleItems(playerid, type);
native Streamer_CountVisibleItems(playerid, type); 
Objects:

Code: Select all

native CreateDynamicObject(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, worldid = -1, interiorid = -1, playerid = -1, Float:distance = 200.0);
native DestroyDynamicObject(objectid);
native IsValidDynamicObject(objectid);
native SetDynamicObjectPos(objectid, Float:x, Float:y, Float:z);
native GetDynamicObjectPos(objectid, &Float:x, &Float:y, &Float:z);
native SetDynamicObjectRot(objectid, Float:rx, Float:ry, Float:rz);
native GetDynamicObjectRot(objectid, &Float:rx, &Float:ry, &Float:rz);
native MoveDynamicObject(objectid, Float:x, Float:y, Float:z, Float:speed);
native StopDynamicObject(objectid);
native DestroyAllDynamicObjects();
native CountDynamicObjects(); 
Pickups:

Code: Select all

native CreateDynamicPickup(modelid, type, Float:x, Float:y, Float:z, worldid = -1, interiorid = -1, playerid = -1, Float:distance = 100.0);
native DestroyDynamicPickup(pickupid);
native IsValidDynamicPickup(pickupid);
native DestroyAllDynamicPickups();
native CountDynamicPickups(); 
Checkpoints:

Code: Select all

native CreateDynamicCP(Float:x, Float:y, Float:z, Float:size, worldid = -1, interiorid = -1, playerid = -1, Float:distance = 100.0);
native DestroyDynamicCP(checkpointid);
native IsValidDynamicCP(checkpointid);
native TogglePlayerDynamicCP(playerid, checkpointid, toggle);
native TogglePlayerAllDynamicCPs(playerid, toggle);
native IsPlayerInDynamicCP(playerid, checkpointid);
native DestroyAllDynamicCPs();
native CountDynamicCPs(); 
Race Checkpoints:

Code: Select all

native CreateDynamicRaceCP(type, Float:x, Float:y, Float:z, Float:nextx, Float:nexty, Float:nextz, Float:size, worldid = -1, interiorid = -1, playerid = -1, Float:distance = 100.0);
native DestroyDynamicRaceCP(checkpointid);
native IsValidDynamicRaceCP(checkpointid);
native TogglePlayerDynamicRaceCP(playerid, checkpointid, toggle);
native TogglePlayerAllDynamicRaceCPs(playerid, toggle);
native IsPlayerInDynamicRaceCP(playerid, checkpointid);
native DestroyAllDynamicRaceCPs();
native CountDynamicRaceCPs(); 
Map Icons:

Code: Select all

native CreateDynamicMapIcon(Float:x, Float:y, Float:z, type, color, worldid = -1, interiorid = -1, playerid = -1, Float:distance = 100.0);
native DestroyDynamicMapIcon(iconid);
native IsValidDynamicMapIcon(iconid);
native DestroyAllDynamicMapIcons();
native CountDynamicMapIcons(); 
3D Text Labels:

Code: Select all

native Text3D:CreateDynamic3DTextLabel(const text[], color, Float:x, Float:y, Float:z, Float:drawdistance, attachedplayer = INVALID_PLAYER_ID, attachedvehicle = INVALID_VEHICLE_ID, testlos = 0, worldid = -1, interiorid = -1, playerid = -1, Float:distance = 100.0);
native DestroyDynamic3DTextLabel(Text3D:id);
native IsValidDynamic3DTextLabel(Text3D:id);
native UpdateDynamic3DTextLabelText(Text3D:id, color, const text[]);
native DestroyAllDynamic3DTextLabels();
native CountDynamic3DTextLabels(); 
Areas:

Code: Select all

native CreateDynamicCircle(Float:x, Float:y, Float:size, worldid = -1, interiorid = -1, playerid = -1);
native CreateDynamicRectangle(Float:minx, Float:miny, Float:maxx, Float:maxy, worldid = -1, interiorid = -1, playerid = -1);
native CreateDynamicSphere(Float:x, Float:y, Float:z, Float:size, worldid = -1, interiorid = -1, playerid = -1);
native CreateDynamicCube(Float:minx, Float:miny, Float:minz, Float:maxx, Float:maxy, Float:maxz, worldid = -1, interiorid = -1, playerid = -1);
native DestroyDynamicArea(areaid);
native IsValidDynamicArea(areaid);
native TogglePlayerDynamicArea(playerid, areaid, toggle);
native TogglePlayerAllDynamicAreas(playerid, toggle);
native IsPlayerInDynamicArea(playerid, areaid);
native AttachDynamicAreaToPlayer(areaid, playerid);
native AttachDynamicAreaToVehicle(areaid, vehicleid);
native DestroyAllDynamicAreas();
native CountDynamicAreas(); 
Callbacks

Code: Select all

forward OnDynamicObjectMoved(objectid);
forward OnPlayerPickUpDynamicPickup(playerid, pickupid);
forward OnPlayerEnterDynamicCP(playerid, checkpointid);
forward OnPlayerLeaveDynamicCP(playerid, checkpointid);
forward OnPlayerEnterDynamicRaceCP(playerid, checkpointid);
forward OnPlayerLeaveDynamicRaceCP(playerid, checkpointid);
forward OnPlayerEnterDynamicArea(playerid, areaid);
forward OnPlayerLeaveDynamicArea(playerid, areaid); 
Definitions

Code: Select all

#define STREAMER_TYPE_OBJECT (0)
#define STREAMER_TYPE_PICKUP (1)
#define STREAMER_TYPE_CP (2)
#define STREAMER_TYPE_RACE_CP (3)
#define STREAMER_TYPE_MAP_ICON (4)
#define STREAMER_TYPE_3D_TEXT_LABEL (5)
#define STREAMER_TYPE_AREA (6)   
Enumerator

Code: Select all

enum
{
    E_STREAMER_ATTACHED_PLAYER,
    E_STREAMER_ATTACHED_VEHICLE,
    E_STREAMER_COLOR,
    E_STREAMER_DISTANCE,
    E_STREAMER_DRAW_DISTANCE,
    E_STREAMER_EXTRA_ID,
    E_STREAMER_INTERIOR_ID,
    E_STREAMER_MAX_X,
    E_STREAMER_MAX_Y,
    E_STREAMER_MAX_Z,
    E_STREAMER_MIN_X,
    E_STREAMER_MIN_Y,
    E_STREAMER_MIN_Z,
    E_STREAMER_MODEL_ID,
    E_STREAMER_MOVE_SPEED,
    E_STREAMER_MOVE_X,
    E_STREAMER_MOVE_Y,
    E_STREAMER_MOVE_Z,
    E_STREAMER_NEXT_X,
    E_STREAMER_NEXT_Y,
    E_STREAMER_NEXT_Z,
    E_STREAMER_PLAYER_ID,
    E_STREAMER_R_X,
    E_STREAMER_R_Y,
    E_STREAMER_R_Z,
    E_STREAMER_SIZE,
    E_STREAMER_STYLE,
    E_STREAMER_TEST_LOS,
    E_STREAMER_TYPE,
    E_STREAMER_WORLD_ID,
    E_STREAMER_X,
    E_STREAMER_Y,
    E_STREAMER_Z
} 
Instructions

First, create a folder called plugins in your server directory if it doesn't already exist. Place streamer.dll in it if you're using Windows, or streamer.so if you're using Linux.

Add the following line to server.cfg so that the plugin will load the next time the server starts:

Windows:

Code: Select all

plugins streamer
Linux:

Code: Select all

plugins streamer.so
Next, put this in any filterscript or gamemode (it might be a good idea to put it in your gamemode anyway since filterscripts can sometimes conflict with one another):

Code: Select all

#include <streamer>   
That is it. Now simply add the plugin's natives and callbacks to your script. Be very careful and look at the list above to ensure that you are using them correctly—do not simply rename everything in your script!

General Notes

- Default tickrate: 50
- Default maximum items: none (unlimited)
- Default visible items: 399 (objects); 2048 (pickups); 1024 (3D text labels)
- If -1 is specified for any of the optional parameters (worldid, interiorid, and playerid), the items will be streamed for all virtual worlds, interiors, and/or players.
- The tickrate does not represent any specific measurement of time and varies depending on the server's processing power. If items stream too slowly, lower the tickrate; if CPU usage gets too high, raise the tickrate.
- If some items are not appearing, there may be too many in one area. Limit the streaming distance by editing the last parameter on each native.
- Not all types of items have to be streamed. If the plugin is only used to stream objects, for example, then every other native can be safely ignored.
- Be careful when using streamed items with non-streamed items. Conflicts can sometimes arise.
- Ensure that all scripts are compiled with the latest include file. If the server outputs "Runtime error 19: 'File or function is not found'," then the gamemode is most likely compiled with an include file version that does not match the plugin version.
- Because there are no per-player pickups, a pickup that is streamed for one player will be visible for all other players as well, provided that those players are all in the same virtual world. Additionally, because of the virtual world parameter on the default CreatePickup native, it is only possible to assign one virtual world per streamed pickup.
- A maximum of 500 player IDs (0-499) and 20 interior IDs (0-19) can be assigned per item.

Native Notes

- Use Streamer_UpdateEx to preload items before setting a player's position or to stream items under OnPlayerRequestClass.
- Use the data manipulation natives like this (note the use of the defines and the enum above):

Code: Select all

Streamer_SetIntData(STREAMER_TYPE_OBJECT, gObject, E_STREAMER_MODEL_ID, 1225); 
- To adjust an object's draw distance (added in SA-MP 0.3b), use Streamer_SetFloatData with E_STREAMER_DRAW_DISTANCE. The maximum draw distance for non-LOD objects is 300.0, and each object's default draw distance is 0.0.
- To adjust a map icon's style (added in SA-MP 0.3c), use Streamer_SetIntData with E_STREAMER_STYLE. Valid styles range from 0 to 3, and each map icon's default style is 0.
- Use Streamer_AppendArrayData and Streamer_RemoveArrayData to add and remove virtual worlds, interiors, and players to and from items. Here is an example:

Code: Select all

Streamer_AppendArrayData(STREAMER_TYPE_OBJECT, gObject, E_STREAMER_PLAYER_ID, playerid); 
- Only circles and spheres may be used with AttachDynamicAreaToPlayer and AttachDynamicAreaToVehicle.

Grid Notes

- Use Streamer_CellDistance to adjust the area around which the plugin checks for nearby cells. Use Streamer_CellSize to adjust the size of each cell (these natives rebuild the grid, so use them only when necessary).
- An optimal cell distance is automatically calculated whenever Streamer_CellSize is used. The formula for the cell distance is simply 1.5 times the cell size. If you wish to specify your own cell distance, use Streamer_CellDistance immediately afterward.
- The default cell size is 300.0, and the default cell distance is 450.0. (Note that the cell distance is calculated using the same formula above.)
- There is a global cell that contains all items with streaming distances greater than the current cell distance. This is to ensure that items which need to be visible from any point on the map (map icons, for example) are not bound to any cell that is too far away from the player. It is recommended, however, to limit the number of items in the global cell, because they do not benefit from spatial indexing. The more items in this cell, the less efficient the streaming process will become, so only put items here which need to be visible from very far away. (For instance, a checkpoint with a streaming distance of 1000.0 while the current cell distance is 450.0 will be put in the global cell.)


Download
Server Plugin (Windows and Linux) (Mirror)
Source Code(Cross-Compatible) (Mirror)
Vrei un host de calitate si serios pentru serverul tau?
VEZI SERVERE HOSTATE LA NOI : http://www.zonek.ro/index.php?option=com_lgsl&Itemid=5
0763.55.9997 Comanda ACUMA OFERTA LIMITATA
Y: zonek_telecom | http://www.zonek.ro
- Nu te baga in pat nervos, stai treaz si "lupta". http://forum.zonek.ro inscrie-te si vezi cum se manifesta...
- Pentru schimb de Linkuri Intra AICi : linkex
Image
- Pentru cereri de Parteneriate prin Bannere Intra AICI
Image
Image
Post Reply

Return to “Plugins”