Advertisement
Guest User

Untitled

a guest
Jul 5th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.72 KB | None | 0 0
  1. function GiveVehicle(playerid, modelid) {
  2. CP[playerid] = 53;
  3. new string[180];
  4.  
  5. new idd;
  6. format(string, sizeof(string), "INSERT INTO cars (Model) VALUES (%d)", modelid);
  7. new Cache: result = mysql_query(SQL, string);
  8. new i = cache_insert_id();
  9. cache_delete(result);
  10. idd = i;
  11.  
  12. new key = FindCSlot(playerid);
  13. PlayerInfo[playerid][pCarKey][key-1] = idd;
  14. mysql_format(SQL, string, sizeof(string), "UPDATE users SET CarKey%d='%d' WHERE `ID`='%d' LIMIT 1", key, PlayerInfo[playerid][pCarKey][key-1], PlayerInfo[playerid][pSQLID]);
  15. mysql_tquery(SQL, string, "", "");
  16.  
  17. CarInfo[idd][Userid] = PlayerInfo[playerid][pSQLID];
  18. CarInfo[idd][cID] = idd;
  19. CarInfo[idd][cModel] = modelid;
  20. CarInfo[idd][cValue] = 1;
  21. CarInfo[idd][cSpecial] = 1;
  22. new randspawn = random(sizeof(DealerCarPos1));
  23. CarInfo[idd][cLocationx] = DealerCarPos1[randspawn][0]; CarInfo[idd][cLocationy] = DealerCarPos1[randspawn][1]; CarInfo[idd][cLocationz] = DealerCarPos1[randspawn][2];
  24. CarInfo[idd][cAngle] = DealerCarPos1[randspawn][3];
  25. CarInfo[idd][cColorOne] = 1; CarInfo[idd][cColorTwo] = 1;
  26. strmid(CarInfo[idd][cOwner], PlayerInfo[playerid][pUsername], 0, strlen(PlayerInfo[playerid][pUsername]), 255);
  27. strmid(CarInfo[idd][cLicense], "NewCar", 0, 6, 255);
  28. CarInfo[idd][cAlarm] = 0; CarInfo[idd][cLock] = 0;
  29. CarInfo[idd][mod0] = 0; CarInfo[idd][mod1] = 0; CarInfo[idd][mod2] = 0; CarInfo[idd][mod3] = 0;
  30. CarInfo[idd][mod4] = 0; CarInfo[idd][mod5] = 0; CarInfo[idd][mod6] = 0; CarInfo[idd][mod7] = 0;
  31. CarInfo[idd][mod8] = 0; CarInfo[idd][mod9] = 0; CarInfo[idd][mod10] = 0; CarInfo[idd][mod11] = 0;
  32. CarInfo[idd][mod12] = 0; CarInfo[idd][mod13] = 0; CarInfo[idd][paintjob] = 3; CarInfo[idd][KM] = 0;
  33.  
  34. CarInfo[idd][cPoints] = 5; CarInfo[idd][cTax] = 50;
  35. saveCar(idd);
  36. mysql_tquery(SQL, string, "", "");
  37.  
  38. CarInfo[idd][Spawned] = CreateVehicleEx(CarInfo[idd][cModel],CarInfo[idd][cLocationx],CarInfo[idd][cLocationy],CarInfo[idd][cLocationz],CarInfo[idd][cAngle],CarInfo[idd][cColorOne],CarInfo[idd][cColorTwo],-1);
  39. new e,l,aa,d,b,bo,o;
  40. GetVehicleParamsEx(CarInfo[idd][Spawned],e,l,aa,d,b,bo,o);
  41. SetVehicleParamsEx(CarInfo[idd][Spawned],e,l,aa,1,b,bo,o);
  42. SetVehicleNumberPlate(CarInfo[idd][Spawned],CarInfo[idd][cLicense]);
  43. CarInfo[idd][cLock] = 1;
  44.  
  45. format(string, sizeof(string), "Shop: %s si-a cumparat un %s[%d].", GetName(playerid), aVehicleNames[CarInfo[idd][cModel]-400], idd);
  46. submitToAdmins(COLOR_GREY, string, 1);
  47. InsertLog(playerid, string, LOG_CAR);
  48.  
  49. VehicleOwned[CarInfo[idd][Spawned]] = CarInfo[idd][Spawned];
  50. VehicleSQL[CarInfo[idd][Spawned]] = idd;
  51.  
  52. mysql_format(SQL, string, sizeof(string), "UPDATE cars SET Spawned='%d' WHERE ID=%d", CarInfo[idd][Spawned], idd);
  53. mysql_tquery(SQL, string, "", "");
  54. return 1; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement