[Plugin] Streamer Plugin v2.7.2 with vehicle streamer
#1

Streamer Plugin v2.7.2 with vehicle streamer

This is beta version, also there are massive rewrite of the whole plugin that I am planning to do soon. Stay updated.

Original Incognito's streamer: https://sampforum.blast.hk/showthread.php?tid=102865

This plugin is Incognito's streamer plugin with vehicle streaming option. This plugin is updated to sampgdk 4 and not using pawn callback hooking anymore.

All the definitions / natives / enumerators / callbacks that listed in this thread are in addition to the originals (that can be found in the original thread).

If there are function releated to vehicles that not included yet, send me private message and I will include the function in the next release.

If you found bugs or you have an suggestions, post it in this thread.

Changelog

The commit history can be found here.

Definitions

Код:
#define STREAMER_TYPE_VEHICLE (7)

#define STREAMER_VEHICLE_TYPE_GLOBAL (0)
#define STREAMER_VEHICLE_TYPE_DYNAMIC (1)
Enumerator

Код:
enum
{
	E_STREAMER_ANGLE,
	E_STREAMER_RESPAWN_DELAY
}
Natives

Vehicles:
Код:
native CreateDynamicVehicle(modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay = 60, Float:streamdistance = 100.0);
native DestroyDynamicVehicle(vehicleid);
native IsValidDynamicVehicle(vehicleid);
native IsDynamicVehicleStreamedIn(vehicleid); // New
native GetDynamicVehicleModel(vehicleid);
native GetDynamicVehiclePos(vehicleid, &Float:x, &Float:y, &Float:z);
native SetDynamicVehiclePos(vehicleid, Float:x, Float:y, Float:z);
native GetDynamicVehicleZAngle(vehicleid, &Float:angle);
native SetDynamicVehicleZAngle(vehicleid, Float:angle);
native GetDynamicVehicleDistanceFromPoint(vehicleid, &Float:x, &Float:y, &Float:z);
native GetDynamicVehicleVelocity(vehicleid, &Float:x, &Float:y, &Float:z); // New
native SetDynamicVehicleVelocity(vehicleid, Float:x, Float:y, Float:z); // New
native SetDynamicVehicleAngularVelocity(vehicleid, Float:x, Float:y, Float:z); // New
native GetDynamicVehicleVirtualWorld(vehicleid); // New
native SetDynamicVehicleVirtualWorld(vehicleid, worldid); // New
native GetDynamicVehicleInterior(vehicleid); // New
native SetDynamicVehicleInterior(vehicleid, interiorid); // New
native SetDynamicVehicleColor(vehicleid, color1, color2);
native GetDynamicVehicleColor(vehicleid, &color1, &color2);
native SetDynamicVehiclePaintjob(vehicleid, paintjobid);
native GetDynamicVehiclePaintjob(vehicleid, &paintjobid);
native SetDynamicVehicleNumberPlate(vehicleid, numberplate[]);
native GetDynamicVehicleNumberPlate(vehicleid, numberplate[], length = sizeof numberplate);
native SetDynamicVehicleToRespawn(vehicleid);
native AddDynamicVehicleComponent(vehicleid, componentid);
native RemoveDynamicVehicleComponent(vehicleid, componentid);
native GetDynamicVehicleComponentInSlot(vehicleid, slot);
native GetDynamicVehicleHealth(vehicleid, &Float:health);
native SetDynamicVehicleHealth(vehicleid, Float:health);
native GetDynamicVehicleDamageStatus(vehicleid, &panels, &doors, &lights, &tires);
native SetDynamicVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
native GetPlayerDynamicVehicleID(playerid);
native PutPlayerInDynamicVehicle(playerid, vehicleid, seatid);
Callbacks

Код:
forward OnDynamicVehicleSpawn(vehicleid);
forward OnDynamicVehicleDeath(vehicleid, killerid);
forward OnPlayerEnterDynamicVehicle(playerid, vehicleid, ispassenger);
forward OnPlayerExitDynamicVehicle(playerid, vehicleid);
forward OnDynamicVehicleMod(playerid, vehicleid, component);
forward OnDynamicVehiclePaintjob(playerid, vehicleid, paintjob);
forward OnDynamicVehicleRespray(playerid, vehicleid, color1, color2);
forward OnDynamicVehicleDamageStatusUpdate(vehicleid, playerid);
Objects:

Код:
native AttachDynamicObjectToVehicle(objectid, vehicleid, Float:offsetx, Float:offsety, Float:offsetz, Float:rx, Float:ry, Float:rz, vehicletype = STREAMER_VEHICLE_TYPE_DYNAMIC);
3D Text Labels:

Код:
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:streamdistance = 100.0, vehicletype = STREAMER_VEHICLE_TYPE_DYNAMIC);
Instructions

Quote:

Create a directory called "plugins" inside of the server directory if one does not already exist. Place the plugin file (streamer.dll or streamer.so) inside of this directory.

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

Windows:
Код:
plugins streamer.dll
Linux:
Код:
plugins streamer.so
On Windows, add streamer.inc to the pawno\include folder. Include this file in any of the scripts the server is running:

pawn Код:
#include <streamer>
Recompile the scripts with any desired natives and callbacks provided by the include file. Start the server.

General Notes

Quote:
  • Default tick rate: 50
  • Default maximum items: none (unlimited)
  • Default visible items: 500 (objects); 4096 (pickups); 1024 (3D text labels)
  • If -1 is specified for any of the optional parameters (worldid, interiorid, or playerid), then the items will be streamed for all virtual worlds, interiors, or players.
  • 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.
  • If some items are not appearing, there may be too many in one area. Lower the streaming distance by decreasing the "streamdistance" 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.
  • 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.
  • A maximum of 1000 player IDs (0-999) can be assigned per item.
  • The maximum amount of visible objects may be increased to 999 as of SA-MP 0.3d, though it is not recommended for all of these objects to be in one area due to game engine limits. By default, the number of visible objects is set to 500 to avoid conflicts.
  • Ensure that all scripts are compiled with the latest include file.
Native Notes

Quote:
  • Use Streamer_UpdateEx to preload items before setting a player's position or to stream items under OnPlayerRequestClass.
  • Virtual worlds, interiors, and players can be modified or read through the array data manipulation natives (Streamer_GetArrayData and Streamer_SetArrayData, for example).
  • Here is an example of using the data manipulation natives (note the use of the definitions and the enumerator above):

    pawn Код:
    Streamer_SetIntData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_MODEL_ID, 1225);
  • Here is another example for data stored as arrays (virtual worlds, interiors, and players):

    pawn Код:
    Streamer_AppendArrayData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_PLAYER_ID, playerid);
  • To adjust an object's draw distance (added in SA-MP 0.3b), use Streamer_SetFloatData with E_STREAMER_DRAW_DISTANCE. Alternatively, use CreateDynamicObject(Ex). An object's default draw distance can be set by specifying 0.0.
  • To adjust a map icon's style (added in SA-MP 0.3c), use Streamer_SetIntData with E_STREAMER_STYLE. Alternatively, use CreateDynamicMapIcon(Ex). Valid styles range from 0 to 3, and each map icon's default style is 0.
  • Only circles and spheres may be used with the attach area natives.
  • The points in CreateDynamicPolygon and CreateDynamicPolygonEx need to be specified as a sequence of ordered pairs (x1, y1, x2, y2, ..., xn, yn). The number of elements in the array must be divisible by two for this reason. The first point must also be equal to the last point to form a closed path.
  • The number configurable in Streamer_CellDistance 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.
  • The number configurable in Streamer_CellSize is used to determine the size of each cell in the grid. The default value is 300.0.
  • Note that Streamer_CellDistance and Streamer_CellSize rebuild the grid each time they are called, so use them only when necessary. The default values are also considered optimal, so in most cases, it is recommended to simply leave these natives alone unless a specific need arises.
  • Items can be grouped together using y_groups, which is part of the YSI library.
Performance Notes

Quote:
  • It is not recommended to use a high streaming distance for every item. This can drastically impact performance because it leads to more items being checked on each update. If an item's streaming distance exceeds that of the cell distance (600.0 by default), it also does not benefit from spatial indexing, which can lead to even worse performance. Only set high streaming distances for items which need to be visible from very far away (global map icons, for example).
  • Adding too many virtual worlds and interiors to items can lead to increased memory usage and decreased performance. Specifying -1 (all virtual worlds and interiors) actually ensures the best performance, because it eliminates the need to do a lookup when that item is checked on each update. Note that this does not apply to players since only a finite amount can be added.
Download

The latest compiled binaries will always be here:

GitHub Releases Page

The source can be browsed here. This repository can also be cloned.

The Windows version requires the Microsoft .NET Framework 4.0 or higher. If this cannot be installed on the server, place these files in the top directory (alongside samp-server.exe).

Credits
Incognito - The original streamer
kurta999 - The idea and the base of the vehicle streamer
Me - Adding the vehicle streaming
Reply


Messages In This Thread
Streamer Plugin v2.7.2 with vehicle streamer - by Swimor - 02.08.2014, 06:03
Re: Streamer Plugin v2.7.2 with vehicle streamer - by iSkate - 02.08.2014, 06:16
Respuesta: Streamer Plugin v2.7.2 with vehicle streamer - by JustBored - 02.08.2014, 07:03
Respuesta: Streamer Plugin v2.7.2 with vehicle streamer - by MugiwaraNoLuffy - 02.08.2014, 07:15
Re: Streamer Plugin v2.7.2 with vehicle streamer - by TazmaNiax - 02.08.2014, 07:22
Re: Streamer Plugin v2.7.2 with vehicle streamer - by Don_Cage - 02.08.2014, 07:34
Re: Streamer Plugin v2.7.2 with vehicle streamer - by DoflamingoValentin - 02.08.2014, 07:37
Re: Streamer Plugin v2.7.2 with vehicle streamer - by Swimor - 02.08.2014, 07:41
Re: Streamer Plugin v2.7.2 with vehicle streamer - by IstuntmanI - 02.08.2014, 07:44
Re: Streamer Plugin v2.7.2 with vehicle streamer - by AiRaLoKa - 02.08.2014, 07:52
Re: Streamer Plugin v2.7.2 with vehicle streamer - by Swimor - 02.08.2014, 07:53
Re: Streamer Plugin v2.7.2 with vehicle streamer - by IstuntmanI - 02.08.2014, 07:59
Re: Streamer Plugin v2.7.2 with vehicle streamer - by AiRaLoKa - 02.08.2014, 08:02
Re: Streamer Plugin v2.7.2 with vehicle streamer - by Swimor - 02.08.2014, 08:07
Re: Streamer Plugin v2.7.2 with vehicle streamer - by PT - 02.08.2014, 08:11
Re: Streamer Plugin v2.7.2 with vehicle streamer - by AiRaLoKa - 02.08.2014, 08:13
Re: Streamer Plugin v2.7.2 with vehicle streamer - by Swimor - 02.08.2014, 08:13
Re: Streamer Plugin v2.7.2 with vehicle streamer - by AiRaLoKa - 02.08.2014, 08:18
Re: Streamer Plugin v2.7.2 with vehicle streamer - by Swimor - 02.08.2014, 08:21
Re: Streamer Plugin v2.7.2 with vehicle streamer - by AiRaLoKa - 02.08.2014, 08:25
Re: Streamer Plugin v2.7.2 with vehicle streamer - by Swimor - 02.08.2014, 08:35
Re: Streamer Plugin v2.7.2 with vehicle streamer - by AiRaLoKa - 02.08.2014, 08:37
Re: Streamer Plugin v2.7.2 with vehicle streamer - by Swimor - 02.08.2014, 08:57
Re: Streamer Plugin v2.7.2 with vehicle streamer - by AiRaLoKa - 02.08.2014, 11:10
Re: Streamer Plugin v2.7.2 with vehicle streamer - by iZN - 02.08.2014, 11:24
Re: Streamer Plugin v2.7.2 with vehicle streamer - by Firewire - 02.08.2014, 12:54
Re: Streamer Plugin v2.7.2 with vehicle streamer - by Swimor - 02.08.2014, 14:02
Re: Streamer Plugin v2.7.2 with vehicle streamer - by kurta999 - 02.08.2014, 15:57
Re: Streamer Plugin v2.7.2 with vehicle streamer - by IstuntmanI - 02.08.2014, 16:38
Re: Streamer Plugin v2.7.2 with vehicle streamer - by Swimor - 02.08.2014, 16:44
Re: Streamer Plugin v2.7.2 with vehicle streamer - by IstuntmanI - 02.08.2014, 16:49
Re: Streamer Plugin v2.7.2 with vehicle streamer - by kurta999 - 02.08.2014, 17:36
Re: Streamer Plugin v2.7.2 with vehicle streamer - by Swimor - 02.08.2014, 17:38
Re: Streamer Plugin v2.7.2 with vehicle streamer - by IstuntmanI - 02.08.2014, 20:27
Re: Streamer Plugin v2.7.2 with vehicle streamer - by N.K.Stallone - 02.08.2014, 21:30
Re: Streamer Plugin v2.7.2 with vehicle streamer - by AiRaLoKa - 02.08.2014, 22:23
Re: Streamer Plugin v2.7.2 with vehicle streamer - by IstuntmanI - 02.08.2014, 23:50
Re: Streamer Plugin v2.7.2 with vehicle streamer - by AiRaLoKa - 02.08.2014, 23:54
Re: Streamer Plugin v2.7.2 with vehicle streamer - by kurta999 - 03.08.2014, 00:06
Re: Streamer Plugin v2.7.2 with vehicle streamer - by Swimor - 03.08.2014, 05:07
Re: Streamer Plugin v2.7.2 with vehicle streamer - by CoaPsyFactor - 03.08.2014, 17:40
Re: Streamer Plugin v2.7.2 with vehicle streamer - by Swimor - 03.08.2014, 17:54
Re: Streamer Plugin v2.7.2 with vehicle streamer - by Kar - 03.08.2014, 18:29
Re: Streamer Plugin v2.7.2 with vehicle streamer - by Swimor - 03.08.2014, 19:07
Re: Streamer Plugin v2.7.2 with vehicle streamer - by CoaPsyFactor - 03.08.2014, 22:28
Re: Streamer Plugin v2.7.2 with vehicle streamer - by kurta999 - 04.08.2014, 00:12
Re: Streamer Plugin v2.7.2 with vehicle streamer - by Swimor - 04.08.2014, 05:50
Re: Streamer Plugin v2.7.2 with vehicle streamer - by iFarbod - 04.08.2014, 07:27
Re: Streamer Plugin v2.7.2 with vehicle streamer - by Swimor - 04.08.2014, 07:34
Re: Streamer Plugin v2.7.2 with vehicle streamer - by d711728 - 04.08.2014, 10:56
Re: Streamer Plugin v2.7.2 with vehicle streamer - by Swimor - 04.08.2014, 12:14
Re: Streamer Plugin v2.7.2 with vehicle streamer - by d711728 - 04.08.2014, 13:39
Respuesta: Streamer Plugin v2.7.2 with vehicle streamer - by The-Krew - 05.08.2014, 02:33
Re: Respuesta: Streamer Plugin v2.7.2 with vehicle streamer - by kadaradam - 05.08.2014, 06:37
Re: Streamer Plugin v2.7.2 with vehicle streamer - by Swimor - 05.08.2014, 07:50
Re: Streamer Plugin v2.7.2 with vehicle streamer - by d711728 - 05.08.2014, 11:57
Re: Streamer Plugin v2.7.2 with vehicle streamer - by AiRaLoKa - 05.08.2014, 12:25
Re: Streamer Plugin v2.7.2 with vehicle streamer - by Swimor - 05.08.2014, 12:55
Re: Streamer Plugin v2.7.2 with vehicle streamer - by Incognito - 05.08.2014, 22:00
Re: Streamer Plugin v2.7.2 with vehicle streamer - by CoaPsyFactor - 05.08.2014, 23:03
Re: Streamer Plugin v2.7.2 with vehicle streamer - by Swimor - 06.08.2014, 06:26
Re: Streamer Plugin v2.7.2 with vehicle streamer - by CoaPsyFactor - 06.08.2014, 12:58
Re: Streamer Plugin v2.7.2 with vehicle streamer - by anou1 - 06.08.2014, 13:21
Re: Streamer Plugin v2.7.2 with vehicle streamer - by iFarbod - 07.08.2014, 08:46
Re: Streamer Plugin v2.7.2 with vehicle streamer - by CoaPsyFactor - 07.08.2014, 09:29
Re: Streamer Plugin v2.7.2 with vehicle streamer - by Swimor - 07.08.2014, 15:21
Re: Streamer Plugin v2.7.2 with vehicle streamer - by iFarbod - 07.08.2014, 15:51
Re: Streamer Plugin v2.7.2 with vehicle streamer - by DiDok - 07.08.2014, 15:58
Re: Streamer Plugin v2.7.2 with vehicle streamer - by CoaPsyFactor - 07.08.2014, 17:21
Re: Streamer Plugin v2.7.2 with vehicle streamer - by d711728 - 11.08.2014, 12:59

Forum Jump:


Users browsing this thread: 1 Guest(s)