Advertisement
Guest User

Untitled

a guest
Nov 15th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. //===========//
  2. enum E_VEHICLES
  3. {
  4. vSQL,
  5. vID,
  6. vModel,
  7. vColor1,
  8. vColor2,
  9.  
  10. Float:vPosX,
  11. Float:vPosY,
  12. Float:vPosZ,
  13. Float:vPosA,
  14.  
  15. bool:vExist,
  16. };
  17. new vInfo[MAX_VEHICLES][E_VEHICLES];
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24. modeinit:
  25. mysql_tquery(mysql, "SELECT * FROM vehicles", "Load_Vehicles", ""); //VEHICLES
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39. //---------------------------------------------------------------------------------------------//
  40. public Load_Vehicles() //Chargement des véhicules
  41. {
  42.  
  43. new rows, fields, string[256];
  44. cache_get_data(rows, fields);
  45.  
  46.  
  47. print(" ");
  48. print("|__________ CHARGEMENT DES VEHICULES __________|");
  49. if(cache_num_rows() > 0)
  50. {
  51. //for(new i; i < rows; i++)
  52. for(new i = 1; i < rows; i++)
  53. {
  54.  
  55.  
  56. vInfo[i][vSQL] = cache_get_field_content_int(i, "id");
  57. vInfo[i][vModel] = cache_get_field_content_int(i, "model");
  58. vInfo[i][vColor1] = cache_get_field_content_int(i, "color1");
  59. vInfo[i][vColor2] = cache_get_field_content_int(i, "color2");
  60.  
  61. vInfo[i][vPosX] = cache_get_field_content_float(i, "x");
  62. vInfo[i][vPosY] = cache_get_field_content_float(i, "y");
  63. vInfo[i][vPosZ] = cache_get_field_content_float(i, "z");
  64. vInfo[i][vPosA] = cache_get_field_content_float(i, "a");
  65.  
  66.  
  67.  
  68. vInfo[i][vID] = CreateVehicle(vInfo[i][vModel], vInfo[i][vPosX], vInfo[i][vPosY], vInfo[i][vPosZ], vInfo[i][vPosA], vInfo[i][vColor1], vInfo[i][vColor2], -1, 0);
  69.  
  70. SetVehicleVirtualWorld(i, 0);
  71.  
  72. vInfo[i][vExist] = true;
  73.  
  74. printf("VEHICLE SQL %d", vInfo[i][vSQL]);
  75.  
  76. }
  77.  
  78. }
  79. print(" ");
  80. printf("%d véhicules trouvés dans la database", rows);
  81. print("|______________________________________________|");
  82. print(" ");
  83. print(" ");
  84.  
  85.  
  86. return true;
  87. }
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102. //---------------------------------------------------------------------------------------------//
  103. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  104. {
  105. new string[256];
  106.  
  107. for(new i; i < MAX_VEHICLES; i++)
  108. {
  109. if(!vInfo[i][vExist]) continue;
  110.  
  111. if(vehicleid == vInfo[i][vID])
  112. {
  113. format(string, sizeof(string), "Vous entrez dans le véhicule %d", vInfo[i][vSQL]);
  114. SendClientMessage(playerid, -1, string);
  115.  
  116. format(string, sizeof(string), "Modèle: %d - Couleur1: %d - Couleur2: %d", vInfo[i][vModel], vInfo[i][vColor1], vInfo[i][vColor2]);
  117. SendClientMessage(playerid, -1, string);
  118.  
  119. break;
  120.  
  121. }
  122.  
  123. }
  124.  
  125. return 1;
  126. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement