SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Closed Thread
Thread Tools Display Modes
Old 02/08/2014, 06:03 AM   #1
Huge Clucker
Swimor's Avatar
Join Date: Nov 2011
Location: Israel, IL, ISR
Posts: 257
Reputation: 42
Default Streamer Plugin v2.7.2 with vehicle streamer

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:

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.


The commit history can be found here.





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);

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);

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);

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

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

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

pawn Code:
#include <streamer>

Recompile the scripts with any desired natives and callbacks provided by the include file. Start the server.
General Notes

  • 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

  • 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 Code:
    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 Code:
    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

  • 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.

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).

Incognito - The original streamer
kurta999 - The idea and the base of the vehicle streamer
Me - Adding the vehicle streaming
Best regards, ZIlberman Rafael.

Last edited by Swimor; 03/08/2014 at 03:58 PM.
Swimor is offline  
Old 02/08/2014, 06:16 AM   #2
Big Clucker
iSkate's Avatar
Join Date: Jul 2013
Posts: 152
Reputation: 16
Default Re: Streamer Plugin v2.7.2 with vehicle streamer

Wow. Nice job.s

iSkate is offline  
Old 02/08/2014, 07:03 AM   #3
JustBored's Avatar
Join Date: Jan 2013
Location: Buenos Aires - Argentina
Posts: 1,150
Reputation: 134
Default Respuesta: Streamer Plugin v2.7.2 with vehicle streamer

Nice job
"Compiler - A program designed to tell you how wrong you are. It's a great way to induce stress and frustration."

JustBored is offline  
Old 02/08/2014, 07:15 AM   #4
Huge Clucker
MugiwaraNoLuffy's Avatar
Join Date: Oct 2013
Posts: 254
Reputation: 40
Default Respuesta: Streamer Plugin v2.7.2 with vehicle streamer

MugiwaraNoLuffy is offline  
Old 02/08/2014, 07:22 AM   #5
Big Clucker
TazmaNiax's Avatar
Join Date: Apr 2014
Location: Indonesia
Posts: 134
Reputation: 8
Default Re: Streamer Plugin v2.7.2 with vehicle streamer

Very Nicely
TazmaNiax is offline  
Old 02/08/2014, 07:34 AM   #6
Don_Cage's Avatar
Join Date: Aug 2012
Posts: 1,072
Reputation: 40
Default Re: Streamer Plugin v2.7.2 with vehicle streamer

Good work, it was needed
Don_Cage is offline  
Old 02/08/2014, 07:37 AM   #7
Little Clucker
DoflamingoValentin's Avatar
Join Date: Jul 2014
Posts: 8
Reputation: 0
Default Re: Streamer Plugin v2.7.2 with vehicle streamer

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
DoflamingoValentin is offline  
Old 02/08/2014, 07:41 AM   #8
Huge Clucker
Swimor's Avatar
Join Date: Nov 2011
Location: Israel, IL, ISR
Posts: 257
Reputation: 42
Default Re: Streamer Plugin v2.7.2 with vehicle streamer

Originally Posted by DoflamingoValentin View Post
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.
Best regards, ZIlberman Rafael.
Swimor is offline  
Old 02/08/2014, 07:44 AM   #9
IstuntmanI's Avatar
Join Date: Mar 2009
Location: Romania
Posts: 1,801
Reputation: 375
Default Re: Streamer Plugin v2.7.2 with vehicle streamer

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 Code:
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 Code:
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:
pawn Code:
forward OnPlayerShotDynamicVehicle(playerid, vehicleid, weaponid, Float:fX, Float:fY, Float:fZ);

And these (are even possible some of them ?):
pawn Code:
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 Code:
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.

IstuntmanI is offline  
Old 02/08/2014, 07:52 AM   #10
Huge Clucker
AiRaLoKa's Avatar
Join Date: Aug 2013
Location: Indonesia! Nickname: [MP]AiRa_
Posts: 400
Reputation: 27
Default Re: Streamer Plugin v2.7.2 with vehicle streamer

is it only vehicle streamer plugins?

anyway, great job. this was i looking for
sorry for my fucking bad english... becouse i'm Indonesian!
~~> Find all threads started by AiRaLoKa <~~

AiRaLoKa is offline  
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Include] Checkpoint / Area sub-streamer for incognito's streamer plugin Pottus Includes 9 21/03/2014 06:31 PM
[Ajuda] Plugin Streamer vitere PortuguÍs/Portuguese 2 03/05/2013 11:39 PM
Need 3dtextlabel Streamer And Gangzone Streamer !! Please Help . Not streamer plugin . jame42 Scripting Help 4 30/05/2012 07:33 AM
Streamer plugin 0.3d rt-2 Plugin Development 7 05/12/2011 06:17 PM

All times are GMT. The time now is 08:01 AM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.