[Plugin] Streamer Plugin

ur fix worked ty

only a few warnings:

warning 213: tag mismatch

at:

calentry = CreateDynamicCP(2196.2510,1677.2078,12.3672,1,-1,-1,100.0);
calexit = CreateDynamicCP(2233.9316,1714.6794,1012.3828,1,-1,100.0);
pdentry = CreateDynamicCP(2290.1140,2431.4399,10.8203,1,-1,-1,100.0);
pdexit = CreateDynamicCP(2290.1140,2431.4399,10.8203,1,-1,-1,100.0);

and:

warning 235: public function lacks forward declaration (symbol "OnPlayerEnterDynamicCheckpoint")
Reply

Edit: Nevermind.
Reply

One suggestion: give for objects/pickups and etc getpos like getpos(type, ID, X, Y, Z) where type OBJECT or PICKUP or 3DTEXT etc.
Reply

If you are going to add those GetElement functions, I also suggest you to add SetElement functions.

Код:
SetElementFloatData(elementtype,elementid,datatype[],Float:value);
SetElementIntegerData(elementtype,elementid,datatype[],value);
With those functions we would be able to manage single element values without deleting and recreating them completly.
Reply

Okay, it's done:

Quote:

v2.3.5:
- Added data manipulation natives: Streamer_GetFloatData, Streamer_GetIntData, Streamer_SetFloatData, and Streamer_SetIntData

I used an enum for the data rather than a string (as ****** suggested), so the new natives are very fast and easy to use. This is all in the include file, but I'll just post it here for reference:

pawn Код:
#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)
pawn Код:
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_MARKER_TYPE,
    E_STREAMER_MODEL_ID,
    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_SPEED,
    E_STREAMER_TEST_LOS,
    E_STREAMER_TYPE,
    E_STREAMER_WORLD_ID,
    E_STREAMER_X,
    E_STREAMER_Y,
    E_STREAMER_Z
}
You can use it like this:

pawn Код:
new
    Float:x,
    Float:y,
    Float:z;
Streamer_GetFloatData(STREAMER_TYPE_PICKUP, gPickup, E_STREAMER_X, x);
Streamer_GetFloatData(STREAMER_TYPE_PICKUP, gPickup, E_STREAMER_Y, y);
Streamer_GetFloatData(STREAMER_TYPE_PICKUP, gPickup, E_STREAMER_Z, z);
That will retrieve gPickup's current position from the plugin.

Here's another example from the first page:

pawn Код:
Streamer_SetIntData(STREAMER_TYPE_OBJECT, gObject, E_STREAMER_MODEL_ID, 1225);
Reply

Awesome! Thanks a lot.
Reply

Yeah, that's great. Thanks!
Reply

how to rev up drawing? And there is teleport from large distance and an object was not drawn and then fall through an object. objects are drawn slowly.
Reply

Quote:
Originally Posted by gringoo
how to rev up drawing? And there is teleport from large distance and an object was not drawn and then fall through an object. objects are drawn slowly.
Streamer_UpdateEx before teleporting.
Reply

Quote:
Originally Posted by ruckfules99
Can someone tell me step by step how to add this to my server ( the checkpoint streamer)
Have you read the first page's "Instructions" section of this topic ?
Add the plugin as it's described there, and then, use only checkpoint's functions if you want to use it only as a checkpoint streamer.
Reply

Quote:
Originally Posted by Sma_X
Quote:
Originally Posted by ruckfules99
Can someone tell me step by step how to add this to my server ( the checkpoint streamer)
Have you read the first page's "Instructions" section of this topic ?
Add the plugin as it's described there, and then, use only checkpoint's functions if you want to use it only as a checkpoint streamer.
I have read the instructions. But this topic is not noob friendly. It does not explain where to put the functions and etc
Reply

It's pretty easy if you know some basic PAWN:

pawn Код:
#include <streamer>

new
    gCheckpoint[2];

public
    OnGameModeInit()
{
    gCheckpoint[0] = CreateDynamicCP(10.0, 10.0, 10.0, 2.5);
    gCheckpoint[1] = CreateDynamicCP(20.0, 20.0, 20.0, 5.0);
}

public
    OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    if (gCheckpoint[0] == checkpointid)
    {
        // ...
    }
    else if (gCheckpoint[1] == checkpointid)
    {
        // ...
    }
}
Reply

Quote:
Originally Posted by Incognito
$ЂЯĢ: You can just use an enum for the extra ID. That's easily scriptable. About forcing updates after setting data, you're right—I really should have added another native that restreams everything for the player so that any changes can be immediately visible. As for your last suggestion, adding those callbacks is very easily done, but putting a lot of code under there could definitely slow down the streaming process. It may or may not be a good idea depending on how it's used.
That's right, but it would be a good thing since in pawn we need to pre-define all the global arrays and that limits us later on.

And switch from example above wouldn't work, since you need to put constant values in cases.
Reply

Right, sorry about that. I'll edit the post to avoid confusion.

I understand what you mean about statically allocating yet more things in your script that could be done dynamically in the plugin, but I think that adding a lot of unnecessary optional parameters will just complicate usage of the natives and callbacks. Also, the PAWN bit is actually not as bad as you might think if you just look at what your code is doing:

pawn Код:
#define MAX_STREAMED_PICKUPS (1024)

enum
    E_PICKUP
{
    E_PICKUP_EXTRA_ID,
    E_PICKUP_REAL_ID
}

new
    gPickups[MAX_STREAMED_PICKUPS][E_PICKUP];
That creates an array 1024*2*4 bytes big (8192 bytes, or 8 KB). Granted, the size of the array would be cut in half if the enum wasn't there, but you aren't wasting any space. There's no performance trade-off in doing this—the only thing that really happens is the size of the .amx increases.

However, this is feasible (I actually didn't think about adding an extra enum value until just now, but it is a much better idea):

pawn Код:
Streamer_SetIntData(STREAMER_TYPE_PICKUP, gPickup, E_STREAMER_EXTRA_ID, 1);
I'll most likely put that in v2.3.6. Thanks for the suggestions.
Reply

Just found a pretty major bug, if you use DestroyDynamicObject inside OnDynamicObjectMoved, the entire server crashes. I'm avoiding it with this:

pawn Код:
SetTimerEx("DestroyOb",1,0,"i",objectid); //inside OnDynamicObjectMoved

public DestroyOb(objid)
{
  DestroyDynamicObject(objid);
  return 1;
}
But its not a very nice way of avoiding the problem.

Also, (I will have to make sure of this), but I am pretty sure, that if you move an object beyond the streaming distance set for it, it will disappear and not be streamed. Will edit this post once i have confirmed this.

Thanks
Reply

Nice streamer
Reply

Suggestion:

MoveDynamicPickup(objectid, Float:Speed);
Reply

Quote:
Originally Posted by Incognito
However, this is feasible (I actually didn't think about adding an extra enum value until just now, but it is a much better idea):

pawn Код:
Streamer_SetIntData(STREAMER_TYPE_PICKUP, gPickup, E_STREAMER_EXTRA_ID, 1);
I'll most likely put that in v2.3.6. Thanks for the suggestions.
Sounds good.
Reply

Thank you so much on teaching me how. I love the streamer but I'm having a problem.


How can i use this streamer to do something like this

Код:
if(!IsPlayerInCheckpoint(playerid)) {
So if a person is not checkpoint "gCheckpoint[1]" how can i add that into a command.


My command is /robdonut and if a play is not in gCheckpoint[1] it should say "You are not in the donut shop"

Reply

DavidC: Thanks for that. I can see why it would cause problems if you destroyed an object there. However, objects do not disappear after they've been moved. You might not see them if you haven't moved, though, because the streamer only sends updates to players if their position has changed.

Compton's Eazy E: That's not an SA-MP native, and it couldn't be done very well inside the plugin unless you set the tickrate to 1!

killdahobo99: Use IsPlayerInDynamicCP:

pawn Код:
if (!IsPlayerInDynamicCP(playerid, gCheckpoint[1]))
{
    // ...
}
Here's the latest version:

Quote:

v2.3.6
- Optimized some streaming code
- Fixed crash that may have occurred when destroying objects under OnDynamicObjectMoved
- Added plural tags to the data manipulation natives so that 3D text labels can be passed to them without a tag mismatch warning
- Added an extra ID to every item that can be set and retrieved with Streamer_SetIntData and Streamer_GetIntData
- Made any item that is altered with Streamer_SetFloatData or Streamer_SetIntData restream for every player automatically
- Added natives for each item to check if they're valid
- Consolidated all of the settings natives (with the exception of Streamer_TickRate) into Streamer_MaxItems and Streamer_VisibleItems

Reply


Forum Jump:


Users browsing this thread: 8 Guest(s)