Advertisement
Krusher666

Untitled

Aug 15th, 2018
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.09 KB | None | 0 0
  1. function LoadSVehicles() {
  2. new Cache: db = mysql_query (SQL, "SELECT * FROM `svehicles` ORDER BY `svehicles`.`vID` ASC");
  3. new x, servervehs = 0, result[256];
  4. for (new i, j = cache_get_row_count (); i != j; ++i) {
  5. servervehs ++;
  6. cache_get_field_content(i, "vID", result); x = strval(result);
  7. ServerVehicles[x][vID] = x;
  8. cache_get_field_content(i, "vModel", result); ServerVehicles[x][vModel] = strval(result);
  9. cache_get_field_content(i, "LocationX", result); ServerVehicles[x][vLocation][0] = floatstr(result);
  10. cache_get_field_content(i, "LocationY", result); ServerVehicles[x][vLocation][1] = floatstr(result);
  11. cache_get_field_content(i, "LocationZ", result); ServerVehicles[x][vLocation][2] = floatstr(result);
  12. cache_get_field_content(i, "Angle", result); ServerVehicles[x][vAngle] = floatstr(result);
  13. cache_get_field_content(i, "Color1", result); ServerVehicles[x][vColor][0] = strval(result);
  14. cache_get_field_content(i, "Color2", result); ServerVehicles[x][vColor][1] = strval(result);
  15. cache_get_field_content(i, "Faction", result); ServerVehicles[x][vFaction] = strval(result);
  16. cache_get_field_content(i, "Rank", result); ServerVehicles[x][vRank] = strval(result);
  17. cache_get_field_content(i, "Virtual", result); ServerVehicles[x][vVirtual] = strval(result);
  18.  
  19. if(ServerVehicles[x][vModel] >= 400 && ServerVehicles[x][vModel] <= 611) {
  20. ServerVehicles[x][vSpawned] = CreateVehicleEx(ServerVehicles[x][vModel], ServerVehicles[x][vLocation][0], ServerVehicles[x][vLocation][1], ServerVehicles[x][vLocation][2], ServerVehicles[x][vAngle], ServerVehicles[x][vColor][0], ServerVehicles[x][vColor][1], -1);
  21. new idd = ServerVehicles[x][vSpawned];
  22. SetVehicleVirtualWorld(idd, ServerVehicles[idd][vVirtual]);
  23. if(ServerVehicles[idd][vFaction] != 0) {
  24. if(ServerVehicles[idd][vModel] == 411) {
  25. new policecar = CreateObject(19327, 1534.2373, -1643.2886, 5.9373, -87.6999, 90.4001, -87.1805);
  26. SetObjectMaterialText(policecar, "POLICE", 0, 50, "Arial", 25, 1, -16777216, 0, 1);
  27. new lspdcar = CreateObject(19419,0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000);
  28. AttachObjectToVehicle(policecar, idd, 0.0, -1.9, 0.3, 270.0, 0.0, 0.0);
  29. AttachObjectToVehicle(lspdcar, idd, 0.0646, 0.1661, 0.6957, 0.0000, 0.0000, 0.0000);
  30. printf("[debug] attached custom object to vehicle: %d", idd);
  31. }
  32. if(ServerVehicles[idd][vModel] == 560) {
  33. if(ServerVehicles[idd][vFaction] == 12 || ServerVehicles[idd][vFaction] == 13) {
  34. new taiddiobj = CreateObject(19308, 0.00000, 0.00000, 0.00000,0.00000, 0.00000, 0.00000);
  35. AttachObjectToVehicle(taiddiobj, idd, -0.00930, -0.23880, 0.92300,0.00000, 0.00000, 0.00000);
  36. }
  37. }
  38. if(ServerVehicles[idd][vModel] == 541) {
  39. if(ServerVehicles[idd][vFaction] == 2) {
  40. new object1 = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
  41. new object2 = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
  42. AttachObjectToVehicle(object1, idd, 0.375000,0.524999,0.375000,0.000000,0.000000,0.000000);
  43. AttachObjectToVehicle(object2, idd, 0.375000,0.524999,0.375000,0.000000,0.000000,0.000000);
  44. }
  45. }
  46. if(ServerVehicles[idd][vModel] == 525) {
  47. new object1 = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
  48. new object2 = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
  49. AttachObjectToVehicle(object1, idd, -0.600000,-0.485000,1.450000,0.000000,0.000000,0.000000);
  50. AttachObjectToVehicle(object2, idd, 0.600000,-0.485000,1.450000,0.000000,0.000000,0.000000);
  51. }
  52. }
  53.  
  54. new str[64];
  55. if(ServerVehicles[idd][vFaction] != 0) format(str, 64, "F%d %d", ServerVehicles[idd][vFaction], idd);
  56. else format(str, sizeof(str), "RO-0%d", ServerVehicles[x][vSpawned]);
  57. SetVehicleNumberPlate(idd, str);
  58. }
  59. }
  60. printf("Server vehicles: %d", servervehs);
  61. print("Nu merge.");
  62. print("Merge.");
  63. cache_delete(db);
  64. return 1;
  65. }
  66. function GetVehicleID(vehicleid) {
  67. for(new i = 0; i < MAX_SVEHICLES; i++) {
  68. if(ServerVehicles[i][vSpawned] == vehicleid) return i;
  69. }
  70. return 0;
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement