[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
#2

Wow. Nice job.s
Reply
#3

Nice job
Reply
#4

Awesome!
Reply
#5

Very Nicely
Reply
#6

Good work, it was needed
Reply
#7

Can you please on the next update do something like these:


- CreateCheckpoint(checkpointid, x , y ,z etc!


It would be so nice to be able to create checkpoints with id
Reply
#8

Quote:
Originally Posted by DoflamingoValentin
Посмотреть сообщение
Can you please on the next update do something like these:


- CreateCheckpoint(checkpointid, x , y ,z etc!


It would be so nice to be able to create checkpoints with id
Technicaly I can, but it not function repeated to vehicles to I can't release it with this streamer.

If you want I will do it and send it to you in private message or you can ask for this on the original streamer plugin and I will try to talk with incognito and add it to the original streamer.
Reply
#9

Great job ! I hope it will be merged with the original streamer plugin, if everything is ok. Thanks for your work !

I have a have few suggestions:
pawn Код:
native GetDynamicVehicleZAngle(vehicleid, &Float:x, &Float:y, &Float:z);
native SetDynamicVehicleZAngle(vehicleid, Float:x, Float:y, Float:z);
native GetDynamicVehicleZAngle(vehicleid, &Float:angle);
native SetDynamicVehicleZAngle(vehicleid, Float:angle);
should be
pawn Код:
native GetDynamicVehiclePos(vehicleid, &Float:w, &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);
Also, you forgot one thing, you should add it in the plugin:
https://sampwiki.blast.hk/wiki/OnPlayerWeaponShot
pawn Код:
forward OnPlayerShotDynamicVehicle(playerid, vehicleid, weaponid, Float:fX, Float:fY, Float:fZ);
And these (are even possible some of them ?):
pawn Код:
native SetDynamicVehicleAngularVelocity(vehicleid, Float:X, Float:Y, Float:Z);
native AttachTrailerToDynamicVehicle(trailerid, vehicleid );
native AttachDynamicTrailerToVehicle(trailerid, vehicleid );
native AttachDynamicTrailerToDynamicVehicle(trailerid, vehicleid );
native DetachTrailerFromDynamicVehicle(vehicleid);
native IsTrailerAttachedToDynamicVehicle(vehicleid);
native GetDynamicVehicleTrailer(vehicleid); // but normal vehicles are also possible to be attached to streamed vehicles, it's a bit complicated there
native GetDynamicVehicleRotationQuat(vehicleid, &Float:w, &Float:x, &Float:y, &Float:z);
Also, I know that these are perfectly scriptable, but they are needed as default:
pawn Код:
native SetDynamicVehicleVirtualWorld(vehicleid, worldid);
native GetDynamicVehicleVirtualWorld(vehicleid);
native SetDynamicVehicleInterior(vehicleid, interiorid);
native GetDynamicVehicleInterior(vehicleid);
native GetDynamicVehicleFirstColor(vehicleid); // returns color1
native GetDynamicVehicleSecondColor(vehicleid); // returns color2
native IsDynamicVehicleStreamedIn(vehicleid); // returns 1 if it is streamed for a player
I hope that the next SA:MP version will bring us a SetVehicleRotationQuat, because I think you can't make it.
Reply
#10

is it only vehicle streamer plugins?

anyway, great job. this was i looking for
Reply
#11

Quote:
Originally Posted by IstuntmanI
Посмотреть сообщение
Great job ! I hope it will be merged with the original streamer plugin, if everything is ok. Thanks for your work !

I have a have few suggestions:
pawn Код:
native GetDynamicVehicleZAngle(vehicleid, &Float:x, &Float:y, &Float:z);
native SetDynamicVehicleZAngle(vehicleid, Float:x, Float:y, Float:z);
native GetDynamicVehicleZAngle(vehicleid, &Float:angle);
native SetDynamicVehicleZAngle(vehicleid, Float:angle);
should be
pawn Код:
native GetDynamicVehiclePos(vehicleid, &Float:w, &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);
-- I think that I make mistake with the native names, I will check it soon. Also I will add GetVehicleRotationQuat and I will try to add SetVehicleRotationQuat.

Also, you forgot one thing, you should add it in the plugin:
https://sampwiki.blast.hk/wiki/OnPlayerWeaponShot
pawn Код:
forward OnPlayerShotDynamicVehicle(playerid, vehicleid, weaponid, Float:fX, Float:fY, Float:fZ);
-- Will be added in the next version.

And these (are even possible some of them ?):
pawn Код:
native SetDynamicVehicleAngularVelocity(vehicleid, Float:X, Float:Y, Float:Z);
native AttachTrailerToVehicle(trailerid, vehicleid, trailertype = STREAMER_VEHICLE_TYPE_DYNAMIC, vehicletype = STREAMER_VEHICLE_TYPE_DYNAMIC ); // add another enum like the one in which is STREAMER_OBJECT_TYPE_DYNAMIC
native DetachTrailerFromVehicle(vehicleid);
native IsTrailerAttachedToVehicle(vehicleid);
native GetVehicleTrailer(vehicleid);
native GetDynamicVehicleRotationQuat(vehicleid, &Float:w, &Float:x, &Float:y, &Float:z);
-- Yes, it will be done.

Also, I know that these are perfectly scriptable, but they are needed as default:
pawn Код:
native SetDynamicVehicleVirtualWorld(vehicleid, worldid);
native GetDynamicVehicleVirtualWorld(vehicleid);
native SetDynamicVehicleInterior(vehicleid, interiorid);
native GetDynamicVehicleInterior(vehicleid);
native GetDynamicVehicleFirstColor(vehicleid); // returns color1
native GetDynamicVehicleSecondColor(vehicleid); // returns color2
native IsDynamicVehicleStreamedIn(vehicleid); // returns 1 if it is streamed for a player
-- you right I forgot those natives, I will add them too.

I hope that the next SA:MP version will bring us a SetVehicleRotationQuat, because I think you can't make it.
I edited the quote.
Thank you very much for the suggestions

Quote:
Originally Posted by AiRaLoKa
Посмотреть сообщение
is it only vehicle streamer plugins?

anyway, great job. this was i looking for
That not only vehicle streamer, it also includes all the incognito's streamer natives, callbacks, ...
Reply
#12

You are welcome, we all need this. At least, I always wanted a vehicle streamer in the streamer plugin. (if this will get implemented, I guess it can be v2.8 or even v3.0)

We already have in the streamer plugin this:
pawn Код:
native AttachDynamicAreaToVehicle(areaid, vehicleid);
but I guess you should change it to
pawn Код:
native AttachDynamicAreaToVehicle(areaid, vehicleid, type = STREAMER_VEHICLE_TYPE_DYNAMIC, playerid = INVALID_PLAYER_ID);
and add to the top:
pawn Код:
#define STREAMER_VEHICLE_TYPE_GLOBAL (0)
#define STREAMER_VEHICLE_TYPE_DYNAMIC (1)
Oh, I have a question: Are the dynamic vehicles streamed AFTER the dynamic objects ?
Reply
#13

Quote:
Originally Posted by Swimor
Посмотреть сообщение
[...]
That not only vehicle streamer, it also includes all the incognito's streamer natives, callbacks, ...
but what if icognito update the streamer? we still have to wait your update again?
Reply
#14

Quote:
Originally Posted by AiRaLoKa
Посмотреть сообщение
but what if icognito update the streamer? we still have to wait your update again?
I can try to ask incognito to merge my changes into his plugin.
If not, You will need to wait until I will re-compile this plugin with the necessary changes.
Or I can remove incognito's streamer natives and callbacks but then there will be two timers, and you will need to use two plugins instead of one and there will be conflicts when you will try to attach object / 3dtext to vehicle.

Quote:
Originally Posted by IstuntmanI
Посмотреть сообщение
You are welcome, we all need this. At least, I always wanted a vehicle streamer in the streamer plugin. (if this will get implemented, I guess it can be v2.8 or even v3.0)

We already have in the streamer plugin this:
pawn Код:
native AttachDynamicAreaToVehicle(areaid, vehicleid);
but I guess you should change it to
pawn Код:
native AttachDynamicAreaToVehicle(areaid, vehicleid, type = STREAMER_VEHICLE_TYPE_DYNAMIC, playerid = INVALID_PLAYER_ID);
and add to the top:
pawn Код:
#define STREAMER_VEHICLE_TYPE_GLOBAL (0)
#define STREAMER_VEHICLE_TYPE_DYNAMIC (1)
Oh, I have a question: Are the dynamic vehicles streamed AFTER the dynamic objects ?
I will add this soon.

Yes the vehicles are streamed after objects.
Reply
#15

i saw this streamer from maddinat0r on github its very good to.

nice work.
Reply
#16

Quote:
Originally Posted by Swimor
Посмотреть сообщение
I can try to ask incognito to merge my changes into his plugin.
If not, You will need to wait until I will re-compile this plugin with the necessary changes.
Or I can remove incognito's streamer natives and callbacks but then there will be two timers, and you will need to use two plugins instead of one and there will be conflicts when you will try to attach object / 3dtext to vehicle.
okay... better waiting than having a big problem.

Quote:
Originally Posted by Swimor
Посмотреть сообщение
Yes the vehicles are streamed after objects.
nice, my vehicle will never drowned anymore...
Reply
#17

Quote:
Originally Posted by PT
Посмотреть сообщение
i saw this streamer from maddinat0r on github its very good to.

nice work.
I know about this plugin but as I said, the incognito's streamer functions that attaching objects to vehicle will conflict with this streamer. In this plugin it will e fixed and you can attach streamer object to streamer vehicle.

Quote:
Originally Posted by AiRaLoKa
Посмотреть сообщение
okay... better waiting than having a big problem.
I subscribed to incognito's project so every commit I getting an notification, therefore I will update this plugin as fast as I can.
Reply
#18

btw, are the download page that you gave is correct? i didn't saw anything different with the original ones...
Reply
#19

Quote:
Originally Posted by AiRaLoKa
Посмотреть сообщение
btw, are the download page that you gave is correct? i didn't saw anything different with the original ones...
Fixed.
Reply
#20

for windows only? no linux version?
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)