05.12.2009, 16:43
[FS] SuperStream
PresentationHi everyone, here's my streamer, i called it SuperStream (presumptuous i know...)
Function
This streamer shows the nearest objects to the player, the maximum distance is set to 350m, you can adjust it to your needs.
The distances of the selected objects (those nearer than 350m) are sorted with a function based on ******'s QuickSort function.
Note: This streamer doesn't take any distance parameter exept the maximum distance, this is a constant for speed and objects with distance over this are not sorted.
Improvements
You can get a better streaming by using the function StreamPlayer, you can decide the position to stream so you can stream objects for the players before they are in a place, it may be very useful for teleports.
Also, it is checking if the player is too far from last stream with OnPlayerUpdate to prevent lack of objects.
Installation
1. Place the filterscript in your filterscript folder
2. Add SuperStream to your filterscript line in server.cfg
3. Open your script containing objects and add #include <SuperStream.inc> to the top
4. Convert your objects to this format:
CreateStreamObject(model, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ);
note. It doesn't take any distance parameter, the format is very similar to MidoStream so you can use it to convert and remove distance. But, the best way to convert is probably using the CreateObject format and using CTRL+H and simply replace CreateObject by CreateStreamObject
Parameters
Parameters can be found between line 15 and line 27. Here's a short list of them:
- MAX_PLAYERS : guess..
- TIME_GRANULITY : If GetTickCount isn't working, i "fake" it with a timer, this is the timer delai, 50 is enough as there's no need to be very accurate.
- MOVEMENT_UPDATE: Time between object positions update when they are moving
- STREAMING_DELAY : Time of the main timer
- VIEWED_OBJECTS: maximum amount of objects seens by a player at the same time
- MAX_STREAM_OBJECTS : limit of objects
- MAX_STREAM_DISTANCE : Maximum distance, objects too far from players are skipped
Download:
Solidfiles - v1.1.2 :
Pastebin - v1.1.2
[FS] SuperStream.pwn
[INC] SuperStream.inc
Log:
V1.0 : original release
V1.1 : - Bug fixe with MoveStreamObject
- added the callback OnStreamObjectMoved
- streaming adjustment
V1.1.1 : minor bug fix
V1.1.2 : constant typo fix (thanks Double-O-Seven)
Comments are appreciated