Guest User

/lock

a guest
Jan 5th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.55 KB | None | 0 0
  1. CMD:lock(playerid, params[])
  2. {
  3. if(TextResetCMD[playerid] > gettime()) return SendClientMessage(playerid, COLOR_GREY, "Не флуди");
  4. new Float:x, Float:y, Float:z, type = 1;
  5. if(sscanf(params, "i", type)) type = 1;
  6. else if(type > 2 || type < 1) type = 1;
  7. new carid;
  8. if(PI[playerid][PlayerCarID] && type == 1) carid = PI[playerid][PlayerCarID];
  9. else if(PI[playerid][pVehicleKey] && type == 2) carid = PI[playerid][pVehicleKey];
  10. else if(type == 2)
  11. {
  12. if(GetPVarInt(playerid, "arendkey") == -1) return SendClientMessage(playerid, COLOR_GREY, "Вы не арендуете транспорт");
  13. new rc = GetPVarInt(playerid, "arendkey");
  14. if(ArendInfo[rc][aPlayerID] != playerid)
  15. {
  16. SendClientMessage(playerid, COLOR_GREY, "Вы не арендуете транспорт");
  17. SetPVarInt(playerid, "arendkey", -1);
  18. return 1;
  19. }
  20. GetVehiclePos(ArendInfo[rc][aID], x, y, z);
  21. if(!IsPlayerInRangeOfPoint(playerid, 10.0, x, y, z)) return SendClientMessage(playerid, COLOR_GREY, "Вы должны находиться возле арендованного Вами транспорта!");
  22. if(VehicleInfo[ArendInfo[rc][aID]-1][vLock] == 0)
  23. {
  24. CarDoorsEx(ArendInfo[rc][aID], 1);
  25. GameTextForPlayer(playerid, "~r~locked", 2000, 3);
  26. PlayerPlaySound(playerid, 24600, 0.0, 0.0, 0.0);
  27. MeAction(playerid, "достал ключи и закрыл транспорт");
  28. }
  29. else
  30. {
  31. CarDoorsEx(ArendInfo[rc][aID], 0);
  32. GameTextForPlayer(playerid, "~g~unlocked", 2000, 3);
  33. PlayerPlaySound(playerid, 24600, 0.0, 0.0, 0.0);
  34. MeAction(playerid, "достал ключи и открыл транспорт");
  35. }
  36. return 1;
  37. }
  38. else return SendClientMessage(playerid, COLOR_GREY, "У вас нет авто!");
  39. GetVehiclePos(carid, x, y, z);
  40. if(!IsPlayerInRangeOfPoint(playerid, 10.0, x, y, z)) return SendClientMessage(playerid, COLOR_GREY, "Вы должны находиться возле своего транспорта!");
  41. if(VehicleInfo[carid-1][vLock] == 0)
  42. {
  43. PI[playerid][cLock] = 1;
  44. CarDoors(carid, PI[playerid][cLock]);
  45. GameTextForPlayer(playerid, "~r~locked", 2000, 3);
  46. PlayerPlaySound(playerid, 24600, 0.0, 0.0, 0.0);
  47. MeAction(playerid, "достал ключи и закрыл транспорт");
  48. }
  49. else
  50. {
  51. PI[playerid][cLock] = 0;
  52. CarDoors(carid, PI[playerid][cLock]);
  53. GameTextForPlayer(playerid, "~g~unlocked", 2000, 3);
  54. PlayerPlaySound(playerid, 24600, 0.0, 0.0, 0.0);
  55. MeAction(playerid, "достал ключи и открыл транспорт");
  56. }
  57. return 1;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment