Closed buridan1999 closed 6 years ago
Okey, I find solution of the problem:
if (Name.compare("OnDynamicObjectMoved") == 0) // Or without string with strcmp.
{
std::cout << "OnDynamicObjectMoved(" << params[1] << ")" << std::endl;
}
But, why the first variant stopped working? I don't understand?
OLD VARIANT:
PLUGIN_EXPORT bool PLUGIN_CALL OnPublicCall( AMX * amx, const char * name, cell * params, cell * retval )
{
std::string Name = std::string( name );
// Streamer
if( Name == "OnDynamicObjectMoved" )
{
// int object_id = static_cast<int>( params[ 1 ] ); // ( int objectid )
// Manipulation with parametrs, and other code
// return OnDynamicObjectMoved( object_id );
return OnDynamicObjectMoved( static_cast<int>(params[1]) );
}
return 1;
}
In header: bool OnDynamicObjectMoved(int objectid);
In cpp:
PLUGIN_EXPORT bool PLUGIN_CALL OnPublicCall(AMX *amx, const char *name, cell *params, cell *retval)
{
auto Name = std::string(name);
}
ERRORS: LNK2019 unauthorized external character reference "bool __cdecl OnDynamicObjectMoved(int)" (?OnDynamicObjectMoved@@YA_NH@Z)in function _OnPublicCall@16 helloworld E:\samp_server\project\PROJECT_BINARY_DIR\streamer.obj 1
1 month ago streamer hook work fine, but now I open project again and it broken. I think it connected with DLL location... But it's linked already...