Guest User

Untitled

a guest
Apr 19th, 2019
120
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. enum vInfo
  2. {
  3. vPrixLOC,
  4. vSQL,
  5. vModel,
  6. vJob,
  7. vOwner,
  8. vEtat,
  9. vRent,
  10. vSorti,
  11. vColor1,
  12. vColor2,
  13. vEngine,
  14. vAttEngine,
  15. Float:vGas,
  16. Float:vHealCar,
  17. Float:vKms,
  18. vKey1,
  19. vKey2,
  20. vNumberPlate[6],
  21. vCharge,
  22. Traceur,
  23. vAutoRadio,
  24. vAutoRadioLink[144],
  25. vLock,
  26. vCapot,
  27. vLights,
  28. vCoffreLock,
  29. vCoffreObj[12],
  30. vCoffreInfo[12],
  31. vCoffreSerie[12],
  32. vCoffreIdentif[12],
  33. vCoffreCaisseObj[18],
  34. vCoffreCaisseType[18],
  35. vCoffreCaisseVisibleVar[4],
  36. vCoffreCaisseVisible[4],
  37. Float:vPos[3],
  38. vAlarm,
  39. vDesc[96],
  40. vAlarmState,
  41. Kit[35],
  42. vCarbu,
  43. gCanna,
  44. gStero,
  45. gCoke,
  46. gMeth,
  47. gHero,
  48. Fire[2],
  49. Mod[10],
  50. Helico[2]
  51. };
  52. static VehicleInfo[MAX_VEHICLES][vInfo];
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60. ///////////////////////////////////////////////////////
  61.  
  62.  
  63.  
  64.  
  65. else if(strcmp(tmp, "acheter", true) == 0)
  66. {
  67. tmp = strtok(cmdtext, idx);
  68. if(!strlen(tmp))
  69. {
  70. SendClientMessage(playerid, -1, "USAGE: {AFAFAF}/v acheter [ID/NomDuVehicule] [IDcouleur1] [IDcouleur2]");
  71. return SendClientMessage(playerid, COLOR_USAGE, "Les ID de couleurs sont renseignées en écrivant \"/v couleurs\". Faîtes attention lors de la saisie.");
  72. }
  73.  
  74. if(PlayerInfo[playerid][pLevel] < 2)
  75. return SendClientMessage(playerid, COLOR_RED, "Vous devez être Level 2 pour acheter un véhicule.");
  76.  
  77. new model = ReturnVehicleModel(tmp);
  78. if(model < 400 || model > 611) return SendClientMessage(playerid, COLOR_RED, "Ce nom de véhicule est inconnu.");
  79.  
  80. tmp = strtok(cmdtext, idx);
  81. if(!strlen(tmp))
  82. {
  83. SendClientMessage(playerid, -1, "USAGE: {AFAFAF}/v acheter [ID/NomDuVehicule] [IDcouleur1] [IDcouleur2]");
  84. return SendClientMessage(playerid, COLOR_USAGE, "Les ID de couleurs sont renseignées en écrivant \"/v couleurs\". Faîtes attention lors de la saisie.");
  85. }
  86. new color1 = strval(tmp);
  87. if(!IsValidVehicleColor(color1)) return SendClientMessage(playerid, COLOR_RED, "Couleur1 invalide !");
  88. tmp = strtok(cmdtext, idx);
  89. if(!strlen(tmp))
  90. {
  91. SendClientMessage(playerid, -1, "USAGE: {AFAFAF}/v acheter [ID/NomDuVehicule] [IDcouleur1] [IDcouleur2]");
  92. return SendClientMessage(playerid, COLOR_USAGE, "Les ID de couleurs sont renseignées en écrivant \"/v couleurs\". Faîtes attention lors de la saisie.");
  93. }
  94. new color2 = strval(tmp);
  95. if(!IsValidVehicleColor(color2)) return SendClientMessage(playerid, COLOR_RED, "Couleur2 invalide !");
  96.  
  97. if(VehicleParams[model-400][PRIX] == 0)
  98. {
  99. return SendClientMessage(playerid, COLOR_RED, "Ce modèle de véhicule n'est pas en vente.");
  100. }
  101.  
  102. if(VehicleParams[model-400][PLANE] == 1)
  103. {
  104. if(!IsPlayerInRangeOfPoint(playerid, 3.0, 1956.7676, -2183.7097, 13.5469))
  105. return SendClientMessage(playerid, COLOR_RED, "Vous n'êtes pas au concessionnaire des avions.");
  106. }
  107. else
  108. {
  109. if(VehicleParams[model-400][BOAT] == 1)
  110. {
  111. if(!IsPlayerInRangeOfPoint(playerid, 3.0, 154.0953, -1942.1666, 3.7734))
  112. return SendClientMessage(playerid, COLOR_RED, "Vous n'êtes pas au concessionnaire des bateaux.");
  113. }
  114. else
  115. {
  116. if(!IsPlayerInRangeOfPoint(playerid, 3.0, 2132.0017, -1148.8852, 24.3299))
  117. return SendClientMessage(playerid, COLOR_RED, "Vous n'êtes pas au concessionnaire des voitures classiques.");
  118. }
  119. }
  120.  
  121. if(VehicleParams[model-400][DONATOR] > gDonator[playerid])
  122. {
  123. if(gettime() > gDonator[playerid])
  124. {
  125. return SendClientMessage(playerid, COLOR_RED, "Vous n'êtes pas/plus donator.");
  126. }
  127. }
  128.  
  129. for(new v = 0; v < MAX_VEHICLES; v++)
  130. {
  131. if(VehicleInfo[v][vOwner] == PlayerInfo[playerid][pSQL])
  132. {
  133. format(string, sizeof(string), "Vous avez déjà un véhicule spawn (%s).", VehicleParams[VehicleInfo[v][vModel]-400][NAME]);
  134. SendClientMessage(playerid, COLOR_RED, string);
  135. return 1;
  136. }
  137. }
  138.  
  139. new prix = 0;
  140.  
  141. prix = VehicleParams[model-400][PRIX];
  142.  
  143. if(PlayerInfo[playerid][pBank] < prix)
  144. {
  145. format(string, sizeof(string), "Vous n'avez pas assez d'argent dans votre compte en banque (%s $%d).", VehicleParams[model-400][NAME], VehicleParams[model-400][PRIX]);
  146. SendClientMessage(playerid, COLOR_RED, string);
  147. return 1;
  148. }
  149.  
  150. new playersql = PlayerInfo[playerid][pSQL];
  151. format(query,sizeof(query),"SELECT Count(*) FROM `vehicles` WHERE Owner=%d", playersql);
  152. mysql_tquery(g_Handle, query, "OnPlayerDataVeh", "iiiiii", color1, color2, prix, playerid, playersql, model); // ->>>>>>>>>>>> NICKEL
  153. return 1;
  154. }
  155.  
  156.  
  157.  
  158.  
  159.  
  160. /////////////////////////////////////////////////////////////////////////////////
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169. forward OnPlayerDataVeh(color1, color2, prix, playerid, playersql, model);
  170. public OnPlayerDataVeh(color1, color2, prix, playerid, playersql, model)
  171. {
  172. new rows,
  173. fields,
  174. string[256];
  175.  
  176. cache_get_data(rows, fields);
  177. if(rows)
  178. {
  179. new count;
  180. for(new iSlot, count_nb = cache_get_row_count(); iSlot < count_nb; iSlot++)
  181. {
  182. count++;
  183. }
  184.  
  185. if(count >= 3)
  186. {
  187. return SendClientMessage(playerid, COLOR_RED, "Vous possédez déjà 3 véhicules (maximum).");
  188. }
  189.  
  190. new Float: pos[4];
  191.  
  192. if(VehicleParams[model-400][PLANE] == 1)
  193. {
  194. pos[0] = 1997.5248;
  195. pos[1] = -2194.9395;
  196. pos[2] = 13.5469;
  197. pos[3] = 173.1066;
  198. }
  199. else
  200. {
  201. if(VehicleParams[model-400][BOAT] == 1)
  202. {
  203. pos[0] = 113.6482;
  204. pos[1] = -1952.5614;
  205. pos[2] = 0.5938;
  206. pos[3] = 286.6111;
  207. }
  208. else
  209. {
  210. new rand = random(8);
  211. if(rand == 0) { pos[0] = 2118.1189; pos[1] = -1152.4578; pos[2] = 23.9104; pos[3] = 353.1512; }
  212. else if(rand == 1) { pos[0] = 2134.0391; pos[1] = -1132.2255; pos[2] = 25.3829; pos[3] = 90.7573; }
  213. else if(rand == 1) { pos[0] = 2134.2456; pos[1] = -1127.2827; pos[2] = 25.2597; pos[3] = 88.0522; }
  214. else if(rand == 1) { pos[0] = 2120.3618; pos[1] = -1135.0988; pos[2] = 25.0031; pos[3] = 265.2511; }
  215. else if(rand == 1) { pos[0] = 2149.2908; pos[1] = -1138.5972; pos[2] = 25.1861; pos[3] = 269.5748; }
  216. else if(rand == 1) { pos[0] = 2161.1362; pos[1] = -1143.5836; pos[2] = 24.5667; pos[3] = 91.2258; }
  217. else if(rand == 1) { pos[0] = 2148.9314; pos[1] = -1143.2675; pos[2] = 24.6718; pos[3] = 268.5374; }
  218. else if(rand == 1) { pos[0] = 2161.0310; pos[1] = -1148.3916; pos[2] = 24.0763; pos[3] = 88.5537; }
  219. else if(rand == 1) { pos[0] = 2148.8545; pos[1] = -1152.7941; pos[2] = 23.6491; pos[3] = 269.8862; }
  220. else { pos[0] = 2160.7129; pos[1] = -1157.8556; pos[2] = 23.5452; pos[3] = 90.3864; }
  221. }
  222. }
  223.  
  224. new nbplate[6];
  225. nbplate = VehiclePlate();
  226. new Float:gas = VehicleParams[model-400][RESERVOIR]/2;
  227.  
  228. mysql_format(g_Handle, string,sizeof(string),"INSERT INTO `vehicles` (Model, Job, Owner, PosX, PosY, PosZ, Rot, Color1, Color2, Gas, HealCar, Key1, Key2, NumberPlate) VALUES (%d, %d, %d, '%0.4f', '%0.4f', '%0.4f', '%0.4f', %d, %d, %0.4f, %0.2f, %d, %d, '%e')",
  229. model, 0, playersql, pos[0], pos[1], pos[2], pos[3], color1, color2, gas, 1000.0, playersql, playersql, nbplate);
  230.  
  231. mysql_tquery(g_Handle, string, "OnPlayerDataVeh1", "siiiiifff", nbplate, color1, color2, model, playerid, prix, pos[0], pos[1], pos[2]);
  232. }
  233. return 1;
  234. }
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243. //////////////////////////////////////////////////////////
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251. forward OnPlayerDataVeh1(nbplate[], color1, color2, model, playerid, prix, Float:xx, Float:yy, Float:zz);
  252. public OnPlayerDataVeh1(nbplate[], color1, color2, model, playerid, prix, Float:xx, Float:yy, Float:zz)
  253. {
  254. new string[144];
  255. format(string, sizeof(string), "SELECT * FROM `vehicles` WHERE VEHid = %d", cache_insert_id());
  256. mysql_tquery(g_Handle, string, "DataLoadVeh", "iii", cache_insert_id(), playerid, 2); // ->>>>>>>>>>>> NICKEL
  257.  
  258. PlayerInfo[playerid][pBank] -= prix;
  259. return 1;
  260. }
RAW Paste Data