SA-MP Forums Archive
Get streamed objects. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Get streamed objects. (/showthread.php?tid=548828)



Get streamed objects. - Banditukas - 02.12.2014

Hi,

How to do check if player have streamed objects with simple object about 1000, i want to report, because with one command you can create a dynamic object near you, but if will be playing 1000 players and in one place they build that object then i think it'is will be not very good and buggs will start.


Re: Get streamed objects. - Pottus - 02.12.2014

You would need to use the following.

native Streamer_IsItemVisible(playerid, type, {Text3D,_}:id);
native Streamer_GetUpperBound(type);
native Streamer_IsInArrayData(type, {Text3D,_}:id, data, value);

@Edit - You may need to store all of your objects in an array then loop through them and use Streamer_IsItemVisible(playerid, type, {Text3D,_}:id); although you might able to check if an item exists by doing this.

pawn Код:
new VisibleCount;

for(new i = 0; i <= Streamer_GetUpperBound(STREAMER_TYPE_OBJECT); i++)
{
    // Not in array ?
    if(Streamer_IsInArrayData(STREAMER_TYPE_OBJECT, i, E_STREAMER_MODEL_ID, 0)) continue;
    if(Streamer_IsItemVisible(playerid, STREAMER_TYPE_OBJECT, i)) VisibleCount++;
}
I'm not sure if that will work right (untested) my thinking is if the model id is 0 then the that item does not exist but you might even be able to just do it like this which should work again I didn't any of this because I have never had any reason to use these features.

pawn Код:
new VisibleCount;

for(new i = 0; i <= Streamer_GetUpperBound(STREAMER_TYPE_OBJECT); i++)
{
    if(Streamer_IsItemVisible(playerid, STREAMER_TYPE_OBJECT, i)) VisibleCount++;
}