Advertisement
Guest User

Bug

a guest
Jan 13th, 2022
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.68 KB | None | 0 0
  1. YCMD:createvehicle(playerid, params[], help) {
  2. new Float: Pos[3], Float: Angle, string[256], szQuery[500], modelid, color[2];
  3. if(PlayerInfo[playerid][pScripter] < 1) return true;
  4. if(sscanf(params, "iii", modelid, color[0], color[1])) return SCM(playerid, COLOR_GREY, "Syntax: {FFFFFF}/createvehicle <model> <color1> <color2>");
  5. if(400 <= modelid >= 611) return SCM(playerid, COLOR_GREY, "Invalid vehicle id. (400 - 611)");
  6. if(!(0 <= color[0] <= 255 && 0 <= color[1] <= 255)) return SCM(playerid, COLOR_GREY, "Invalid color id. (0 - 255)");
  7. if(IsPlayerInAnyVehicle(playerid)) return true;
  8.  
  9. GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
  10. GetPlayerFacingAngle(playerid, Angle);
  11. new carid = CreateVehicle(modelid, Pos[0], Pos[1], Pos[2], Angle, color[0], color[1], -1);
  12. ServerVehicles[carid][vSpawned] = carid;
  13. SetVehicleNumberPlate(ServerVehicles[carid][vSpawned], "NewCar");
  14. PutPlayerInVehicleEx(playerid, ServerVehicles[carid][vSpawned], 0);
  15. ServerVehicles[carid][vID] = carid;
  16. ServerVehicles[carid][vModel] = modelid;
  17. ServerVehicles[carid][vLocation][0] = Pos[0];
  18. ServerVehicles[carid][vLocation][1] = Pos[1];
  19. ServerVehicles[carid][vLocation][2] = Pos[2];
  20. ServerVehicles[carid][vAngle] = Angle;
  21. ServerVehicles[carid][vColor][0] = color[0];
  22. ServerVehicles[carid][vColor][1] = color[1];
  23.  
  24. mysql_format(SQL, szQuery, sizeof(szQuery),
  25. "INSERT INTO `svehicles` (vModel, LocationX, LocationY, LocationZ, Angle, Color1, Color2) VALUES ('%d', '%f', '%f', '%f', '%f', '%d', '%d')", modelid, Pos[0], Pos[1], Pos[2], ServerVehicles[carid][vAngle], color[0], color[1]);
  26. mysql_tquery(SQL, szQuery, "", "");
  27. format(string, sizeof(string), "Ai creat cu succes un %s (vID: %d).", aVehicleNames[modelid - 400], carid);
  28. SCM(playerid, COLOR_LGREEN, string);
  29. format(string, sizeof(string), "Acesta a fost adaugat cu succes in baza de date iar acum sunt in total %d vehicule!", carid);
  30. SCM(playerid, COLOR_LGREEN, string);
  31. SCM(playerid, COLOR_LGREEN, "Daca vrei sa modifici acest vehicul, foloseste comanda /editvehicle.");
  32. return true;
  33. }
  34.  
  35.  
  36. function LoadPlayerCars(playerid) {
  37. gQuery[0] = EOS;
  38. mysql_format(SQL, gQuery, sizeof(gQuery), "SELECT * FROM `cars` WHERE `Userid`='%d' LIMIT %d", PlayerInfo[playerid][pSQLID], MAX_PLAYER_VEHICLE);
  39. mysql_tquery(SQL, gQuery, "SQL_LoadVehicles", "i", playerid);
  40. return true;
  41. }
  42. function SQL_LoadVehicles(playerid) {
  43. new componenets[20], coordonate[50], Mods[50];
  44. if(cache_num_rows() == 0)
  45. return true;
  46.  
  47. for(new i = 0; i < cache_num_rows(); i++) {
  48. new id = Iter_Free(PersonalVehicles);
  49.  
  50. new ORM:ormid = orm_create("cars");
  51.  
  52. orm_addvar_string(ormid, CarInfo[id][cOwner], 32, "Owner");
  53. orm_addvar_string(ormid, CarInfo[id][cText], 32, "Text");
  54. orm_addvar_string(ormid, CarInfo[id][cLicense], 32, "License");
  55.  
  56. orm_addvar_int(ormid, CarInfo[id][cID], "ID");
  57. orm_addvar_int(ormid, CarInfo[id][cModel], "Model");
  58. orm_addvar_int(ormid, CarInfo[id][cNeon], "Neon");
  59. orm_addvar_float(ormid, CarInfo[id][cLocationx], "Locationx");
  60. orm_addvar_float(ormid, CarInfo[id][cLocationy], "Locationy");
  61. orm_addvar_float(ormid, CarInfo[id][cLocationz], "Locationz");
  62. orm_addvar_float(ormid, CarInfo[id][cAngle], "Angle");
  63. orm_addvar_float(ormid, CarInfo[id][KM], "KM");
  64. orm_addvar_int(ormid, CarInfo[id][cTemporarTime], "TemporarTime");
  65. orm_addvar_int(ormid, CarInfo[id][cTemporar], "Temporar");
  66. orm_addvar_int(ormid, CarInfo[id][cVirtual], "Virtual");
  67. orm_addvar_int(ormid, CarInfo[id][cColorOne], "ColorOne");
  68. orm_addvar_int(ormid, CarInfo[id][cColorTwo], "ColorTwo");
  69. orm_addvar_int(ormid, CarInfo[id][cTextColor], "ColorText");
  70. orm_addvar_int(ormid, CarInfo[id][cValue], "Value");
  71. orm_addvar_int(ormid, CarInfo[id][cAlarm], "Alarm");
  72. orm_addvar_int(ormid, CarInfo[id][cLock], "Lockk");
  73. orm_addvar_int(ormid, CarInfo[id][paintjob], "paintjob");
  74. orm_addvar_int(ormid, CarInfo[id][Userid], "Userid");
  75. orm_addvar_int(ormid, CarInfo[id][cTimeGoto], "TimeGoto");
  76. orm_addvar_int(ormid, CarInfo[id][Confiscated], "Confiscated");
  77. orm_addvar_int(ormid, CarInfo[id][cSpecial], "Special");
  78. orm_addvar_int(ormid, CarInfo[id][cTax], "Tax");
  79. orm_addvar_int(ormid, CarInfo[id][cPoints], "Points");
  80. orm_addvar_int(ormid, CarInfo[id][cFuel], "Fuel");
  81. orm_addvar_int(ormid, CarInfo[id][cVip], "VIP");
  82. orm_addvar_int(ormid, CarInfo[id][cRainBow], "RainBow");
  83. orm_addvar_int(ormid, CarInfo[id][cLegendary], "Legendary");
  84. orm_addvar_int(ormid, CarInfo[id][cStage], "Stage");
  85. orm_addvar_int(ormid, CarInfo[id][Dayss], "Days");
  86. orm_addvar_string(ormid, componenets, 20, "Components");
  87. orm_addvar_string(ormid, Mods, 50, "Mods");
  88. orm_addvar_string(ormid, coordonate, 50, "Cordonate");
  89.  
  90. orm_apply_cache(ormid, i);
  91.  
  92. CarInfo[id][cMaxSpeed] = GetVehicleMaxSpeed(CarInfo[id][cModel]);
  93. CarInfo[id][cTime] = -1;
  94. CarInfo[id][cOnline] = playerid;
  95.  
  96. sscanf(Mods, "p<|>iiiiiiiiiiiiii", CarInfo[id][cMod][0], CarInfo[id][cMod][1], CarInfo[id][cMod][2], CarInfo[id][cMod][3], CarInfo[id][cMod][4], CarInfo[id][cMod][5], CarInfo[id][cMod][6],
  97. CarInfo[id][cMod][7], CarInfo[id][cMod][8], CarInfo[id][cMod][9], CarInfo[id][cMod][10], CarInfo[id][cMod][11], CarInfo[id][cMod][12], CarInfo[id][cMod][13]);
  98. sscanf(coordonate, "p<|>ffffff", CarInfo[id][cVipPos][0], CarInfo[id][cVipPos][1], CarInfo[id][cVipPos][2], CarInfo[id][cVipPos][3], CarInfo[id][cVipPos][4], CarInfo[id][cVipPos][5]);
  99.  
  100. Iter_Add(MyVehicle[playerid], id);
  101. Iter_Add(PersonalVehicles, id);
  102. }
  103. return true;
  104. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement