Dominator's Object Streamer - a wize and new streamer - invisible objects fix
#1

Dominator's Object Streamer

about:
based on xobjects, modified to fix the invisible object bug while in vehicle.

info:
supports 135 objects for a player in a 500 radius.
besides that, to max object limitation (objects can reach even a milion!).

how does it work:
the streamer scans your objects and gets the 15 most common types of modelids on your server.

Known Bugs:
The bug fix only affects the 15 model id mentioned adove, to save free object slots.
good news: for most servers, 15 types of model id is almost all objects.

GameMode Version (FS Version at bottom):

Put this on OnPlayerSpawn(playerid)
Code:
SetTimerEx("PlayerObjectUpdate", 100, 1, "d", playerid);
SetPlayerPos(playerid,0.0, 0.0, 120002.0);
SetTimerEx("loadspawnpos", 1000, false, "d", playerid);
return 1; // only one in the end of the callback
Put this on OnGamemodeInit()
Code:
GetCount();
GetTopModels();
GetObjectsInfo();
CreateTopObject();
Put this under all #include
Code:
new TopModels[15] = 0;
new TopModelsID[15] = 0;
#define MAX_MODEL_ID 20000
new countmodel[MAX_MODEL_ID];
enum object_info
{
	modelidd,
	Float:ox,
	Float:oy,
	Float:oz,
	Float:orx,
	Float:ory,
	Float:orz,
	Float:viewdist
}
new Objects[][object_info] = {
//--------------------objects put here---------------------------------------------------------
    //{modelid, Float:x, Float:y, Float:z,Float:rotx, Float:roty, Float:rotz, Float:viewdist},
    {6189, 123.456, 123.456,123.456, 0.0, 0.0, 0.0, 500.0}, //examples
	{11111, 123.456, 123.456, 123.456, 0.0, 0.0, 0.0, 500.0} //examples
};
enum player_info
{
	objid[sizeof(Objects)],
	bool:view[sizeof(Objects)]
}
new PlayerO[MAX_PLAYERS][player_info];
Put this anywhere you want except in a function
Code:
GetObjectsInfo()
{
new modelss;
new ggf[256];
for(new i = 0;i< MAX_MODEL_ID; i++)
 {
 if(countmodel[i] != 0)
  {
  modelss++;
  }
 }
format(ggf,sizeof(ggf),"%d Objects and %d Models Loaded By Dominator Object Streamer",sizeof(Objects),modelss);
// please dont remove credits
printf(ggf);
}
GetTopModels()
{
new FinalPosition;
for(new i = 0;i< sizeof(Objects); i++)
{
	if(Objects[i][modelidd] == TopModelsID[0] || Objects[i][modelidd] == TopModelsID[1] || Objects[i][modelidd] == TopModelsID[2] || Objects[i][modelidd] == TopModelsID[3] || Objects[i][modelidd] == TopModelsID[4] || Objects[i][modelidd] == TopModelsID[5] || Objects[i][modelidd] == TopModelsID[6] || Objects[i][modelidd] == TopModelsID[7] || Objects[i][modelidd] == TopModelsID[8] || Objects[i][modelidd] == TopModelsID[9])
	{
	FinalPosition = -1;
	} else if(countmodel[Objects[i][modelidd]] > TopModels[0]) FinalPosition = 1;
  else if(countmodel[Objects[i][modelidd]] > TopModels[1] && countmodel[Objects[i][modelidd]] <= TopModels[0]) FinalPosition = 2;
  else if(countmodel[Objects[i][modelidd]] > TopModels[2] && countmodel[Objects[i][modelidd]] <= TopModels[1]) FinalPosition = 3;
  else if(countmodel[Objects[i][modelidd]] > TopModels[3] && countmodel[Objects[i][modelidd]] <= TopModels[2]) FinalPosition = 4;
  else if(countmodel[Objects[i][modelidd]] > TopModels[4] && countmodel[Objects[i][modelidd]] <= TopModels[3]) FinalPosition = 5;
  else if(countmodel[Objects[i][modelidd]] > TopModels[5] && countmodel[Objects[i][modelidd]] <= TopModels[4]) FinalPosition = 6;
  else if(countmodel[Objects[i][modelidd]] > TopModels[6] && countmodel[Objects[i][modelidd]] <= TopModels[5]) FinalPosition = 7;
  else if(countmodel[Objects[i][modelidd]] > TopModels[7] && countmodel[Objects[i][modelidd]] <= TopModels[6]) FinalPosition = 8;
  else if(countmodel[Objects[i][modelidd]] > TopModels[8] && countmodel[Objects[i][modelidd]] <= TopModels[7]) FinalPosition = 9;
  else if(countmodel[Objects[i][modelidd]] > TopModels[9] && countmodel[Objects[i][modelidd]] <= TopModels[8]) FinalPosition = 10;
  else if(countmodel[Objects[i][modelidd]] > TopModels[10] && countmodel[Objects[i][modelidd]] <= TopModels[9]) FinalPosition = 11;
  else if(countmodel[Objects[i][modelidd]] > TopModels[11] && countmodel[Objects[i][modelidd]] <= TopModels[10]) FinalPosition = 12;
  else if(countmodel[Objects[i][modelidd]] > TopModels[12] && countmodel[Objects[i][modelidd]] <= TopModels[11]) FinalPosition = 13;
  else if(countmodel[Objects[i][modelidd]] > TopModels[13] && countmodel[Objects[i][modelidd]] <= TopModels[12]) FinalPosition = 14;
  else if(countmodel[Objects[i][modelidd]] > TopModels[14] && countmodel[Objects[i][modelidd]] <= TopModels[13]) FinalPosition = 15;
	else if(countmodel[Objects[i][modelidd]] <= TopModels[14]) FinalPosition = -1;
	if(FinalPosition == 1)
	{
	  TopModels[14] = TopModels[13];
		TopModels[13] = TopModels[12];
		TopModels[12] = TopModels[11];
    TopModels[11] = TopModels[10];
	  TopModels[10] = TopModels[9];
	  TopModels[9] = TopModels[8];
	  TopModels[8] = TopModels[7];
	  TopModels[7] = TopModels[6];
	  TopModels[6] = TopModels[5];
	  TopModels[5] = TopModels[4];
	  TopModels[4] = TopModels[3];
		TopModels[3] = TopModels[2];
		TopModels[2] = TopModels[1];
    TopModels[1] = TopModels[0];
	  TopModelsID[14] = TopModelsID[13];
		TopModelsID[13] = TopModelsID[12];
		TopModelsID[12] = TopModelsID[11];
    TopModelsID[11] = TopModelsID[10];
    TopModelsID[10] = TopModelsID[9];
    TopModelsID[9] = TopModelsID[8];
	  TopModelsID[8] = TopModelsID[7];
	  TopModelsID[7] = TopModelsID[6];
	  TopModelsID[6] = TopModelsID[5];
	  TopModelsID[5] = TopModelsID[4];
	  TopModelsID[4] = TopModelsID[3];
		TopModelsID[3] = TopModelsID[2];
		TopModelsID[2] = TopModelsID[1];
    TopModelsID[1] = TopModelsID[0];
		TopModels[0] = countmodel[Objects[i][modelidd]];
		TopModelsID[0] = Objects[i][modelidd];
	}
	else if(FinalPosition == 2)
	{
	  TopModels[14] = TopModels[13];
		TopModels[13] = TopModels[12];
		TopModels[12] = TopModels[11];
    TopModels[11] = TopModels[10];
	  TopModels[10] = TopModels[9];
	  TopModels[9] = TopModels[8];
	  TopModels[8] = TopModels[7];
	  TopModels[7] = TopModels[6];
	  TopModels[6] = TopModels[5];
	  TopModels[5] = TopModels[4];
	  TopModels[4] = TopModels[3];
		TopModels[3] = TopModels[2];
		TopModels[2] = TopModels[1];
	  TopModelsID[14] = TopModelsID[13];
		TopModelsID[13] = TopModelsID[12];
		TopModelsID[12] = TopModelsID[11];
    TopModelsID[11] = TopModelsID[10];
    TopModelsID[10] = TopModelsID[9];
    TopModelsID[9] = TopModelsID[8];
	  TopModelsID[8] = TopModelsID[7];
	  TopModelsID[7] = TopModelsID[6];
	  TopModelsID[6] = TopModelsID[5];
	  TopModelsID[5] = TopModelsID[4];
	  TopModelsID[4] = TopModelsID[3];
		TopModelsID[3] = TopModelsID[2];
		TopModelsID[2] = TopModelsID[1];
		TopModels[1] = countmodel[Objects[i][modelidd]];
		TopModelsID[1] = Objects[i][modelidd];
	}
	else if(FinalPosition == 3)
	{
	  TopModels[14] = TopModels[13];
		TopModels[13] = TopModels[12];
		TopModels[12] = TopModels[11];
    TopModels[11] = TopModels[10];
	  TopModels[10] = TopModels[9];
	  TopModels[9] = TopModels[8];
	  TopModels[8] = TopModels[7];
	  TopModels[7] = TopModels[6];
	  TopModels[6] = TopModels[5];
	  TopModels[5] = TopModels[4];
	  TopModels[4] = TopModels[3];
		TopModels[3] = TopModels[2];
	  TopModelsID[14] = TopModelsID[13];
		TopModelsID[13] = TopModelsID[12];
		TopModelsID[12] = TopModelsID[11];
    TopModelsID[11] = TopModelsID[10];
    TopModelsID[10] = TopModelsID[9];
    TopModelsID[9] = TopModelsID[8];
	  TopModelsID[8] = TopModelsID[7];
	  TopModelsID[7] = TopModelsID[6];
	  TopModelsID[6] = TopModelsID[5];
	  TopModelsID[5] = TopModelsID[4];
	  TopModelsID[4] = TopModelsID[3];
		TopModelsID[3] = TopModelsID[2];
		TopModels[2] = countmodel[Objects[i][modelidd]];
		TopModelsID[2] = Objects[i][modelidd];
	}
	else if(FinalPosition == 4)
	{
	  TopModels[14] = TopModels[13];
		TopModels[13] = TopModels[12];
		TopModels[12] = TopModels[11];
    TopModels[11] = TopModels[10];
	  TopModels[10] = TopModels[9];
	  TopModels[9] = TopModels[8];
	  TopModels[8] = TopModels[7];
	  TopModels[7] = TopModels[6];
	  TopModels[6] = TopModels[5];
	  TopModels[5] = TopModels[4];
	  TopModels[4] = TopModels[3];
	  TopModelsID[14] = TopModelsID[13];
		TopModelsID[13] = TopModelsID[12];
		TopModelsID[12] = TopModelsID[11];
    TopModelsID[11] = TopModelsID[10];
    TopModelsID[10] = TopModelsID[9];
    TopModelsID[9] = TopModelsID[8];
	  TopModelsID[8] = TopModelsID[7];
	  TopModelsID[7] = TopModelsID[6];
	  TopModelsID[6] = TopModelsID[5];
	  TopModelsID[5] = TopModelsID[4];
	  TopModelsID[4] = TopModelsID[3];
		TopModels[3] = countmodel[Objects[i][modelidd]];
		TopModelsID[3] = Objects[i][modelidd];
	}
	else if(FinalPosition == 5)
	{
	  TopModels[14] = TopModels[13];
		TopModels[13] = TopModels[12];
		TopModels[12] = TopModels[11];
    TopModels[11] = TopModels[10];
	  TopModels[10] = TopModels[9];
	  TopModels[9] = TopModels[8];
	  TopModels[8] = TopModels[7];
	  TopModels[7] = TopModels[6];
	  TopModels[6] = TopModels[5];
	  TopModels[5] = TopModels[4];
	  TopModelsID[14] = TopModelsID[13];
		TopModelsID[13] = TopModelsID[12];
		TopModelsID[12] = TopModelsID[11];
    TopModelsID[11] = TopModelsID[10];
    TopModelsID[10] = TopModelsID[9];
    TopModelsID[9] = TopModelsID[8];
	  TopModelsID[8] = TopModelsID[7];
	  TopModelsID[7] = TopModelsID[6];
	  TopModelsID[6] = TopModelsID[5];
	  TopModelsID[5] = TopModelsID[4];
	  TopModels[4] = countmodel[Objects[i][modelidd]];
	  TopModelsID[4] = Objects[i][modelidd];
	}
	else if(FinalPosition == 6)
	{
	  TopModels[14] = TopModels[13];
		TopModels[13] = TopModels[12];
		TopModels[12] = TopModels[11];
    TopModels[11] = TopModels[10];
	  TopModels[10] = TopModels[9];
	  TopModels[9] = TopModels[8];
	  TopModels[8] = TopModels[7];
	  TopModels[7] = TopModels[6];
	  TopModels[6] = TopModels[5];
	  TopModelsID[14] = TopModelsID[13];
		TopModelsID[13] = TopModelsID[12];
		TopModelsID[12] = TopModelsID[11];
    TopModelsID[11] = TopModelsID[10];
    TopModelsID[10] = TopModelsID[9];
    TopModelsID[9] = TopModelsID[8];
	  TopModelsID[8] = TopModelsID[7];
	  TopModelsID[7] = TopModelsID[6];
	  TopModelsID[6] = TopModelsID[5];
	  TopModels[5] = countmodel[Objects[i][modelidd]];
	  TopModelsID[5] = Objects[i][modelidd];
	}
	else if(FinalPosition == 7)
	{
	  TopModels[14] = TopModels[13];
		TopModels[13] = TopModels[12];
		TopModels[12] = TopModels[11];
    TopModels[11] = TopModels[10];
	  TopModels[10] = TopModels[9];
	  TopModels[9] = TopModels[8];
	  TopModels[8] = TopModels[7];
	  TopModels[7] = TopModels[6];
	  TopModelsID[14] = TopModelsID[13];
		TopModelsID[13] = TopModelsID[12];
		TopModelsID[12] = TopModelsID[11];
    TopModelsID[11] = TopModelsID[10];
    TopModelsID[10] = TopModelsID[9];
    TopModelsID[9] = TopModelsID[8];
	  TopModelsID[8] = TopModelsID[7];
	  TopModelsID[7] = TopModelsID[6];
	  TopModels[6] = countmodel[Objects[i][modelidd]];
	  TopModelsID[6] = Objects[i][modelidd];
	}
	else if(FinalPosition == 8)
	{
	  TopModels[14] = TopModels[13];
		TopModels[13] = TopModels[12];
		TopModels[12] = TopModels[11];
    TopModels[11] = TopModels[10];
	  TopModels[10] = TopModels[9];
	  TopModels[9] = TopModels[8];
	  TopModels[8] = TopModels[7];
	  TopModelsID[14] = TopModelsID[13];
		TopModelsID[13] = TopModelsID[12];
		TopModelsID[12] = TopModelsID[11];
    TopModelsID[11] = TopModelsID[10];
    TopModelsID[10] = TopModelsID[9];
    TopModelsID[9] = TopModelsID[8];
	  TopModelsID[8] = TopModelsID[7];
	  TopModels[7] = countmodel[Objects[i][modelidd]];
	  TopModelsID[7] = Objects[i][modelidd];
	}
	else if(FinalPosition == 9)
	{
	  TopModels[14] = TopModels[13];
		TopModels[13] = TopModels[12];
		TopModels[12] = TopModels[11];
    TopModels[11] = TopModels[10];
	  TopModels[10] = TopModels[9];
	  TopModels[9] = TopModels[8];
	  TopModelsID[14] = TopModelsID[13];
		TopModelsID[13] = TopModelsID[12];
		TopModelsID[12] = TopModelsID[11];
    TopModelsID[11] = TopModelsID[10];
    TopModelsID[10] = TopModelsID[9];
    TopModelsID[9] = TopModelsID[8];
	  TopModels[8] = countmodel[Objects[i][modelidd]];
	  TopModelsID[8] = Objects[i][modelidd];
	}
	else if(FinalPosition == 10)
	{
	  TopModels[14] = TopModels[13];
		TopModels[13] = TopModels[12];
		TopModels[12] = TopModels[11];
    TopModels[11] = TopModels[10];
	  TopModels[10] = TopModels[9];
	  TopModelsID[14] = TopModelsID[13];
		TopModelsID[13] = TopModelsID[12];
		TopModelsID[12] = TopModelsID[11];
    TopModelsID[11] = TopModelsID[10];
    TopModelsID[10] = TopModelsID[9];
	  TopModels[9] = countmodel[Objects[i][modelidd]];
	  TopModelsID[9] = Objects[i][modelidd];
	}
	else if(FinalPosition == 11)
	{
	  TopModels[14] = TopModels[13];
		TopModels[13] = TopModels[12];
		TopModels[12] = TopModels[11];
    TopModels[11] = TopModels[10];
	  TopModelsID[14] = TopModelsID[13];
		TopModelsID[13] = TopModelsID[12];
		TopModelsID[12] = TopModelsID[11];
    TopModelsID[11] = TopModelsID[10];
	  TopModels[10] = countmodel[Objects[i][modelidd]];
	  TopModelsID[10] = Objects[i][modelidd];
	}
	else if(FinalPosition == 12)
	{
	  TopModels[14] = TopModels[13];
		TopModels[13] = TopModels[12];
		TopModels[12] = TopModels[11];
	  TopModelsID[14] = TopModelsID[13];
		TopModelsID[13] = TopModelsID[12];
		TopModelsID[12] = TopModelsID[11];
	  TopModels[11] = countmodel[Objects[i][modelidd]];
	  TopModelsID[11] = Objects[i][modelidd];
	}
	else if(FinalPosition == 13)
	{
	  TopModels[14] = TopModels[13];
		TopModels[13] = TopModels[12];
	  TopModelsID[14] = TopModelsID[13];
		TopModelsID[13] = TopModelsID[12];
	  TopModels[12] = countmodel[Objects[i][modelidd]];
	  TopModelsID[12] = Objects[i][modelidd];
	}
	else if(FinalPosition == 14)
	{
	  TopModels[14] = TopModels[13];
	  TopModelsID[14] = TopModelsID[13];
	  TopModels[13] = countmodel[Objects[i][modelidd]];
	  TopModelsID[13] = Objects[i][modelidd];
	}
	else if(FinalPosition == 15)
	{
	  TopModels[14] = countmodel[Objects[i][modelidd]];
	  TopModelsID[14] = Objects[i][modelidd];
	}
}
}
GetCount()
{
for(new i = 0; i < sizeof(Objects); i++)
		{
		countmodel[Objects[i][modelidd]]++;
		}
}
bool:IsInReach(Float:x,Float:y,Float:z,Float:x2,Float:y2,Float:z2,Float:dist)
{
	x = (x > x2) ? x - x2 : x2 - x;
	if(x > dist) return false;
	y = (y > y2) ? y - y2 : y2 - y;
	if(y > dist) return false;
	z = (z > z2) ? z - z2 : z2 - z;
	if(z > dist) return false;
	return true;
}
forward PlayerObjectUpdate(playerid);
public PlayerObjectUpdate(playerid)
{
  if(IsPlayerConnected(playerid))
  {
		new Float:pos[3];
		GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
		for(new i = 0; i < sizeof(Objects); i++)
		{
		  if(!PlayerO[playerid][view][i])
		  {
		    if(IsInReach(pos[0],pos[1],pos[2],Objects[i][ox],Objects[i][oy],Objects[i][oz],Objects[i][viewdist]))
		    {
		      PlayerO[playerid][view][i] = true;
		      PlayerO[playerid][objid][i] = CreatePlayerObject(playerid,Objects[i][modelidd],Objects[i][ox],Objects[i][oy],Objects[i][oz],Objects[i][orx],Objects[i][ory],Objects[i][orz]);
		    }
		  } else if(!IsInReach(pos[0],pos[1],pos[2],Objects[i][ox],Objects[i][oy],Objects[i][oz],Objects[i][viewdist]))
		  {
  	    PlayerO[playerid][view][i] = false;
  	    DestroyPlayerObject(playerid,PlayerO[playerid][objid][i]);
		  }
		}
	}
}
CreateTopObject()
{
for(new i = 0;i<sizeof(TopModels);i++)
{
if(TopModels[i] != 0) CreateObject(TopModelsID[i],0.0,0.0,120000.0,0.0,0.0,0.0);
}
}
[FS] Version:
http://s-zone.110mb.com/dominator-streamer.zip
PasteBin: http://pastebin.com/f1c47dc69
*note: if using fs you must add objects to FS

Please Post and report bugs
Reply
#2

come on, reply, let me know you care.
Reply
#3

nvm...
Reply
#4

is it working/usefull for you?
Reply
#5

Quote:

supports 135 objects for a player in a 500 radius.

but i have a huge server & i want 250 objects at 250 or 500 radius
Reply
#6

try it, it never crashed to me and i have something like 20 maps
Reply
#7

can i use it as a fs ? if yes, please post on pastebin.com (ready to use)
Reply
#8

added fs version
Reply
#9

I tested it

Invisible objects bug: Solved
Streamed my 7000 objects without any problem or crash

BUT
Max area limit is still 200 & my objects doesn't shows up all =(
can u increase it to 300 or something :\ ?
Reply
#10

its not 200 its 150 because its the object limit on sa-mp (reason for streamers)
it cannot be changed, but, try:

{6189, 123.456, 123.456,123.456, 0.0, 0.0, 0.0, 500.0},
replace to:
{6189, 123.456, 123.456,123.456, 0.0, 0.0, 0.0, 200.0},

on every object (replace 500.0}, with 200.0},)
***remember to delete the ',' on the last object
Reply
#11

draw distance - simply say that xD

wait i go try it again...
Reply
#12

so what did you actually change from xobjects?
Reply
#13

How did you fix the invisible objects bug?
Reply
#14

Are you allowed to modify it without permission?
Reply
#15

i improved it:

fact: if a player sees an object, the player will always see the object modelid (bug fix).
i created a script that scans the most commonly used modelid on your server(top 15).
and then i created them and i made a script that will make sure the player will see those models.


about the permission:

i said its an improve of xobjects, if you want, you can call it xobjects.
Reply
#16

Quote:
Originally Posted by tsha
and then i created them and i made a script that will make sure the player will see those models.
yeah, and how do you make it sure?
Reply
#17

if its working, then why do you ask?


if you want to find out so bad, look at the source
Reply
#18

There's probably a bug with player objects. This creates regular objects if theyre the most used.
Reply
#19

{980,1961.6454,-2189.8413,15.3203,0,0,0, 500.0},// Gate LS
warning 213: tag mismatch

Reply
#20

there should be an object converter for this

it worked for my server

but some objects didnt appear
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)