[Plugin] Streamer Plugin

E_STREAMER_EXTRA_ID could be array, could be integer. Are you sure it happens in that function? Add some debug, print the object's id and ensure that this object exist.
Reply

Quote:
Originally Posted by ball
Посмотреть сообщение
E_STREAMER_EXTRA_ID could be array, could be integer. Are you sure it happens in that function? Add some debug, print the object's id and ensure that this object exist.
Of course the object MAY or may NOT exist. The function is being called every some time using SetPlayerTimerEx - the timer is being called JUST ONCE player is spawned (not every respawn though).

So, I have commented the line where the timer is being called for player in OnPlayerSpawn and the warning message doesn't appear in the console.

So, the issue appears to be in the "OnPlayerLookAt" code. As I have said before, I have added IF statement validations to check if the object exists or not for the player so it SHOULDN'T come up with anything like that in the console.

Some more code, if you'd like:
native
pawn Код:
stock GetPlayerCameraDynamicObject(playerid)return Streamer_GetItemStreamerID(playerid, STREAMER_TYPE_OBJECT, GetPlayerCameraTargetObject(playerid));
OnPlayerLookAt
pawn Код:
new lookingat_objectid = GetPlayerCameraDynamicObject(playerid);
    if(IsValidDynamicObject(lookingat_objectid))
    {
        if(PlayerData[playerid][E_PLAYER_LOOKING_AT_ITEMID] == INVALID_OBJECT_ID)
        {
            new object_data[10];
            Streamer_GetArrayData(STREAMER_TYPE_OBJECT, lookingat_objectid, E_STREAMER_EXTRA_ID, object_data, sizeof(object_data));

            new itemid = object_data[0];
            if(ItemData[itemid][E_ITEM_TYPE] != ITEM_TYPE_NONE)
            {
                if(Streamer_IsInArrayData(STREAMER_TYPE_OBJECT, lookingat_objectid, E_STREAMER_EXTRA_ID, INVALID_3DTEXT_ID))
                {
                    PlayerData[playerid][E_PLAYER_LOOKING_AT_ITEMID] = lookingat_objectid;

                    object_data[9] = _:CreateDynamic3DTextLabel(ItemData[itemid][E_ITEM_NAME], COLOR_NICK, Float:object_data[3], Float:object_data[4], Float:object_data[5], 2.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, false, object_data[6], object_data[7], playerid, 5.0);
                    Streamer_SetArrayData(STREAMER_TYPE_OBJECT, lookingat_objectid, E_STREAMER_EXTRA_ID, object_data, sizeof(object_data));

                    Streamer_Update(playerid, STREAMER_TYPE_3D_TEXT_LABEL);
                }
            }
        }
    }

    else
    {
        if(PlayerData[playerid][E_PLAYER_LOOKING_AT_ITEMID] != INVALID_OBJECT_ID)
        {
            new object_data[10];
            Streamer_GetArrayData(STREAMER_TYPE_OBJECT, PlayerData[playerid][E_PLAYER_LOOKING_AT_ITEMID], E_STREAMER_EXTRA_ID, object_data, sizeof(object_data));

            if(Streamer_IsInArrayData(STREAMER_TYPE_OBJECT, PlayerData[playerid][E_PLAYER_LOOKING_AT_ITEMID], E_STREAMER_EXTRA_ID, object_data[9]))
            {
                DestroyDynamic3DTextLabel(Text3D:object_data[9]);
                Streamer_Update(playerid, STREAMER_TYPE_3D_TEXT_LABEL);

                object_data[9] = INVALID_3DTEXT_ID;
                Streamer_SetArrayData(STREAMER_TYPE_OBJECT, PlayerData[playerid][E_PLAYER_LOOKING_AT_ITEMID], E_STREAMER_EXTRA_ID, object_data, sizeof(object_data));
            }
            PlayerData[playerid][E_PLAYER_LOOKING_AT_ITEMID] = INVALID_OBJECT_ID;
        }
    }
Reply

Quote:
Originally Posted by Crayder
Посмотреть сообщение
It is in the wiki, the streamer wiki. It's on GitHub.
No it's not in the wiki (like I said), the function is in the native list, but no parameters description is given, but on this page it was given before. So the information was available but is not anymore.
Reply

Quote:
Originally Posted by rt-2
Посмотреть сообщение
No it's not in the wiki (like I said), the function is in the native list, but no parameters description is given, but on this page it was given before. So the information was available but is not anymore.
https://github.com/samp-incognito/sa...tives-(Objects)
Reply

Quote:
Originally Posted by AbyssMorgan
Посмотреть сообщение
E_STREAMER_EXTRA_ID is integer not array
E_STREAMER_EXTRA_ID internally is a "std::vector< int >" . So, technically, it is an array (1D/vector, of integers), not an integer, but it can be used as both because Incognito added the possibility to use it with the natives manipulating just an integer (Streamer_SetIntData and Streamer_GetIntData) by actually setting/getting only the first value in that vector of extra integers (you can check getFirstValueInContainer and setFirstValueInContainer in the source code).

--------------------------

Quote:
Originally Posted by Riddick94
Посмотреть сообщение
<>
Ok, so here's my try to help you. In your first post you didn't post everything. The first "if" line and the whole code block looks ok ( you are even checking first if it is valid, but this means that PlayerData[playerid][E_PLAYER_LOOKING_AT_ITEMID] will NEVER be set to INVALID_OBJECT_ID (actually, it would be 0, because Streamer_GetItemStreamerID returns 0 if it isn't a dynamic object ID, here is your error: invalid default ID set) there because lookingat_objectid is not a "ValidDynamicObject" [ in the "if" check before checking for PlayerData[playerid][E_PLAYER_LOOKING_AT_ITEMID] ] ), which means that the problem is from the second block of code ("else"), which is called if he isn't looking at any dynamic object.
Did you set PlayerData[playerid][E_PLAYER_LOOKING_AT_ITEMID] to INVALID_OBJECT_ID when the player connects ? If it isn't INVALID_OBJECT_ID (0xFFFF/65535) that check will be true which means that it will go to this ( assuming that variable is set to 0 (or, well, any other invalid dynamic object ID, if not set as INVALID_OBJECT_ID) ):
PHP код:
Streamer_GetArrayData(STREAMER_TYPE_OBJECT/*PlayerData[playerid][E_PLAYER_LOOKING_AT_ITEMID]*/E_STREAMER_EXTRA_IDobject_datasizeof(object_data));
if(
Streamer_IsInArrayData(STREAMER_TYPE_OBJECT/*PlayerData[playerid][E_PLAYER_LOOKING_AT_ITEMID]*/E_STREAMER_EXTRA_IDobject_data[9])) 
hence your warnings, exactly in that order:
Quote:

*** Streamer Plugin: Streamer_GetArrayData: Invalid ID specified.
*** Streamer Plugin: Streamer_IsInArrayData: Invalid ID specified.

By the way, INVALID_OBJECT_ID is actually a really valid object ID in Streamer Plugin (Dynamic Object ID 65535), so you'd better initialize it with 0 (or INVALID_STREAMER_ID), as object IDs are starting from 1, just in case. Also, you should really use the latest Streamer Plugin, in v2.9.0 the function GetPlayerCameraTargetDynObject was added, which returns 0 (INVALID_STREAMER_ID) when he isn't targeting any dynamic object.

To simply check if my theory is correct, you should add IsValidDynamicObject(PlayerData[playerid][E_PLAYER_LOOKING_AT_ITEMID]) after the first check:
Код:
if(PlayerData[playerid][E_PLAYER_LOOKING_AT_ITEMID] != INVALID_OBJECT_ID)
=>
Код:
if(PlayerData[playerid][E_PLAYER_LOOKING_AT_ITEMID] != INVALID_OBJECT_ID && IsValidDynamicObject(PlayerData[playerid][E_PLAYER_LOOKING_AT_ITEMID]))
I don't see anything else which could cause that in the code you posted, so this should really be the problem. Always keep in mind the possible functions return values. Sorry if you didn't understand, but I think that I explained as much as possible (maybe too much, so this might rise problems in understanding what I said xD).

--------------------------

When requesting help you have post the whole code blocks, not only just a part, maybe the problem isn't really from where you think it is from, just like in this case.
Reply

Quote:
Originally Posted by IstuntmanI
Посмотреть сообщение
...
Would have never thought of anyone to be that experienced with Streamer and to be that happy to help.

Thanks.

That's what I had in my OnPlayerConnect:
pawn Код:
PlayerData[playerid][E_PLAYER_LOOKING_AT_ITEMID] = PlayerData[playerid][E_PLAYER_LOOKING_AT_PLAYERID] = -1;
Let me play around a bit with the informations you have gave me and I will come up with the solution for sure. Also, have changed right away the function:

pawn Код:
new lookingat_objectid = GetPlayerCameraTargetDynObject(playerid);
I will edit this post.

edit://
The issue was with the OnPlayerConnect where I haven't set the 2D Array value to INVALID but to '-1' instead. Thanks a lot!
Reply

I will do that next time I HAVE to dig to find information,, just weird that they previously provided it and just removed it instead of transfering.
Reply

IsPlayerInDynamicArea - capable of recognizing only PLAYER. Is this possible to get it to work on NPCs too?

response:// @down,
You are probably mad. I'm not gonna use timer for that.
Reply

Quote:
Originally Posted by Riddick94
Посмотреть сообщение
IsPlayerInDynamicArea - capable of recognizing only PLAYER. Is this possible to get it to work on NPCs too?
Take the position of the NPC and use IsPointInDynamicArea
Reply

Is there any function like CreateDynamicPlayer3DTextLabel ? (per player labels)
Reply

a_samp.inc
PHP код:
CreatePlayer3DTextLabel(playeridtext[], colorFloat:XFloat:YFloat:ZFloat:DrawDistanceattachedplayer=INVALID_PLAYER_IDattachedvehicle=INVALID_VEHICLE_IDtestLOS=0); 
streamer.inc
Код:
CreateDynamic3DTextLabel(const text[], color, Float:x, Float:y, Float:z, Float:drawdistance,
attachedplayer = INVALID_PLAYER_ID, attachedvehicle = INVALID_VEHICLE_ID, testlos = 0,
worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = STREAMER_3D_TEXT_LABEL_SD, STREAMER_TAG_AREA areaid = STREAMER_TAG_AREA -1, priority = 0);
Reply

Quote:
Originally Posted by AbyssMorgan
Посмотреть сообщение
a_samp.inc
PHP код:
CreatePlayer3DTextLabel(playeridtext[], colorFloat:XFloat:YFloat:ZFloat:DrawDistanceattachedplayer=INVALID_PLAYER_IDattachedvehicle=INVALID_VEHICLE_IDtestLOS=0); 
streamer.inc
Код:
CreateDynamic3DTextLabel(const text[], color, Float:x, Float:y, Float:z, Float:drawdistance,
attachedplayer = INVALID_PLAYER_ID, attachedvehicle = INVALID_VEHICLE_ID, testlos = 0,
worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = STREAMER_3D_TEXT_LABEL_SD, STREAMER_TAG_AREA areaid = STREAMER_TAG_AREA -1, priority = 0);
I've worked with dynamic labels per player but for some reason they get attached to wrong player when the player disconnects/ dies/ spectates, while I also destroy label on OnPlayerDeath, OPDisconnect and in such other places.
Reply

This is my function, when admin creates an item on the server:

pawn Код:
PublicEx OnAdminCreateItem(playerid, objectid, itemid, modelid, quantity, Float:x, Float:y, Float:z)
{
Streamer_UpdateEx(playerid, x, y, z, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));

new object_data[10];
object_data[0] = itemid;
SerwerData[E_SERWER_LAST_ITEM_UID] = object_data[1] = cache_insert_id();
object_data[2] = modelid;
object_data[3] = _:x;
object_data[4] = _:y;
object_data[5] = _:z;
object_data[6] = GetPlayerVirtualWorld(playerid);
object_data[7] = GetPlayerInterior(playerid);
object_data[8] = quantity;
object_data[9] = INVALID_3DTEXT_ID;

Streamer_SetArrayData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_EXTRA_ID, object_data, sizeof(object_data));
I want to add an extra array 'object_data[10]' but it has to be a string which can hold 64 characters.

pawn Код:
strmid(object_data[10][......], "My text has 64 chars or whatever", 0, 64, 64);
object_data[10] and then it needs to know the amount of chars which is [64]... I can't figure it out and dunno how to do it.

Anyone?
Reply

Create enum

Код:
enum myEnum
{
data_model,
...
data_string[64]
}

new object_data[myEnum];
strmid(object_data[data_string], ...);
Reply

delll.
Reply

Will there ever be support for gang zones?
Reply

Dear Incognito, could you simplify the function 'Streamer_GetNearbyItems', I almost did not understand how it works, how to determine the number of Objects in a given position, could make it something to return a count of objects or to show an example.
Reply

Quote:
Originally Posted by Salik
Посмотреть сообщение
Dear Incognito, could you simplify the function 'Streamer_GetNearbyItems', I almost did not understand how it works, how to determine the number of Objects in a given position, could make it something to return a count of objects or to show an example.
https://github.com/samp-incognito/sa...GetNearbyItems
That has all the info you need. If you wish to grab the number of objects in that position after using the native, you can use 'strlen(yourarray)'.
Reply

Quote:
Originally Posted by TommyB
Посмотреть сообщение
https://github.com/samp-incognito/sa...GetNearbyItems
That has all the info you need. If you wish to grab the number of objects in that position after using the native, you can use 'strlen(yourarray)'.
Do you think I did not watch the wiki? If you can help me make this function, it will stupidly return 0 or 1 ...
Not just a return, to the array ...
Reply

22 commits since 2.9.1. When is 2.9.2 coming? I'm getting sick of the checkpoint bug where they don't show until you re-enter the area. I know that one of the commits fixes this. I'd have thought you'd released 2.9.2 by now so people can download it, use it, and not experience that horrific bug.
Reply


Forum Jump:


Users browsing this thread: 15 Guest(s)