Advertisement
Guest User

Untitled

a guest
Jan 27th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.35 KB | None | 0 0
  1. hook OnPlayerSpawn(playerid) {
  2. if(GetPVarInt(playerid, "inGarage") == 1) {
  3. SetPVarInt(playerid, "inGarage", 0);
  4. hide_garage_tds(playerid);
  5. }
  6. return 1;
  7. }
  8.  
  9. hook OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { //aici
  10. if((newkeys & KEY_SECONDARY_ATTACK) && !IsPlayerInAnyVehicle(playerid) || newkeys & KEY_CROUCH) {
  11. for(new i = 1; i < MAX_GARAGES; i++) {
  12. if(IsPlayerInRangeOfPoint(playerid, 2.0, garageInfo[i][gPos][0], garageInfo[i][gPos][1], garageInfo[i][gPos][2]) && garageInfo[i][gUserID] != 0) {
  13. if(user_have_garage(playerid) == 0) return SendClientMessage(playerid, COLOR_GRAD3, "You dont have a garage!");
  14. if(PlayerInfo[playerid][pWantedLevel] > 0) return SendClientMessage(playerid, COLOR_GRAD3, "Nu poti intra in garaj cand ai wanted!");
  15. if(GetPVarInt(playerid, "inGarage") != 0) return 1;
  16. SetPVarInt(playerid, "inGarage", i);
  17.  
  18. if(IsPlayerInAnyVehicle(playerid)) {
  19. if(garageInfo[i][gPrice] > 0) return SendClientMessage(playerid, 0xC90202FF, "(Garage) {FFFFFF}You can not come with a vehicle if the garage is for sale.");
  20. if(PersonalCar(playerid) == -1) return SCM(playerid, COLOR_GRAD3, "Poti intra doar cu vehiculele personale!");
  21. if(vehicles_in_garage(playerid) == 10 && vehicle_in_garage(playerid, GetPlayerVehicleID(playerid)) == -1) return 1;
  22. new slot = vehicle_in_garage(playerid, GetPlayerVehicleID(playerid));
  23. if(slot == -1) ShowPlayerDialog(playerid, DIALOG_PARKVEHICLE, DIALOG_STYLE_MSGBOX, "Park", "Esti sigur ca vrei sa-l adaugi in garaj?", "Yes", "No");
  24. else {
  25. SendClientMessage(playerid, 0xC90202FF, "(Garage) {FFFFFF}Vehiculul tau personal a fost adaugat in garaj!");
  26. SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), i);
  27. SetVehicleToRespawn(GetPlayerVehicleID(playerid));
  28. SetPVarInt(playerid, "inGarage", 0);
  29. }
  30. }
  31. else {
  32. SendClientMessage(playerid, 0xC90202FF, "(Garage) {FFFFFF}PENTRU A CONTROLA POZITIA FOLOSITI: NUM4(stanga), NUM6(dreapta), Enter(selectare vehicul) si Space (iesire).");
  33. SendClientMessage(playerid, 0xC90202FF, "(Garage) {FFFFFF}Inaintea parcarii oricarui vehicul trebuie sa-l parcati langa garaj (/park) apoi sa-l bagati in garaj (apasati H langa garaj din vehicul).");
  34. SendClientMessage(playerid, 0xC90202FF, "(Garage) {FFFFFF}Vehiculele trebuie sa fie spawnate pentru a putea fii vizibile in garaj!");
  35.  
  36. SetPlayerPosEx2(playerid, 487.5861,-437.8022,2758.2688);
  37. SetPlayerVirtualWorld(playerid, i);
  38.  
  39. if(BarTimer[playerid]) KillTimer(BarTimer[playerid]);
  40. BarTimer[playerid] = SetTimerEx("BlackBar", 100, true, "%d", playerid);
  41.  
  42. SetPVarInt(playerid, "garageSlot", 0);
  43. show_garage_tds(playerid);
  44. garage_camera(playerid);
  45. TogglePlayerControllable(playerid, 0);
  46. }
  47.  
  48.  
  49. Freezed[playerid] = 1;
  50. }
  51. }
  52. }
  53.  
  54. if(newkeys & KEY_SECONDARY_ATTACK) {
  55. if(GetPVarInt(playerid, "inGarage") != 0 && GetPlayerVirtualWorld(playerid) != 0 && IsPlayerInRangeOfPoint(playerid, 100.0, 487.9106,-431.6140,2757.9956)) {
  56. new id = GetPVarInt(playerid, "inGarage"), vehid;
  57. if(garage_slot(playerid, GetPVarInt(playerid, "garageSlot")) != -1) vehid = CarInfo[PlayerInfo[playerid][pCarKey][garage_slot(playerid, GetPVarInt(playerid, "garageSlot"))]][Spawned];
  58. if(garage_slot(playerid, GetPVarInt(playerid, "garageSlot")) == -1) return SendClientMessage(playerid, COLOR_WARNING, "Nu ai adaugat un vehicul pe acest slot din garaj!");
  59. else if(GetVehicleVirtualWorld(vehid) == 0) return SendClientMessage(playerid, COLOR_WARNING, "Vehiculul a fost scos din garaj deja!");
  60. else if(vehid == 0 && vehicle_in_garage(playerid, vehid)) return SendClientMessage(playerid, COLOR_WARNING, "Vehiculul nu este spawnat!");
  61. hide_garage_tds(playerid);
  62.  
  63. SetVehiclePos(vehid, garageInfo[id][gPos][0], garageInfo[id][gPos][1], garageInfo[id][gPos][2]);
  64. PutPlayerInVehicle(playerid, vehid, 0);
  65. SetVehicleZAngleEx(GetPlayerVehicleID(playerid), garageInfo[id][gAngle]);
  66. SetPlayerVirtualWorld(playerid, 0);
  67. SetVehicleVirtualWorld(vehid, 0);
  68. SetPVarInt(playerid, "inGarage", 0);
  69.  
  70. if(BarTimer[playerid]) KillTimer(BarTimer[playerid]);
  71. BarTimer[playerid] = SetTimerEx("BlackBar", 100, true, "%d", playerid);
  72. }
  73. }
  74.  
  75. if(GetPVarInt(playerid, "inGarage") != 0) {
  76. if(newkeys & KEY_ANALOG_LEFT) {
  77. // left
  78. new slot = GetPVarInt(playerid, "garageSlot");
  79. if(slot == 9) slot = -1;
  80. SetPVarInt(playerid, "garageSlot", slot+1);
  81. show_garage_tds(playerid);
  82. garage_camera(playerid, GetPVarInt(playerid, "garageSlot"));
  83. }
  84. if(newkeys & KEY_ANALOG_RIGHT) {
  85. // right
  86. new slot = GetPVarInt(playerid, "garageSlot");
  87. if(slot == 0) slot = 10;
  88. SetPVarInt(playerid, "garageSlot", slot-1);
  89. show_garage_tds(playerid);
  90. garage_camera(playerid, GetPVarInt(playerid, "garageSlot"));
  91. }
  92. if(newkeys & KEY_SPRINT) {
  93. hide_garage_tds(playerid);
  94. new id = GetPVarInt(playerid, "inGarage");
  95. SetPlayerPosEx2(playerid, garageInfo[id][gPos][0], garageInfo[id][gPos][1], garageInfo[id][gPos][2]);
  96. SetPlayerVirtualWorld(playerid, 0);
  97. if(BarTimer[playerid]) KillTimer(BarTimer[playerid]);
  98. BarTimer[playerid] = SetTimerEx("BlackBar", 100, true, "%d", playerid);
  99. SetPVarInt(playerid, "inGarage", 0);
  100. TogglePlayerControllable(playerid, 1);
  101. Freezed[playerid] = 0;
  102. }
  103. }
  104. return 1;
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement