brandonleeds
Active member
- Joined
- Oct 15, 2014
- Messages
- 28
- Reaction score
- 0
0x688 link said:go ahead and add it the source is included.
It's to much of lack coding, that am not good at however, if anybody dose this would be very useful to me.
The source code i edited is below am not sure if correct or not however, it dose not work.
Can you at least give me a hint.
Code:
void CMapRecorder::CMDSave( PCHAR szCmd )
{
SAMP::CChatWindow* pChatWindow = CCheat::Instance()->ChatWindow();
if ( Instance()->m_mmObjects.size() == 0 )
{
pChatWindow->AddClientMessage( -0, "===================================" );
pChatWindow->AddClientMessage( -1, " Warning: No objects were recorded." );
pChatWindow->AddClientMessage( -0, "===================================" );
return;
}
CMDStopRecording( "" );
char szFileName[ MAX_PATH ] = { 0 };
char szFile[ MAX_PATH ] = { 0 };
char format = 0;
int nParams = sscanf_s( szCmd, "%s %c", szFileName, sizeof( szFileName ), &format, sizeof( format ) );
if ( nParams < 1 )
{
pChatWindow->AddClientMessage( -0, "===================================" );
pChatWindow->AddClientMessage( -1, " Usage: /mrsave <filename> [format]" );
pChatWindow->AddClientMessage( -0, "===================================" );
return;
}
const char *szSAMPUserFilesPath = SAMP::Manager::GetPointer< char >( SAMP::MA_USERFILES_SAMP_PATH );
strcat_s( szFile, szSAMPUserFilesPath );
strcat_s( szFile, "\\" );
strcat_s( szFile, szFileName );
strcat_s( szFile, ".txt" );
FILE *pFile;
fopen_s( &pFile, szFile, "w" );
if ( pFile == NULL )
{
pChatWindow->AddClientMessage( -0, "===================================" );
pChatWindow->AddClientMessage( -1, " Error: Could not create file." );
pChatWindow->AddClientMessage( -0, "===================================" );
return;
}
for ( std::multimap< short, stObject >::iterator it = Instance()->m_mmObjects.begin(); it != Instance()->m_mmObjects.end(); ++it )
{
switch ( format )
{
case 'd':
fprintf_s( pFile, "CreateDynamicObject(%hd, %f, %f, %f, %f, %f, %f);\n", it->first,
it->second.x, it->second.y, it->second.z,
it->second.rx, it->second.ry, it->second.rz );
break;
default:
fprintf_s( pFile, "CreateObject(%hd, %f, %f, %f, %f, %f, %f);\n", it->first,
it->second.x, it->second.y, it->second.z,
it->second.rx, it->second.ry, it->second.rz );
case `m`:
fprintf_s(pFile, "SetObjectMaterial(%hd, %f, %f, %f, %f, %f, %f);\n", it->first,
it->second.x, it->second.y, it->second.z,
it->second.rx, it->second.ry, it->second.rz );
break;
};
}
fclose( pFile );
Instance()->m_mmObjects.clear();
pChatWindow->AddClientMessage( -0, "===================================" );
pChatWindow->AddClientMessage( -1, " MapRecorder: objects saved!" );
pChatWindow->AddClientMessage( -0, "===================================" );
}
Code:
case `m`:
fprintf_s(pFile, "SetObjectMaterial(%hd, %f, %f, %f, %f, %f, %f);\n", it->first,
it->second.x, it->second.y, it->second.z,
it->second.rx, it->second.ry, it->second.rz );
break;