Advertisement
Guest User

Untitled

a guest
Jan 26th, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.59 KB | None | 0 0
  1. CMD:enter(playerid, params[])
  2. {
  3. if(!pLoggedIn[playerid])return true;
  4. new string[128];
  5.  
  6. if(StartedTruckerMission[playerid] && TruckerMissionStep[playerid] == 2)
  7. return SendClientMessage(playerid, COLOR_ADM, "** You can't enter while delivering.");
  8.  
  9. for(new h = 0; h < MAX_PROPERTY; h++){
  10. if(PropertyData[h][propertyid] != 0){
  11. if(PropertyData[h][propertyType] == 2){
  12. if(IsPlayerInRangeOfPoint(playerid, 3.0, PropertyData[h][propertyExterior][0], PropertyData[h][propertyExterior][1], PropertyData[h][propertyExterior][2])){
  13. if(GetPlayerInterior(playerid) == PropertyData[h][propertyExteriorID] && GetPlayerVirtualWorld(playerid) == PropertyData[h][propertyExteriorWorld] && PlayerData[playerid][pCheckpoint] == h){
  14.  
  15. if(PropertyData[h][propertyLocked]){
  16. GameTextForPlayer(playerid, "~r~Locked", 2000, 1);
  17. }
  18. else{
  19. if(IsPlayerInAnyVehicle(playerid))
  20. return SendClientMessage(playerid, COLOR_ADM, "You are not able to enter due to being in a vehicle!");
  21.  
  22. SendPlayer(playerid, PropertyData[h][propertyInterior][0], PropertyData[h][propertyInterior][1], PropertyData[h][propertyInterior][2], PropertyData[h][propertyInteriorID], PropertyData[h][propertyInteriorWorld]);
  23. SetPlayerFacingAngle(playerid, PropertyData[h][propertyInterior][3]);
  24.  
  25. SetTimerEx("LoadingStream", 50, false, "i", playerid);
  26. SetTimerEx("EndStream", 300, false, "i", playerid);
  27.  
  28. PlayerData[playerid][pInsideApartment] = h;
  29. PlayerData[playerid][pInsideComplex] = 0;
  30. DisablePlayerCheckpoint(playerid);
  31. PlayerData[playerid][pCheckpoint] = 0;
  32.  
  33. if (PropertyData[h][propertyXMROn]){
  34. PlayAudioStreamForPlayer(playerid, PropertyData[h][propertyXMRUrl]);
  35. }
  36. }
  37. }
  38. }
  39. }
  40. else{
  41. if(IsPlayerInRangeOfPoint(playerid, 3.0, PropertyData[h][propertyExterior][0], PropertyData[h][propertyExterior][1], PropertyData[h][propertyExterior][2])){
  42. if(GetPlayerVirtualWorld(playerid) == PropertyData[h][propertyExteriorWorld]){
  43. if(PropertyData[h][propertyLocked]){
  44. GameTextForPlayer(playerid, "~r~Locked", 2000, 1);
  45. }
  46. else{
  47. if(IsPlayerInAnyVehicle(playerid))
  48. return SendClientMessage(playerid, COLOR_ADM, "You are not able to enter due to being in a vehicle!");
  49.  
  50. SendPlayer(playerid, PropertyData[h][propertyInterior][0], PropertyData[h][propertyInterior][1], PropertyData[h][propertyInterior][2], PropertyData[h][propertyInteriorID], PropertyData[h][propertyInteriorWorld]);
  51. SetPlayerFacingAngle(playerid, PropertyData[h][propertyInterior][3]);
  52.  
  53. SetTimerEx("LoadingStream", 50, false, "i", playerid);
  54. SetTimerEx("EndStream", 300, false, "i", playerid);
  55.  
  56. if(PropertyData[h][propertyType] == 1){
  57. PlayerData[playerid][pInsideComplex] = h;
  58. }
  59. if(PropertyData[h][propertyType] == 3){
  60. PlayerData[playerid][pInsideHouse] = h;
  61. }
  62. DisablePlayerCheckpoint(playerid);
  63. PlayerData[playerid][pCheckpoint] = 0;
  64.  
  65. if (PropertyData[h][propertyXMROn]){
  66. PlayAudioStreamForPlayer(playerid, PropertyData[h][propertyXMRUrl]);
  67. }
  68. }
  69. }
  70. }
  71. }
  72. }
  73. }
  74.  
  75. for(new b = 0; b < MAX_BUSINESS; b++)
  76. {
  77. if(BusinessData[b][businessID] != 0){
  78. if(IsPlayerInRangeOfPoint(playerid, 3.0, BusinessData[b][businessExt][0], BusinessData[b][businessExt][1], BusinessData[b][businessExt][2])){
  79. if(BusinessData[b][businessLocked]){
  80. GameTextForPlayer(playerid, "~r~Locked", 3000, 1);
  81. }
  82. else{
  83. if(BusinessData[b][businessType] == 8 || BusinessData[b][businessType] == 9){
  84. GameTextForPlayer(playerid, "~r~Closed", 3000, 1);
  85. return true;
  86. }
  87. if(IsPlayerInAnyVehicle(playerid))
  88. return SendClientMessage(playerid, COLOR_ADM, "You are not able to enter due to being in a vehicle!");
  89.  
  90. SendPlayer(playerid, BusinessData[b][businessInt][0], BusinessData[b][businessInt][1], BusinessData[b][businessInt][2], BusinessData[b][businessIntID], BusinessData[b][businessWorld]);
  91. SetPlayerFacingAngle(playerid, BusinessData[b][businessInt][3]);
  92.  
  93. SetTimerEx("LoadingStream", 50, false, "i", playerid);
  94. SetTimerEx("EndStream", 300, false, "i", playerid);
  95.  
  96. if(PlayerData[playerid][pSQLID] != BusinessData[b][businessOwnerSQL]) {
  97. GiveMoney(playerid, -BusinessData[b][businessFee]);
  98. BusinessData[b][businessCashbox]+= BusinessData[b][businessFee];
  99. }
  100.  
  101. format(string, sizeof(string), "~w~%s", BusinessData[b][businessName]);
  102. GameTextForPlayer(playerid, string, 3000, 1);
  103.  
  104. PlayerData[playerid][pInsideBusiness] = b;
  105. BusinessTypeMessage(playerid, b);
  106. }
  107. }
  108. }
  109. }
  110.  
  111. for(new p = 0; p < MAX_PAYNSPRAY; p++)
  112. {
  113. if(PNSData[p][pnsID] != 0){
  114. if(IsPlayerInRangeOfPoint(playerid, 4.0, PNSData[p][pnsEntrance][0], PNSData[p][pnsEntrance][1], PNSData[p][pnsEntrance][2])){
  115. if (PNSData[p][pnsOccupied])return SendClientMessage(playerid, COLOR_ADM, "SERVER: Pay N Spray Occupied.");
  116. if (GetPlayerState(playerid) != PLAYER_STATE_DRIVER)return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't in a car.");
  117. if (PlayerData[playerid][pMoney] < PNSData[p][pnsPrice])return SendClientMessage(playerid, COLOR_ADM, "SERVER: Insufficient Funds.");
  118.  
  119. SendPlayer(playerid, PNSData[p][pnsRepairSpot][0], PNSData[p][pnsRepairSpot][1], PNSData[p][pnsRepairSpot][2], 0, 0);
  120. GiveMoney(playerid, -PNSData[p][pnsPrice]);
  121.  
  122. PlayerData[playerid][pInsidePNS] = p;
  123. SetPVarInt(playerid, "InsidePNSVehicle", GetPlayerVehicleID(playerid));
  124.  
  125. PNSData[p][pnsOccupied] = true;
  126. PNSData[p][pnsEarnings]+= PNSData[p][pnsPrice];
  127.  
  128. SetTimerEx("TIMER_ExitPNS", 9500, false, "i", playerid);
  129.  
  130. TogglePlayerControllable(playerid, false);
  131. SendClientMessage(playerid, COLOR_DARKGREEN, "Auto-Voice: You'll be moved out in 10 seconds.");
  132. GameTextForPlayer(playerid, "~g~REPAIRING...", 5000, 4);
  133. }
  134. }
  135. }
  136.  
  137. for(new d = 0; d < MAX_DOORS; d++)
  138. {
  139. if(DoorData[d][doorID] != 0)
  140. {
  141. if(IsPlayerInRangeOfPoint(playerid, 1.0, DoorData[d][doorPos][0], DoorData[d][doorPos][1], DoorData[d][doorPos][2]))
  142. {
  143. if(GetPlayerVirtualWorld(playerid) == DoorData[d][doorPosWorld])
  144. {
  145. if(DoorData[d][doorLocked])return GameTextForPlayer(playerid, "~r~Locked", 3000, 1);
  146.  
  147. if(IsPlayerInAnyVehicle(playerid))
  148. return SendClientMessage(playerid, COLOR_ADM, "You are not able to enter due to being in a vehicle!");
  149. SetPlayerPos(playerid, DoorData[d][doorInt][0], DoorData[d][doorInt][1], DoorData[d][doorInt][2]);
  150. SetPlayerInterior(playerid, DoorData[d][doorIntID]);
  151. SetPlayerVirtualWorld(playerid, DoorData[d][doorIntWorld]);
  152. SetPlayerFacingAngle(playerid, DoorData[d][doorInt][3]);
  153.  
  154. SetTimerEx("LoadingStream", 50, false, "i", playerid);
  155. SetTimerEx("EndStream", 300, false, "i", playerid);
  156.  
  157. PlayerData[playerid][pInsideDoor] = d;
  158. }
  159. }
  160. }
  161. }
  162.  
  163. for(new g = 0; g < MAX_PROPERTY_GARAGES; g++)
  164. {
  165. if(GarageData[g][garageSQLID] != 0)
  166. {
  167. if(IsPlayerInRangeOfPoint(playerid, 4.0, GarageData[g][garagePos][0], GarageData[g][garagePos][1], GarageData[g][garagePos][2]))
  168. {
  169. if(GarageData[g][garageLocked])return GameTextForPlayer(playerid, "~r~Locked", 3000, 1);
  170.  
  171. SendPlayer(playerid, GarageData[g][garageInt][0], GarageData[g][garageInt][1], GarageData[g][garageInt][2], GarageData[g][garageInteriorID], GarageData[g][garageWorld]);
  172. PlayerData[playerid][pInsideGarage] = g;
  173.  
  174. if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  175. {
  176. foreach(new i : Player)
  177. {
  178. if(IsPlayerInVehicle(i, GetPlayerVehicleID(playerid)))
  179. {
  180. SetPlayerVirtualWorld(i, GarageData[g][garageWorld]);
  181. SetPlayerInterior(i, GarageData[g][garageInteriorID]);
  182.  
  183. PlayerData[i][pInsideGarage] = g;
  184. }
  185. }
  186.  
  187. SetVehicleZAngle(GetPlayerVehicleID(playerid), 90);
  188. }
  189. }
  190. }
  191. }
  192.  
  193. new idx;
  194. if(IsPlayerNearEntrance(playerid) != -1)
  195. {
  196. idx = IsPlayerNearEntrance(playerid);
  197.  
  198. if(IsEntranceLocked(idx) && !PlayerData[playerid][pAdminDuty])
  199. return GameTextForPlayer(playerid, "~r~Locked", 3000, 1);
  200.  
  201. if(IsPlayerInAnyVehicle(playerid))
  202. return SendClientMessage(playerid, COLOR_ADM, "You are not able to enter due to being in a vehicle!");
  203.  
  204. EnterEntrance(playerid, idx);
  205.  
  206. SetTimerEx("LoadingStream", 50, false, "i", playerid);
  207. SetTimerEx("EndStream", 300, false, "i", playerid);
  208. }
  209.  
  210. return true;
  211. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement