Advertisement
Guest User

Untitled

a guest
Mar 10th, 2019
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. YCMD:createvehicle(playerid, params[], help)
  2. {
  3. new Float: Pos[3], Float: Angle, string[256], szQuery[500], modelid, color[2];
  4. if(PlayerInfo[playerid][pAdmin] < 6) return 1;
  5. if(sscanf(params, "iii", modelid, color[0], color[1])) return SCM(playerid, COLOR_WHITE, "{008080}USAGE: {FFFFFF}/createvehicle <model> <color1> <color2>");
  6. if(400 <= modelid >= 611) return SCM(playerid, COLOR_GREY, "Invalid vehicle id. (400 - 611)");
  7. if(!(0 <= color[0] <= 255 && 0 <= color[1] <= 255)) return SCM(playerid, COLOR_GREY, "Invalid color id. (0 - 255)");
  8. if(IsPlayerInAnyVehicle(playerid)) return 1;
  9.  
  10. GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
  11. GetPlayerFacingAngle(playerid, Angle);
  12. new carid = GetServerVehicles()+1;
  13. ServerVehicles[carid][vSpawned] = CreateVehicle(modelid, Pos[0], Pos[1], Pos[2], Angle, color[0], color[1], -1);
  14. SetVehicleNumberPlate(ServerVehicles[carid][vSpawned], "NewCar");
  15. PutPlayerInVehicleEx(playerid, ServerVehicles[carid][vSpawned], 0);
  16. ServerVehicles[carid][vID] = carid;
  17. ServerVehicles[carid][vModel] = modelid;
  18. ServerVehicles[carid][vLocation][0] = Pos[0];
  19. ServerVehicles[carid][vLocation][1] = Pos[1];
  20. ServerVehicles[carid][vLocation][2] = Pos[2];
  21. ServerVehicles[carid][vAngle] = Angle;
  22. ServerVehicles[carid][vColor][0] = color[0];
  23. ServerVehicles[carid][vColor][1] = color[1];
  24.  
  25. mysql_format(SQL, szQuery, sizeof(szQuery),
  26. "INSERT INTO `svehicles` (vID, vModel, LocationX, LocationY, LocationZ, Angle, Color1, Color2) VALUES ('%d', '%d', '%f', '%f', '%f', '%f', '%d', '%d')", carid, modelid, Pos[0], Pos[1], Pos[2], ServerVehicles[carid][vAngle], color[0], color[1]);
  27. mysql_query(SQL, szQuery);
  28. format(string, sizeof(string), "Ai creat cu succes un %s (vID: %d).", aVehicleNames[modelid - 400], carid);
  29. SCM(playerid, COLOR_LGREEN, string);
  30. format(string, sizeof(string), "Acesta a fost adaugat cu succes in baza de date iar acum sunt in total %d vehicule!", GetServerVehicles());
  31. SCM(playerid, COLOR_LGREEN, string);
  32. SCM(playerid, COLOR_LGREEN, "Daca vrei sa modifici acest vehicul, foloseste comanda /editvehicle.");
  33. return 1;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement