Advertisement
Guest User

Untitled

a guest
Mar 28th, 2015
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. void dumpStreamedVehicles(void)
  2. {
  3. traceLastFunc("dumpStreamedVehicles()");
  4.  
  5. struct actor_info *self = actor_info_get(ACTOR_SELF, 0);
  6. if (g_SAMP->pPools->pPool_Vehicle == NULL)
  7. return;
  8.  
  9. FILE *fveh = NULL;
  10. SYSTEMTIME time;
  11. char filename[512];
  12. int i;
  13. int vehcount = 0;
  14. float *coord = (cheat_state->state == CHEAT_STATE_VEHICLE) ? cheat_state->vehicle.coords : cheat_state->actor.coords;
  15.  
  16. GetLocalTime(&time);
  17.  
  18. for (i = 0; i < SAMP_VEHICLE_MAX; i++)
  19. {
  20. if (g_SAMP->pPools->pPool_Vehicle->iIsListed[i] != 1)
  21. continue;
  22. if (g_SAMP->pPools->pPool_Vehicle->pSAMP_Vehicle[i] == NULL)
  23. continue;
  24. if (g_SAMP->pPools->pPool_Vehicle->pSAMP_Vehicle[i]->pGTA_Vehicle == NULL)
  25. continue;
  26. vehcount++;
  27. }
  28.  
  29. 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);
  30. fveh = fopen(filename, "w");
  31.  
  32. if (fveh == NULL)
  33. return;
  34.  
  35. 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);
  36. fprintf(fveh, "# Created on this server: %s (%s:%d).\n", g_SAMP->szHostname, g_SAMP->szIP, g_SAMP->ulPort);
  37. fprintf(fveh, "# Position of creation: %.2f, %.2f, %.2f (Interior: %d).\n", coord[0], coord[1], coord[2], gta_interior_id_get());
  38. fprintf(fveh, "# Number of vehicles: %d.", vehcount);
  39.  
  40. fprintf(fveh, "\n\n");
  41.  
  42. for (i = 0; i < SAMP_VEHICLE_MAX; i++)
  43. {
  44. if (g_SAMP->pPools->pPool_Vehicle->iIsListed[i] != 1)
  45. continue;
  46. if (g_SAMP->pPools->pPool_Vehicle->pSAMP_Vehicle[i] == NULL)
  47. continue;
  48. if (g_SAMP->pPools->pPool_Vehicle->pSAMP_Vehicle[i]->pGTA_Vehicle == NULL)
  49. continue;
  50. DWORD baseObjAddr = (DWORD)g_SAMP->pPools->pPool_Vehicle->pSAMP_Vehicle[i];
  51. float pos[3];
  52. float rot[3];
  53. vect3_copy(&g_SAMP->pPools->pPool_Vehicle->pSAMP_Vehicle[i]->pGTA_Vehicle->base.matrix[4 * 3], pos);
  54. int id = g_SAMP->pPools->pPool_Vehicle->pSAMP_Vehicle[i]->pGTA_Vehicle_->base.model_alt_id;
  55. if (vect3_near_zero(pos))
  56. continue;
  57.  
  58. 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);
  59.  
  60. }
  61.  
  62. fclose(fveh);
  63.  
  64. cheat_state_text("Streamed vehicles successfully dumped. Output: %s", filename);
  65. return;
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement