06.05.2017, 13:10
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.
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.
|
stock GetPlayerCameraDynamicObject(playerid)return Streamer_GetItemStreamerID(playerid, STREAMER_TYPE_OBJECT, GetPlayerCameraTargetObject(playerid));
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;
}
}
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.
|
Streamer_GetArrayData(STREAMER_TYPE_OBJECT, 0 /*PlayerData[playerid][E_PLAYER_LOOKING_AT_ITEMID]*/, E_STREAMER_EXTRA_ID, object_data, sizeof(object_data));
if(Streamer_IsInArrayData(STREAMER_TYPE_OBJECT, 0 /*PlayerData[playerid][E_PLAYER_LOOKING_AT_ITEMID]*/, E_STREAMER_EXTRA_ID, object_data[9]))
*** Streamer Plugin: Streamer_GetArrayData: Invalid ID specified. *** Streamer Plugin: Streamer_IsInArrayData: Invalid ID specified. |
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]))
PlayerData[playerid][E_PLAYER_LOOKING_AT_ITEMID] = PlayerData[playerid][E_PLAYER_LOOKING_AT_PLAYERID] = -1;
new lookingat_objectid = GetPlayerCameraTargetDynObject(playerid);
CreatePlayer3DTextLabel(playerid, text[], color, Float:X, Float:Y, Float:Z, Float:DrawDistance, attachedplayer=INVALID_PLAYER_ID, attachedvehicle=INVALID_VEHICLE_ID, testLOS=0);
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);
a_samp.inc
PHP код:
Код:
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); |
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));
strmid(object_data[10][......], "My text has 64 chars or whatever", 0, 64, 64);
enum myEnum { data_model, ... data_string[64] } new object_data[myEnum]; strmid(object_data[data_string], ...);
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)'. |