Streamer Problem
#1

Hi there!!

So as the Title says i am having difficluty with a object streamer, now i made my own based off of xObject and Mido-Stream....Now your asking yourself why are you making a object streamer when there is a bunch of other great ones....Well to learn how to make one and how they work. lol

So my problem is i have 1988 objects currently testing it and after i reached about 1000-1400 objects it dosnt show all of the objects. I am using CreatePlayerObject and then destroying them when the player isnt in reach and the array is set to 2000 objects and i even tryed more but when the objects are added to the array they get counted.
I also added a virtual world param to it too and that works great. Also when i reload the script the objects show up again and they all so untill i go to the next map then it happens again.

Now the code to check for the players positon and the array is the same as xObjects streamer and xObject i have had over 3000 objects with that one with no problem. Then the idea i got from mido-stream is for creating the object mine is called MakeNObject.(Make-An-Object.......get it heheh, i know not funny )

Here are the codes for checking players position and then the MakeNObject code.

pawn Код:
forward NObjectUpdate(playerid);
public NObjectUpdate(playerid)
{
    new Float:pos[3];
    GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
    for(new i = 0; i < ObjCount; i++)
    {
        if(GetPlayerVirtualWorld(playerid) == Objects[i][nworld])
        {
            if(!NPlayer[playerid][see][i])
            {
                if(IsNObjClose(pos[0],pos[1],pos[2],Objects[i][nx],Objects[i][ny],Objects[i][nz],Objects[i][ndraw]))
                {
                    NPlayer[playerid][see][i] = true;
                    NPlayer[playerid][nobj][i] = CreatePlayerObject(playerid,Objects[i][nid],Objects[i][nx],Objects[i][ny],Objects[i][nz],Objects[i][nrx],Objects[i][nry],Objects[i][nrz]);
                }
            } else if(!IsNObjClose(pos[0],pos[1],pos[2],Objects[i][nx],Objects[i][ny],Objects[i][nz],Objects[i][ndraw]))
            {
                NPlayer[playerid][see][i] = false;
                DestroyPlayerObject(playerid,NPlayer[playerid][nobj][i]);
            }
        }
        else
        {
            NPlayer[playerid][see][i] = false;
            DestroyPlayerObject(playerid,NPlayer[playerid][nobj][i]);
        }
    }
}
heres the MakeNObject one now
pawn Код:
forward MakeNObject(modelid,Float:X,Float:Y,Float:Z,Float:rX,Float:rY,Float:rZ,Float:DrawDistance,World);
public MakeNObject(modelid, Float:X,Float:Y,Float:Z,Float:rX,Float:rY,Float:rZ,Float:DrawDistance,World)
{
    ObjCount++;
    for (new i=0; i<ObjCount; i++)
    {
        if (Objects[i][nid] == 0)
        {
            Objects[i][nid] = modelid;
            Objects[i][nx] = X;
            Objects[i][ny] = Y;
            Objects[i][nz] = Z;
            Objects[i][nrx] = rX;
            Objects[i][nry] = rY;
            Objects[i][nrz] = rZ;
            Objects[i][ndraw] = DrawDistance;
            Objects[i][nworld] = World;
            break;
        }
    }
    return 1;
}
and the array/enum
pawn Код:
enum object_enum
{
    nid,
    Float:nx,
    Float:ny,
    Float:nz,
    Float:nrx,
    Float:nry,
    Float:nrz,
    Float:ndraw,
    nworld
}
new Objects[MAX_N_OBJECTS][object_enum];
Any one know what i did wrong?
Reply
#2

Any Help or suggestions? I have changed some things up but it didnt work or made it worse. lol
Reply
#3

Any help on this? I am still stuck on it. If anyone wants more info let me know i will show it.

Thanks
Reply
#4

Stop double Post !! you just wait for someone to help you
Reply
#5

Maybe try decreasing the draw distance? I'm not sure, I'm no pro when it comes to these kind of things, and it's still early so I'm kinda sleepy
Reply
#6

Quote:
Originally Posted by Ajez
Посмотреть сообщение
Stop double Post !! you just wait for someone to help you
Rules say that i can post again after 48 hours if no one comments.........

Quote:
Originally Posted by Makaveli93
Посмотреть сообщение
Maybe try decreasing the draw distance? I'm not sure, I'm no pro when it comes to these kind of things, and it's still early so I'm kinda sleepy
yea i tryied that and it still didnt work. I even intergraded it into my gamemode and it made it worse for some reason.
Reply
#7

Try this

pawn Код:
forward NObjectUpdate(playerid);
public NObjectUpdate(playerid)
{
    new Float:pos[3];
    GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
    for(new i = 0; i < ObjCount; i++)
    {
        if(GetPlayerVirtualWorld(playerid) == Objects[i][nworld]
        && IsNObjClose(pos[0],pos[1],pos[2],Objects[i][nx],Objects[i][ny],Objects[i][nz],Objects[i][ndraw]))
        {
            if(!NPlayer[playerid][see][i])
            {
                NPlayer[playerid][nobj][i] = CreatePlayerObject(playerid,Objects[i][nid],Objects[i][nx],Objects[i][ny],Objects[i][nz],Objects[i][nrx],Objects[i][nry],Objects[i][nrz]);
                NPlayer[playerid][see][i] = true;
            }
        }
        else
        {
            if(NPlayer[playerid][see][i])
            {
                DestroyPlayerObject(playerid,NPlayer[playerid][nobj][i]);
                NPlayer[playerid][see][i] = false;
            }
        }
    }
}
Also, the general limit of SA-MP is max 1000 objects shown at once

https://sampwiki.blast.hk/wiki/Limits

And show how you create 'NPlayer'
Reply
#8

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
Try this

pawn Код:
forward NObjectUpdate(playerid);
public NObjectUpdate(playerid)
{
    new Float:pos[3];
    GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
    for(new i = 0; i < ObjCount; i++)
    {
        if(GetPlayerVirtualWorld(playerid) == Objects[i][nworld]
        && IsNObjClose(pos[0],pos[1],pos[2],Objects[i][nx],Objects[i][ny],Objects[i][nz],Objects[i][ndraw]))
        {
            if(!NPlayer[playerid][see][i])
            {
                NPlayer[playerid][nobj][i] = CreatePlayerObject(playerid,Objects[i][nid],Objects[i][nx],Objects[i][ny],Objects[i][nz],Objects[i][nrx],Objects[i][nry],Objects[i][nrz]);
                NPlayer[playerid][see][i] = true;
            }
        }
        else
        {
            if(NPlayer[playerid][see][i])
            {
                DestroyPlayerObject(playerid,NPlayer[playerid][nobj][i]);
                NPlayer[playerid][see][i] = false;
            }
        }
    }
}
Also, the general limit of SA-MP is max 1000 objects shown at once

https://sampwiki.blast.hk/wiki/Limits

And show how you create 'NPlayer'
I will have to give that a try when i get back later.

Heres my NPlayer array/enum
pawn Код:
enum player_data
{
    nobj[MAX_N_OBJECTS],
    bool:see[MAX_N_OBJECTS]
}
new NPlayer[MAX_PLAYERS][player_data];
I know about the limits, but i have no problem with limits in the areas of the objects are as it creates the closest objects and destroys them as they go away. only thing i could think of is that the objects are not getting destroyed and then hits the object limit and causes the player not to see anymore playerobjects.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)