Advertisement
Guest User

EMS

a guest
Aug 29th, 2016
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.07 KB | None | 0 0
  1. //task
  2. new InsideTut[MAX_PLAYERS char];
  3.  
  4. #if defined zombiemode
  5. new zombieevent;
  6. // task
  7. task EMSUpdate[5000]()
  8. {
  9. foreach(new i: Player)
  10. {
  11. if(InsideTut{i} > 0)
  12. {
  13. if(gettime() - GetPVarInt(i, "pTutTime") > 20)
  14. {
  15. GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~n~~w~Bam ~r~~k~~CONVERSATION_YES~~w~ de tiep tuc", 2000, 3);
  16. }
  17. }
  18. if(GetPVarType(i, "Injured"))
  19. {
  20. #if defined zombiemode
  21. if(zombieevent == 1 && GetPVarType(i, "pZombieBit"))
  22. {
  23. KillEMSQueue(i);
  24. ClearAnimations(i);
  25. MakeZombie(i);
  26. }
  27. #endif
  28. if(GetPVarInt(i, "EMSAttempt") != 0)
  29. {
  30.  
  31. new Float:health;
  32. GetPlayerHealth(i,health);
  33. SetPlayerHealth(i, health-1);
  34. if(GetPVarInt(i, "EMSAttempt") == -1)
  35. {
  36. if(GetPlayerAnimationIndex(i) != 746) ClearAnimations(i), ApplyAnimation(i, "KNIFE", "KILL_Knife_Ped_Die", 4.0, 0, 1, 1, 1, 0, 1);
  37. if(!GetPVarType(i, "StreamPrep") && !IsPlayerInRangeOfPoint(i, 3.0, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ")) && !GetPVarInt(i, "OnStretcher"))
  38. {
  39. SendClientMessageEx(i, COLOR_WHITE, "Ban da bi bat tinh, ban se duoc dua ve benh vien de dieu tri.");
  40. KillEMSQueue(i);
  41. SpawnPlayer(i);
  42. }
  43. GameTextForPlayer(i, "~r~Bi thuong~n~~w~/chapnhan chet hoac /dichvu capcuu", 5000, 3);
  44. }
  45. if(GetPVarInt(i, "EMSAttempt") == 1)
  46. {
  47. if(GetPlayerAnimationIndex(i) != 746) ClearAnimations(i), ApplyAnimation(i, "KNIFE", "KILL_Knife_Ped_Die", 4.0, 0, 1, 1, 1, 0, 1);
  48. if(!GetPVarType(i, "StreamPrep") && !IsPlayerInRangeOfPoint(i, 3.0, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ")) && !GetPVarInt(i, "OnStretcher"))
  49. {
  50. SendClientMessageEx(i, COLOR_WHITE, "Ban lan ra bat tinh, ban duoc dua den benh vien da dieu tri.");
  51. KillEMSQueue(i);
  52. SpawnPlayer(i);
  53. }
  54. GameTextForPlayer(i, "~r~Bi thuong~n~~w~Dang doi EMS den...", 5000, 3);
  55. }
  56. if(GetPVarInt(i, "EMSAttempt") == 2)
  57. {
  58. if(!GetPVarType(i, "StreamPrep") && !IsPlayerInRangeOfPoint(i, 3.0, GetPVarFloat(i,"MedicX"), GetPVarFloat(i,"MedicY"), GetPVarFloat(i,"MedicZ")) && !GetPVarInt(i, "OnStretcher"))
  59. {
  60. SetPVarInt(i, "EMSWarns", GetPVarInt(i, "EMSWarns")+1);
  61. if(GetPVarInt(i, "EMSWarns") == 2)
  62. {
  63. SendClientMessageEx(i, COLOR_WHITE, "Ban lan ra bat tinh, ban ngay lap tuc duoc dua den benh vien de dieu tri.");
  64. KillEMSQueue(i);
  65. SpawnPlayer(i);
  66. DeletePVar(i, "EMSWarns");
  67. }
  68. }
  69. GameTextForPlayer(i, "~g~Dich vu~n~~w~Dang cho dieu tri...", 5000, 3);
  70. }
  71. if(GetPVarInt(i, "EMSAttempt") == 3)
  72. {
  73. if(IsPlayerInAnyVehicle(i))
  74. {
  75. new ambmodel = GetPlayerVehicleID(i);
  76. if(IsAnAmbulance(ambmodel))
  77. {
  78. GameTextForPlayer(i, "~g~Dich vu~n~~w~Dang cho EMS dua den benh vien...", 5000, 3);
  79. }
  80. else
  81. {
  82. SendClientMessageEx(i, COLOR_WHITE, "Ban bi bat tinh va khong duoc ho tro, ngay lap tuc duoc dua den nha xac de lay noi tang dem ban.");
  83. KillEMSQueue(i);
  84. SpawnPlayer(i);
  85. }
  86. }
  87. else
  88. {
  89. SetPVarInt(i, "EMSWarnst", GetPVarInt(i, "EMSWarnst")+1);
  90. if(GetPVarInt(i, "EMSWarnst") == 2)
  91. {
  92. SendClientMessageEx(i, COLOR_WHITE, "Ban roi ra khoi chiec xe, ngay lap tuc duoc dua den nha xac de lay noi tang dem ban.");
  93. KillEMSQueue(i);
  94. SpawnPlayer(i);
  95. DeletePVar(i, "EMSWarnst");
  96. }
  97. }
  98. }
  99.  
  100. GetPlayerHealth(i, health);
  101. if(health <= 5)
  102. {
  103. SendClientMessageEx(i, COLOR_WHITE, "Ban lan ra bat tinh, ngay lap tuc duoc dua den benh vien de dieu tri.");
  104. KillEMSQueue(i);
  105. SpawnPlayer(i);
  106. }
  107. }
  108. }
  109. }
  110. }
  111. forward firstaidexpire(playerid);
  112. public firstaidexpire(playerid)
  113. {
  114. SendClientMessageEx(playerid, COLOR_GRAD1, "Bo dung cu so cuu cua ban khong con co tac dung.");
  115. KillTimer(GetPVarInt(playerid, "firstaid5"));
  116. SetPVarInt(playerid, "usingfirstaid", 0);
  117. foreach(new i: Player)
  118. {
  119. if(PlayerInfo[i][pAdmin] >= 2 && GetPVarType(i, "_dCheck") && GetPVarInt(i, "_dCheck") == playerid)
  120. {
  121. SendClientMessageEx(i, COLOR_ORANGE, "Note{ffffff}: First Aid effect has expired on the person you are damage checking.");
  122. }
  123. }
  124. }
  125. stock RemoveArmor(Player)
  126. {
  127. DeletePVar(Player, "ArmorWarning");
  128. CurrentArmor[Player] = 0.0;
  129. SetPlayerArmour(Player, 0.0);
  130. return 1;
  131. }
  132.  
  133. stock IsAnAmbulance(carid)
  134. {
  135. if(DynVeh[carid] != -1)
  136. {
  137. new iDvSlotID = DynVeh[carid], iGroupID = DynVehicleInfo[iDvSlotID][gv_igID];
  138. if((0 <= iGroupID < MAX_GROUPS))
  139. {
  140. if(arrGroupData[iGroupID][g_iGroupType] == 3) return 1;
  141. }
  142. }
  143. return 0;
  144. }
  145. stock SpawnZombie(playerid)
  146. {
  147. new Float:maxdis, Float:dis, tpto;
  148. maxdis=9999.9;
  149. SetPlayerSkin(playerid, 134);
  150. SetPlayerHealth(playerid, 200);
  151. SetPlayerInterior(playerid, 0);
  152. SetPlayerVirtualWorld(playerid, 0);
  153. for(new x;x<sizeof(ZombieSpawns);x++)
  154. {
  155. dis = GetPointDistanceToPoint(ZombieSpawns[x][0], ZombieSpawns[x][1], ZombieSpawns[x][2], GetPVarFloat(playerid,"MedicX"), GetPVarFloat(playerid,"MedicY"), GetPVarFloat(playerid,"MedicZ"));
  156. if((dis < maxdis) && (dis > 50.0))
  157. {
  158. tpto=x;
  159. maxdis=dis;
  160. }
  161. }
  162. SetPlayerPos(playerid, ZombieSpawns[tpto][0], ZombieSpawns[tpto][1], ZombieSpawns[tpto][2]);
  163. SetPlayerFacingAngle(playerid, ZombieSpawns[tpto][3]);
  164. ClearAnimations(playerid);
  165. return 1;
  166. }
  167.  
  168. stock MakeZombie(playerid)
  169. {
  170. new Float:X, Float:Y, Float:Z, string[128];
  171. GetPlayerPos(playerid, X, Y, Z);
  172.  
  173. if(IsPlayerConnected(GetPVarInt(playerid, "pZombieBiter")))
  174. {
  175. format(string, sizeof(string), "INSERT INTO zombiekills (id,num) VALUES (%d,1) ON DUPLICATE KEY UPDATE num = num + 1", GetPlayerSQLId(GetPVarInt(playerid, "pZombieBiter")));
  176. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "ii", SENDDATA_THREAD, playerid);
  177. DeletePVar(playerid, "pZombieBiter");
  178. }
  179.  
  180. SendClientMessageEx(playerid, COLOR_RED, "Ban dang la Zombie, su dung /bite de lay nhiem sang nguoi khac!");
  181. SetPVarInt(playerid, "pIsZombie", 1);
  182. DeletePVar(playerid, "pZombieBit");
  183. SetPlayerToTeamColor(playerid);
  184.  
  185. SetPlayerHealth(playerid, 200);
  186. SetPlayerSkin(playerid, 134);
  187.  
  188. ResetPlayerWeaponsEx(playerid);
  189.  
  190. //SendAudioToRange(70, 100, X, Y, Z, 30); RESCRIPT NEW SOUND
  191.  
  192. format(string, sizeof(string), "INSERT INTO `zombie` (`id`) VALUES ('%d')", GetPlayerSQLId(playerid));
  193. mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "ii", SENDDATA_THREAD, playerid);
  194. return 1;
  195. }
  196.  
  197. stock UnZombie(playerid)
  198. {
  199. DeletePVar(playerid, "pIsZombie");
  200. DeletePVar(playerid, "pZombieBit");
  201. SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
  202. SetPlayerToTeamColor(playerid);
  203. return 1;
  204. }
  205. #endif
  206. // EMS
  207. forward KillEMSQueue(playerid);
  208. public KillEMSQueue(playerid)
  209. {
  210. DeletePVar(playerid, "Injured");
  211. DeletePVar(playerid, "EMSAttempt");
  212. SetPVarInt(playerid, "MedicBill", 1);
  213. DeletePVar(playerid, "MedicCall");
  214. DeletePVar(playerid, "EMSWarns");
  215. return 1;
  216. }
  217. forward MoveEMS(playerid);
  218. public MoveEMS(playerid)
  219. {
  220. new Float:mX, Float:mY, Float:mZ;
  221. GetPlayerPos(playerid, mX, mY, mZ);
  222.  
  223. SetPVarFloat(GetPVarInt(playerid, "MovingStretcher"), "MedicX", mX);
  224. SetPVarFloat(GetPVarInt(playerid, "MovingStretcher"), "MedicY", mY);
  225. SetPVarFloat(GetPVarInt(playerid, "MovingStretcher"), "MedicZ", mZ);
  226. SetPVarInt(GetPVarInt(playerid, "MovingStretcher"), "MedicVW", GetPlayerVirtualWorld(playerid));
  227. SetPVarInt(GetPVarInt(playerid, "MovingStretcher"), "MedicInt", GetPlayerInterior(playerid));
  228.  
  229. Streamer_UpdateEx(GetPVarInt(playerid, "MovingStretcher"), mX, mY, mZ);
  230. SetPlayerPos(GetPVarInt(playerid, "MovingStretcher"), mX, mY, mZ);
  231. SetPlayerInterior(GetPVarInt(playerid, "MovingStretcher"), GetPlayerVirtualWorld(playerid));
  232. SetPlayerVirtualWorld(GetPVarInt(playerid, "MovingStretcher"), GetPlayerVirtualWorld(playerid));
  233.  
  234. ClearAnimations(GetPVarInt(playerid, "MovingStretcher"));
  235. ApplyAnimation(GetPVarInt(playerid, "MovingStretcher"), "SWAT", "gnstwall_injurd", 4.0, 0, 1, 1, 1, 0, 1);
  236.  
  237. DeletePVar(GetPVarInt(playerid, "MovingStretcher"), "OnStretcher");
  238. SetPVarInt(playerid, "MovingStretcher", -1);
  239. }
  240. forward SendEMSQueue(playerid,type);
  241. public SendEMSQueue(playerid,type)
  242. {
  243. #if defined zombiemode
  244. if(zombieevent == 1 && GetPVarType(playerid, "pIsZombie"))
  245. {
  246. KillEMSQueue(playerid);
  247. SpawnPlayer(playerid);
  248. return 1;
  249. }
  250. if(zombieevent == 1 && GetPVarType(playerid, "pZombieBit"))
  251. {
  252. KillEMSQueue(playerid);
  253. ClearAnimations(playerid);
  254. MakeZombie(playerid);
  255. return 1;
  256. }
  257. #endif
  258. switch (type)
  259. {
  260. case 1:
  261. {
  262. Streamer_UpdateEx(playerid, GetPVarFloat(playerid,"MedicX"), GetPVarFloat(playerid,"MedicY"), GetPVarFloat(playerid,"MedicZ"));
  263. SetPlayerPos(playerid, GetPVarFloat(playerid,"MedicX"), GetPVarFloat(playerid,"MedicY"), GetPVarFloat(playerid,"MedicZ"));
  264. SetPlayerVirtualWorld(playerid, GetPVarInt(playerid,"MedicVW"));
  265. SetPlayerInterior(playerid, GetPVarInt(playerid,"MedicInt"));
  266.  
  267. SetPVarInt(playerid, "EMSAttempt", -1);
  268.  
  269. if(GetPlayerInterior(playerid) > 0) Player_StreamPrep(playerid, GetPVarFloat(playerid,"MedicX"), GetPVarFloat(playerid,"MedicY"), GetPVarFloat(playerid,"MedicZ"), FREEZE_TIME);
  270. GameTextForPlayer(playerid, "~r~BI THUONG~n~~w~/chapnhan chet hoac /dichvu capcuu", 5000, 3);
  271. ClearAnimations(playerid);
  272. ApplyAnimation(playerid, "KNIFE", "KILL_Knife_Ped_Die", 4.0, 0, 1, 1, 1, 0, 1);
  273. SetPlayerHealth(playerid, 100);
  274. RemoveArmor(playerid);
  275. if(GetPVarInt(playerid, "usingfirstaid") == 1)
  276. {
  277. firstaidexpire(playerid);
  278. }
  279. SetPVarInt(playerid,"MedicCall",1);
  280. }
  281. case 2:
  282. {
  283. SetPVarInt(playerid,"EMSAttempt", 2);
  284. ClearAnimations(playerid);
  285. ApplyAnimation(playerid, "SWAT", "gnstwall_injurd", 4.0, 0, 1, 1, 1, 0, 1);
  286. SetPlayerHealth(playerid, 100);
  287. RemoveArmor(playerid);
  288. }
  289. }
  290. return 1;
  291. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement