Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void dumpStreamedVehicles(void)
- {
- traceLastFunc("dumpStreamedVehicles()");
- struct actor_info *self = actor_info_get(ACTOR_SELF, 0);
- if (g_SAMP->pPools->pPool_Vehicle == NULL)
- return;
- FILE *fveh = NULL;
- SYSTEMTIME time;
- char filename[512];
- int i;
- int vehcount = 0;
- float *coord = (cheat_state->state == CHEAT_STATE_VEHICLE) ? cheat_state->vehicle.coords : cheat_state->actor.coords;
- GetLocalTime(&time);
- for (i = 0; i < SAMP_VEHICLE_MAX; i++)
- {
- if (g_SAMP->pPools->pPool_Vehicle->iIsListed[i] != 1)
- continue;
- if (g_SAMP->pPools->pPool_Vehicle->pSAMP_Vehicle[i] == NULL)
- continue;
- if (g_SAMP->pPools->pPool_Vehicle->pSAMP_Vehicle[i]->pGTA_Vehicle == NULL)
- continue;
- vehcount++;
- }
- snprintf(filename, sizeof(filename), "%s\\" M0D_FOLDER "vehicle_%02d-%02d-%02d-%02d-%02d-%02d_%d.log", g_szWorkingDirectory, time.wYear, time.wMonth, time.wDay, time.wHour, time.wMinute, time.wSecond, vehcount);
- fveh = fopen(filename, "w");
- if (fveh == NULL)
- return;
- fprintf(fveh, "# Object dump file. Date and time of creation: %02d. %02d. %02d. %02d:%02d:%02d.\n", time.wYear, time.wMonth, time.wDay, time.wHour, time.wMinute, time.wSecond);
- fprintf(fveh, "# Created on this server: %s (%s:%d).\n", g_SAMP->szHostname, g_SAMP->szIP, g_SAMP->ulPort);
- fprintf(fveh, "# Position of creation: %.2f, %.2f, %.2f (Interior: %d).\n", coord[0], coord[1], coord[2], gta_interior_id_get());
- fprintf(fveh, "# Number of vehicles: %d.", vehcount);
- fprintf(fveh, "\n\n");
- for (i = 0; i < SAMP_VEHICLE_MAX; i++)
- {
- if (g_SAMP->pPools->pPool_Vehicle->iIsListed[i] != 1)
- continue;
- if (g_SAMP->pPools->pPool_Vehicle->pSAMP_Vehicle[i] == NULL)
- continue;
- if (g_SAMP->pPools->pPool_Vehicle->pSAMP_Vehicle[i]->pGTA_Vehicle == NULL)
- continue;
- DWORD baseObjAddr = (DWORD)g_SAMP->pPools->pPool_Vehicle->pSAMP_Vehicle[i];
- float pos[3];
- float rot[3];
- vect3_copy(&g_SAMP->pPools->pPool_Vehicle->pSAMP_Vehicle[i]->pGTA_Vehicle->base.matrix[4 * 3], pos);
- int id = g_SAMP->pPools->pPool_Vehicle->pSAMP_Vehicle[i]->pGTA_Vehicle_->base.model_alt_id;
- if (vect3_near_zero(pos))
- continue;
- fprintf(fveh, "CreateVehicle(%d, %f, %f, %f, 0.0 %d, %d, 50000);//%d\n", id, pos[0], pos[1], pos[2], g_SAMP->pPools->pPool_Vehicle->pSAMP_Vehicle[i]->pGTA_Vehicle->color[0], g_SAMP->pPools->pPool_Vehicle->pSAMP_Vehicle[i]->pGTA_Vehicle->color[1], vehcount);
- }
- fclose(fveh);
- cheat_state_text("Streamed vehicles successfully dumped. Output: %s", filename);
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement