Closed buridan1999 closed 7 years ago
It should be "iffffffiiiffii" . You forgot the final "ii", from areaid and priority.
I guess that you should receive a warning in console/serverlog because you didn't send enough parameters to the Streamer Plugin.
Thank you a lot! It works. About warning... in the console all was okey. I have one question: What means this "iffffffiiiffii", where can I read about this aurgument?
I watch at this string "iffffffiiiffii", and other aurguments, and if I understand, it is type of values that I use next. Is it right?
i = integer f = float
Well, it is the type of each parameter of your function: modelid is "i" (integer), the next 6 "f"s are from "x, y, z, rx, ry, rz", the 3 "i" are from "worldid, interiorid, playerid", the 2 "f" are from "streamdistance, drawdistance" and the last 2 "i" are from "areaid, priority" .
Few more examples:
bool AttachDynamicObjectToPlayer( int objectid, int playerid, float offsetx, float offsety, float offsetz, float rx, float ry, float rz )
{
static AMX_NATIVE Native = sampgdk::FindNative( "AttachDynamicObjectToPlayer" );
return !!sampgdk::InvokeNative( Native, "iiffffff", objectid, playerid, offsetx, offsety, offsetz, rx, ry, rz );
}
bool GetDynamicObjectMaterialText( int objectid, int materialindex, char text[ ], int * materialsize, char fontface[ ], int * fontsize, int * bold, int * fontcolor, int * backcolor, int * textalignment, int maxtext, int maxfontface )
{
static AMX_NATIVE Native = sampgdk::FindNative( "GetDynamicObjectMaterialText" );
std::string function_format = std::string( "iiA[" ) + std::to_string( maxtext ) + std::string( "]RA[" ) + std::to_string( maxfontface ) + std::string( "]RRRRRii" );
return !!sampgdk::InvokeNative( Native, function_format.c_str( ), objectid, materialindex, text, materialsize, fontface, fontsize, bold, fontcolor, backcolor, textalignment, maxtext, maxfontface );
}
bool SetDynamicObjectPos( int objectid, float x, float y, float z )
{
static AMX_NATIVE Native = sampgdk::FindNative( "SetDynamicObjectPos" );
return !!sampgdk::InvokeNative( Native, "ifff", objectid, x, y, z );
}
bool GetDynamicObjectPos( int objectid, float * x, float * y, float * z )
{
static AMX_NATIVE Native = sampgdk::FindNative( "GetDynamicObjectPos" );
return !!sampgdk::InvokeNative( Native, "iRRR", objectid, x, y, z );
}
I guess that GetDynamicObjectMaterialText
looks pretty hard for you (by the way, I didn't test it, but it should work), but in sampgdk.h (amalgamation) you have this helpful commentary, which could clarify it a bit for you:
/**
* \brief Invokes a native function with the specified argument
*
* Argument types are specified via \p format where each character, or
* *specifier*, corresponds to a single argument. The following format
* specifiers are supported:
*
* Specifier | C/C++ type | Description
* :-------- | :------------ | :-------------------------------------
* i | int | integer value
* d | int | integer value (same as 'i')
* b | bool | boolean value
* f | double | floating-point value
* r | const cell * | const reference (input only)
* R | cell * | non-const reference (both input and output)
* s | const char * | const string (input only)
* S | char * | non-const string (both input and output)
* a | const cell * | const array (input only)
* A | cell * | non-const array (both input and output)
*
* \remarks For the 'S', 'a' and 'A' specifiers you have to specify the size
* of the string/array in square brackets, e.g. "a[100]" (fixed size)
* or s[*2] (size passed via 2nd argument).
*
* \note In Pawn, variadic functions always take their variable arguments
* (those represented by "...") by reference. This means that for such
* functions you have to use the 'r' specifier where you would normally
* use 'b', 'i' 'd' or 'f'.
*
* \param native pointer to the native function.
* \param format argument types
* \param ... arguments themselves
*
* \returns function's return value
*
* \see sampgdk_GetNatives()
* \see sampgdk_FindNative()
* \see sampgdk_InvokeNativeV()
* \see sampgdk_InvokeNativeArray()
*/
SAMPGDK_API(cell, sampgdk_InvokeNative(AMX_NATIVE native,
const char *format, ...));
Also, you could check this post: http://forum.sa-mp.com/showpost.php?p=3863980&postcount=385 . You can see a good idea in the first part, you could use functions like Plugins::Streamer::Object::Create, Plugins::Streamer::Object::Destroy, Plugins::Streamer::Object::GetPos, Plugins::Streamer::Object::SetPos, which looks pretty great and organised.
Thank you very much! Very helpfull!
I made a rewrite: https://github.com/Sphinxila/samp-plugin-streamer
With this you can integrate the streamer directly.
You can use this events in your gamemode. https://github.com/Sphinxila/samp-plugin-streamer/blob/master/src/include/streamer/streamer.hpp#L34
I try to integrate Streamer by Incognoto, and try this code, but it doesn't work. Where cam be a mistake?
And that like I call function: CreateDynamicObject(648, 2222.96, -1162.52, 9.78, 0.00, 0.00, 0.00, -1, -1, -1, 200.0, 50.0, -1, 0);