Advertisement
colonel-top

Nearest Hospital

May 24th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.34 KB | None | 0 0
  1. //===================================================================================================================================================//
  2. //=====================||||||||||||====||||||||||====|===========||||||||||=====|============|======|||||||||||=====|================================//
  3. //=====================|===============|========|====|===========|========|=====|=\==========|======|===============|================================//
  4. //=====================|===============|========|====|===========|========|=====|===\========|======|===============|================================//
  5. //=====================|===============|========|====|===========|========|=====|====\=======|======|===============|================================//
  6. //=====================|===============|========|====|===========|========|=====|=====\======|======|===============|================================//
  7. //=====================|===============|========|====|===========|========|=====|=====\======|======|||||||||||=====|================================//
  8. //=====================|===============|========|====|===========|========|=====|======\=====|======|===============|================================//
  9. //=====================|===============|========|====|===========|========|=====|=======\====|======|===============|================================//
  10. //=====================|===============|========|====|===========|========|=====|=======\====|======|===============|================================//
  11. //=====================|===============|========|====|===========|========|=====|========\===|======|===============|================================//
  12. //=====================||||||||||||====||||||||||====|||||||||===||||||||||=====|==========\=|======|||||||||||=====||||||||=========================//
  13. //===================================================================================================================================================//
  14. //===================================================================================================================================================//
  15.  
  16. #include <a_samp>
  17.  
  18. //Hospital Spawns
  19. #define MAX_HOSPITALS 8
  20. new Float:Hospitalcoor[MAX_HOSPITALS][4] =
  21. {
  22. {2027.4375,-1421.0703,16.9922,137.2809}, // LS Hospital
  23. {1177.9089,-1323.9611,14.0939,269.8222}, // LS Hospital #2
  24. {1579.6106,1769.0625,10.8203,90.7178}, // LV Hospital
  25. {-321.8259,1056.7279,19.7422,316.0064}, // Fort Carson Hospital
  26. {-1514.8807,2527.8003,55.7315,358.6234}, // El Quebrados Hospital
  27. {-2662.0439,630.5056,14.4531,177.8114}, // San Fierro Hospital
  28. {-2199.2495,-2311.0444,30.6250,321.2772}, // Angel Pine Hospital
  29. {1244.1959,332.2817,19.5547,338.3063} // Montgomery Hospital
  30. };
  31. public OnPlayerSpawn(playerid)
  32. {
  33. return 1;
  34. }
  35.  
  36. public OnPlayerDeath(playerid, killerid, reason)
  37. {
  38. //if(PlayerInfo[playerid][LoggedIn] == 1) // Check is play login or not
  39. if(IsPlayerConnected(playerid))
  40. {
  41. new Float:PDX,Float:PDY,Float:PDZ;
  42. new Float:absX,Float:absY,Float:absZ;
  43. new FinalValue=0,Final=0;
  44. GetPlayerPos(playerid,PDX,PDY,PDZ);
  45. for(new i = 0; i < MAX_HOSPITALS ; i++)
  46. {
  47. absX = PDX - Hospitalcoor[i][0];
  48. floatabs(absX);
  49. if(absX <= FinalValue)
  50. {
  51. FinalValue = absX;
  52. Final= i;
  53. }
  54. absY = PDY - Hospitalcoor[i][1];
  55. floatabs(absY);
  56. if(absY <= FinalValue)
  57. {
  58. FinalValue = absY;
  59. Final= i;
  60. }
  61. absZ = PDX -ZHospitalcoor[i][2];
  62. floatabs(absZ);
  63. if(absZ <= FinalValue)
  64. {
  65. FinalValue = absZ;
  66. Final= i;
  67. }
  68.  
  69.  
  70. }
  71. /*
  72. //**** IMPORTANT **** : YOU NEED TO ADD CONDITION IF HAVE FUNCTION JAIL OR ANOTHER EXAMPLE :::::::
  73. if(PlayerInfo[playerid][Jail] != 0) // Player not got Jail then set spawn hospital
  74. {
  75. SetSpawnInfo(playerid,-1,-1,-1,Hospitalcoor[Final][0],Hospitalcoor[Final][1],Hospitalcoor[Final][2],Hispitalcoor[Final][3]); //will setspawn for play when player spawn its will automatically spawn at hospital
  76. }
  77. //------------------------------------------------------------------------------------------------
  78. */
  79. SetSpawnInfo(playerid,-1,-1,-1,Hospitalcoor[Final][0],Hospitalcoor[Final][1],Hospitalcoor[Final][2],Hispitalcoor[Final][3]); //will setspawn for play when player spawn its will automatically spawn at hospital
  80.  
  81. }
  82. return 1;
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement