Advertisement
Guest User

comanda /park

a guest
Feb 10th, 2017
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1. CMD:park(playerid, params[])
  2. {
  3. new string[128], idd;
  4. if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_YELLOW2, "Error: You aren't in any vehicle!");
  5. new car = GetPlayerVehicleID(playerid);
  6. new car1 = PlayerInfo[playerid][pCarKey1], car2 = PlayerInfo[playerid][pCarKey2], car3 = PlayerInfo[playerid][pCarKey3], car4 = PlayerInfo[playerid][pCarKey4], car5 = PlayerInfo[playerid][pCarKey5];
  7. new valid = PlayerInfo[playerid][pCarKey1] + PlayerInfo[playerid][pCarKey2] + PlayerInfo[playerid][pCarKey3] + PlayerInfo[playerid][pCarKey4] + PlayerInfo[playerid][pCarKey5];
  8. if(valid == 0) return SendClientMessage(playerid, COLOR_YELLOW2, "Eroare: Nu ai un vehicul personal!");
  9. if(car == CarInfo[car1][Spawned]) idd = PlayerInfo[playerid][pCarKey1];
  10. if(car == CarInfo[car2][Spawned]) idd = PlayerInfo[playerid][pCarKey2];
  11. if(car == CarInfo[car3][Spawned]) idd = PlayerInfo[playerid][pCarKey3];
  12. if(car == CarInfo[car4][Spawned]) idd = PlayerInfo[playerid][pCarKey4];
  13. if(car == CarInfo[car5][Spawned]) idd = PlayerInfo[playerid][pCarKey5];
  14. if(CarInfo[idd][Spawned] != car) return SendClientMessage(playerid, COLOR_YELLOW2, "Error: You aren't in that vehicle!");
  15. if(idd == 0) return SendClientMessage(playerid, COLOR_YELLOW2, "Eroare: Acest vehicul nu iti apartine!");
  16. new Float:x, Float:y, Float:z, Float:a;
  17. GetVehiclePos(car, x, y, z);
  18. GetVehicleZAngle(car, a);
  19. CarInfo[idd][cLocationx] = x;
  20. CarInfo[idd][cLocationy] = y;
  21. CarInfo[idd][cLocationz] = z;
  22. CarInfo[idd][cAngle] = a;
  23. DestroyVehicle(car);
  24. CarInfo[idd][Spawned] = CreateVehicle(CarInfo[idd][cModel],CarInfo[idd][cLocationx],CarInfo[idd][cLocationy],CarInfo[idd][cLocationz],CarInfo[idd][cAngle],CarInfo[idd][cColorOne],CarInfo[idd][cColorTwo],-1);
  25. SetVehicleNumberPlate(CarInfo[idd][Spawned], CarInfo[idd][cLicense]);
  26. mysql_format(SQL, string, sizeof(string), "UPDATE cars SET Locationx='%f' WHERE ID=%d", CarInfo[idd][cLocationx], idd);
  27. mysql_tquery(SQL, string, "", "");
  28. mysql_format(SQL, string, sizeof(string), "UPDATE cars SET Locationy='%f' WHERE ID=%d", CarInfo[idd][cLocationy], idd);
  29. mysql_tquery(SQL, string, "", "");
  30. mysql_format(SQL, string, sizeof(string), "UPDATE cars SET Locationz='%f' WHERE ID=%d", CarInfo[idd][cLocationz], idd);
  31. mysql_tquery(SQL, string, "", "");
  32. mysql_format(SQL, string, sizeof(string), "UPDATE cars SET Angle='%f' WHERE ID=%d", CarInfo[idd][cAngle], idd);
  33. mysql_tquery(SQL, string, "", "");
  34. mysql_format(SQL, string, sizeof(string), "UPDATE cars SET Spawned='%d' WHERE ID=%d", CarInfo[idd][Spawned], idd);
  35. mysql_tquery(SQL, string, "", "");
  36. GameTextForPlayer(playerid, "~w~You have parked your car at this spot.", 2000, 4);
  37. return 1;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement