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


Messages In This Thread
Dominator's Object Streamer - a wize and new streamer - invisible objects fix - by tsha - 14.10.2008, 10:20
Re: Dominator's Object Streamer - a wize and new streamer - invisible objects fi - by tsha - 14.10.2008, 11:46
Re: Dominator's Object Streamer - a wize and new streamer - invisible objects fix - by rafay - 14.10.2008, 12:20
Re: Dominator's Object Streamer - a wize and new streamer - invisible objects fix - by tsha - 14.10.2008, 13:07
Re: Dominator's Object Streamer - a wize and new streamer - invisible objects fix - by rafay - 14.10.2008, 13:44
Re: Dominator's Object Streamer - a wize and new streamer - invisible objects fix - by tsha - 14.10.2008, 14:00
Re: Dominator's Object Streamer - a wize and new streamer - invisible objects fix - by rafay - 14.10.2008, 14:07
Re: Dominator's Object Streamer - a wize and new streamer - invisible objects fi - by tsha - 14.10.2008, 14:36
Re: Dominator's Object Streamer - a wize and new streamer - invisible objects fix - by rafay - 14.10.2008, 14:54
Re: Dominator's Object Streamer - a wize and new streamer - invisible objects fix - by tsha - 14.10.2008, 15:05
Re: Dominator's Object Streamer - a wize and new streamer - invisible objects fix - by rafay - 14.10.2008, 15:12
Re: Dominator's Object Streamer - a wize and new streamer - invisible objects fi - by [M]deLux - 18.10.2008, 15:43
Re: Dominator's Object Streamer - a wize and new streamer - invisible objects fix - by Grove - 18.10.2008, 16:22
Re: Dominator's Object Streamer - a wize and new streamer - invisible objects fix - by matt2127 - 18.10.2008, 16:26
Re: Dominator's Object Streamer - a wize and new streamer - invisible objects fi - by tsha - 18.10.2008, 23:51
Re: Dominator's Object Streamer - a wize and new streamer - invisible objects fi - by [M]deLux - 19.10.2008, 00:16
Re: Dominator's Object Streamer - a wize and new streamer - invisible objects fi - by tsha - 19.10.2008, 01:22
Re: Dominator's Object Streamer - a wize and new streamer - invisible objects fix - by boylett - 19.10.2008, 08:26
Re: Dominator's Object Streamer - a wize and new streamer - invisible objects fix - by BP13 - 22.06.2009, 21:16
Re: Dominator's Object Streamer - a wize and new streamer - invisible objects fix - by HydraX - 22.06.2009, 21:25
Re: Dominator's Object Streamer - a wize and new streamer - invisible objects fix - by MarqueZ92 - 25.06.2009, 07:20
Re: Dominator's Object Streamer - a wize and new streamer - invisible objects fix - by shady91 - 25.06.2009, 07:24
Re: Dominator's Object Streamer - a wize and new streamer - invisible objects fix - by BP13 - 25.06.2009, 14:05
Re: Dominator's Object Streamer - a wize and new streamer - invisible objects fix - by yugokoral - 19.09.2009, 20:37

Forum Jump:


Users browsing this thread: 4 Guest(s)