Guest User

Untitled

a guest
Oct 7th, 2014
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.28 KB | None | 0 0
  1. public OnPlayerDisconnect(playerid, reason)
  2. {
  3. //new stringa[256];
  4. //new string1[256];
  5. new asdlol;
  6. asdlol = GetPlayerSkin(playerid);
  7. PlayerInfo[playerid][pModel] = asdlol;
  8. new name[MAX_PLAYER_NAME];
  9. GetPlayerName(playerid,name,sizeof(name));
  10. DestroyProgressBar(phealth[playerid]);
  11. phealth[playerid] = INVALID_BAR_ID;
  12. Update3DTextLabelText(NameTag[playerid], WHITE, "");
  13. Delete3DTextLabel(NameTag[playerid]);
  14. Delete3DTextLabel(PlayerLabel[playerid]);
  15. new disconnectstr[128];
  16. new string[128];
  17. new sendername[MAX_PLAYER_NAME];
  18. new caller = Mobile[playerid];
  19. gActivePlayers[playerid]--;
  20. numplayers--;
  21. KillTimer(RelogTimer[playerid]);
  22. TextDrawHideForPlayer(playerid, Website);
  23. TextDrawHideForPlayer(playerid, Time);
  24. TextDrawHideForPlayer(playerid, Date);
  25. for (new i = 1; i < MAX_POINTS; i++)
  26. {
  27. if (PointAttemptingToCapture[playerid] == i)
  28. {
  29. Capturing[playerid][i] = 0;
  30. PointAttemptingToCapture[playerid] = 0;
  31. KillTimer(pointtimer);
  32. format(disconnectstr, sizeof(disconnectstr), "Il player che ha tentato di catturare %s si è disconnesso.", PointStatistics[i][pointname]);
  33. SendFamilyMessageToAll(YELLOW, disconnectstr);
  34. capturegoingon = 0;
  35. break;
  36. }
  37. }
  38. if (GetPVarType(playerid, "pDynamicBB"))
  39. {
  40. DestroyDynamicObject(GetPVarInt(playerid, "pDynamicBB"));
  41. DestroyDynamic3DTextLabel(Text3D:GetPVarInt(playerid, "pDynamicBBLabel"));
  42. if (GetPVarType(playerid, "pDynamicBBArea"))
  43. {
  44. format(string, sizeof(string), "Il proprietario del BoomBox (%s) è sloggato", SenderName(playerid));
  45. foreach(Player, i)
  46. {
  47. if (IsPlayerInDynamicArea(i, GetPVarInt(playerid, "pDynamicBBArea")))
  48. {
  49. StopAudioEx(i);
  50. SendClientMessage(i, COLOR_PURPLE, string);
  51. }
  52. }
  53. }
  54. }
  55. if (usingcarwash == playerid)
  56. {
  57. SetVehicleToRespawn(GetPlayerVehicleID(playerid));
  58. usingcarwash = -1;
  59. Update3DTextLabelText(entrancetext, 0x008B00FF, "Nessuno sta usando l'autolavaggio al momento.\nPrezzo: $5 (/autolavaggio)");
  60. }
  61. if (CurrentCCTV[playerid] > -1)
  62. {
  63. KillTimer(KeyTimer[playerid]);
  64. TextDrawHideForPlayer(playerid, TD);
  65. }
  66. CurrentCCTV[playerid] = -1;
  67. if (GetPVarInt(playerid, "Renting") == 1)
  68. IsRented[GetPVarInt(playerid, "CarRentID")] = 0,
  69. SetVehicleToRespawn(GetPVarInt(playerid, "CarRentID"));
  70. DeletePVar(playerid, "Renting");
  71. DeletePVar(playerid, "CarRentID");
  72. PlayerInfo[playerid][pAdjustable] = 1;
  73. //RadioChoose(playerid, 255);
  74. if (PlayerInfo[playerid][Robbing] == 1)
  75. {
  76. if (RobStatus[Setup] == 1 && RobStatus[BeingRobbed] == 0 && RobStatus[RobberID1] == playerid)
  77. {
  78. RobStatus[Setup] = 0;
  79. SendClientMessage(RobStatus[RobberID1], COLOR_WHITE, "* ** Il leader della rapina è sloggato, rapina fallita");
  80. SendClientMessage(RobStatus[RobberID2], COLOR_WHITE, "* ** Il leader della rapina è sloggato, rapina fallita");
  81. SendClientMessage(RobStatus[RobberID3], COLOR_WHITE, "* ** Il leader della rapina è sloggato, rapina fallita");
  82. SendClientMessage(RobStatus[RobberID4], COLOR_WHITE, "* ** Il leader della rapina è sloggato, rapina fallita");
  83. SendClientMessage(RobStatus[RobberID5], COLOR_WHITE, "* ** Il leader della rapina è sloggato, rapina fallita");
  84. RobStatus[RobberID1] = 255;
  85. RobStatus[RobberID2] = 255;
  86. RobStatus[RobberID3] = 255;
  87. RobStatus[RobberID4] = 255;
  88. RobStatus[RobberID5] = 255;
  89. }
  90. if (RobStatus[RobberID1] == playerid)
  91. {
  92. RobStatus[RobberID1] = 200;
  93. if (RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199)
  94. {
  95. RobStatus[BeingRobbed] = 0;
  96. RobStatus[BankReload] = 2; // Can't be robbed for 2 hours
  97. RobStatus[Setup] = 0;
  98. SendClientMessageToAll(COLOR_LIGHTBLUE, "** La rapina in banca è finita **");
  99. FinishRobbery();
  100. }
  101. }
  102. if (RobStatus[RobberID2] == playerid)
  103. {
  104. RobStatus[RobberID2] = 200;
  105. if (RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199)
  106. {
  107. RobStatus[BeingRobbed] = 0;
  108. RobStatus[BankReload] = 2; // Can't be robbed for 2 hours
  109. RobStatus[Setup] = 0;
  110. SendClientMessageToAll(COLOR_ORANGE, "** La rapina in banca è finita **");
  111. FinishRobbery();
  112. }
  113. }
  114. if (RobStatus[RobberID3] == playerid)
  115. {
  116. RobStatus[RobberID3] = 200;
  117. if (RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199)
  118. {
  119. RobStatus[BeingRobbed] = 0;
  120. RobStatus[BankReload] = 2; // Can't be robbed for 2 hours
  121. RobStatus[Setup] = 0;
  122. SendClientMessageToAll(COLOR_ORANGE, "** La rapina in banca è finita **");
  123. FinishRobbery();
  124. }
  125. }
  126. if (RobStatus[RobberID4] == playerid)
  127. {
  128. RobStatus[RobberID4] = 200;
  129. if (RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199)
  130. {
  131. RobStatus[BeingRobbed] = 0;
  132. RobStatus[BankReload] = 2; // Can't be robbed for 2 hours
  133. RobStatus[Setup] = 0;
  134. SendClientMessageToAll(COLOR_ORANGE, "** La rapina in banca è finita **");
  135. FinishRobbery();
  136. }
  137. }
  138. if (RobStatus[RobberID5] == playerid)
  139. {
  140. RobStatus[RobberID5] = 200;
  141. if (RobStatus[RobberID1] > 199 && RobStatus[RobberID2] > 199 && RobStatus[RobberID3] > 199 && RobStatus[RobberID4] > 199 && RobStatus[RobberID5] > 199)
  142. {
  143. RobStatus[BeingRobbed] = 0;
  144. RobStatus[BankReload] = 2; // Can't be robbed for 2 hours
  145. RobStatus[Setup] = 0;
  146. SendClientMessageToAll(COLOR_ORANGE, "** La rapina in banca è finita **");
  147. FinishRobbery();
  148. }
  149. }
  150. format(string,sizeof(string),"** Sei morto, e non sei riuscito a portare a casa il bottino di $%d",PlayerInfo[playerid][CashLoaded]);
  151. SendClientMessage(playerid, COLOR_YELLOW, string);
  152. PlayerInfo[playerid][CashLoaded] = 0;
  153. PlayerInfo[playerid][Robbing] = 0;
  154. DisablePlayerCheckpoint(playerid);
  155. }
  156. //if(HasPlantWeed[playerid] != 0) DestroyDynamicObject(Weed[playerid]);
  157. GetPlayerRPName(playerid, sendername, sizeof(sendername));
  158. switch (reason)
  159. {
  160. case 0: format(string, sizeof(string), "%s ha lasciato la città. [AFK]", sendername);
  161. case 1: format(string, sizeof(string), "%s ha lasciato la città.", sendername);
  162. case 2: format(string, sizeof(string), "%s ha lasciato la città. [Kick/Ban]", sendername);
  163. }
  164. if (PlayerInfo[playerid][pAdmin] < 2)
  165. {
  166. ProxDetector(30.0, playerid, string, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW);
  167. }
  168. if (PlayerTied[playerid] > 0 || PlayerCuffed[playerid] > 0 && PlayerInfo[playerid][pJailed] == 0)
  169. {
  170. PlayerInfo[playerid][pJailed] = 1; PlayerInfo[playerid][pJailTime] = 800;
  171. }
  172. OnPlayerSave(playerid);
  173. new x = 0;
  174. while (x != MAX_PLAYERS)
  175. {
  176. if (IsPlayerConnected(x) && GetPlayerState(x) == PLAYER_STATE_SPECTATING && SpectatedID[x] == playerid)
  177. {
  178. SetPlayerHealth(x, PlayerInfo[x][pHealth]);
  179. SetPlayerArmour(x, PlayerInfo[x][pArmor]);
  180. SetPlayerVirtualWorld(x, PlayerInfo[x][pVirtualWorld]);
  181. SetPlayerInterior(x, PlayerInfo[x][pInt]);
  182. SetPlayerPos(x, PlayerInfo[x][pSPos_x], PlayerInfo[x][pSPos_y], PlayerInfo[x][pSPos_z]);
  183. SetPlayerFacingAngle(x, PlayerInfo[x][pSPos_r]);
  184. //SendClientMessage(x, COLOR_WHITE, " ù spectando.");
  185. TogglePlayerSpectating(x, 0);
  186. SpectatedID[x] = INVALID_PLAYER_ID;
  187. SpectateType[x] = ADMIN_SPEC_TYPE_None;
  188. HidePM[x] = 0;
  189. PhoneOnline[x] = 0;
  190. ResetPlayerAdminWeaponsEx(x);
  191. }
  192. x++;
  193. }
  194. ////foreach(Player, i)
  195. for (new i; i<MAX_PLAYERS; i++)
  196. {
  197. if (IsPlayerConnected(i))
  198. {
  199. if (TaxiAccepted[i] < 999)
  200. {
  201. if (TaxiAccepted[i] == playerid)
  202. {
  203. TaxiAccepted[i] = 999;
  204. GameTextForPlayer(i, "~w~Il cliente~n~~r~e' sloggato", 5000, 1);
  205. TaxiCallTime[i] = 0;
  206. DisablePlayerCheckpoint(i);
  207. }
  208. }
  209. else if (BusAccepted[i] < 999)
  210. {
  211. if (BusAccepted[i] == playerid)
  212. {
  213. BusAccepted[i] = 999;
  214. GameTextForPlayer(i, "~w~Il cliente~n~~r~e' sloggato", 5000, 1);
  215. BusCallTime[i] = 0;
  216. DisablePlayerCheckpoint(i);
  217. }
  218. }
  219. if (GoChase[i] < 999)
  220. {
  221. if (GoChase[i] == playerid)
  222. {
  223. SendClientMessage(i, COLOR_WHITE, "* Il bersaglio è sloggato.");
  224. GoChase[i] = 999;
  225. }
  226. }
  227. }
  228. }
  229. if (TransportCost[playerid] > 0 && TransportDriver[playerid] < 999)
  230. {
  231. if (IsPlayerConnected(TransportDriver[playerid]))
  232. {
  233. TransportMoney[TransportDriver[playerid]] += TransportCost[playerid];
  234. TransportTime[TransportDriver[playerid]] = 0;
  235. TransportCost[TransportDriver[playerid]] = 0;
  236. format(string, sizeof(string), "~w~Il passeggero è arrivato~n~~g~Guadagnato $%d",TransportCost[playerid]);
  237. GameTextForPlayer(TransportDriver[playerid], string, 5000, 1);
  238. }
  239. }
  240. if (BombID[playerid] != 0)
  241. {
  242. DestroyDynamicObject(BombID[playerid]);
  243. }
  244. if (PlayerPaintballing[playerid] != 0)
  245. {
  246. PaintballPlayers --;
  247. }
  248. if (caller != 255)
  249. {
  250. SendClientMessage(caller, COLOR_GRAD2, " Linea persa....");
  251. CellTime[caller] = 0;
  252. Mobile[caller] = 255;
  253. SetPlayerSpecialAction(caller,SPECIAL_ACTION_STOPUSECELLPHONE);
  254. }
  255. if (PlayersChannel[playerid] < 999)
  256. {
  257. IRCInfo[PlayersChannel[playerid]][iPlayers] -= 1;
  258. }
  259. if (PlayerBoxing[playerid] > 0)
  260. {
  261. if (Boxer1 == playerid)
  262. {
  263. if (IsPlayerConnected(Boxer2))
  264. {
  265. PlayerBoxing[Boxer2] = 0;
  266. SetPlayerPos(Boxer2, 765.8433,3.2924,1000.7186);
  267. SetPlayerInterior(Boxer2, 5);
  268. GameTextForPlayer(Boxer2, "~r~Match interrotto", 5000, 1);
  269. }
  270. }
  271. else if (Boxer2 == playerid)
  272. {
  273. if (IsPlayerConnected(Boxer1))
  274. {
  275. PlayerBoxing[Boxer1] = 0;
  276. SetPlayerPos(Boxer1, 765.8433,3.2924,1000.7186);
  277. SetPlayerInterior(Boxer1, 5);
  278. GameTextForPlayer(Boxer1, "~r~Match interrotto", 5000, 1);
  279. }
  280. }
  281. InRing = 0;
  282. RoundStarted = 0;
  283. Boxer1 = 255;
  284. Boxer2 = 255;
  285. TBoxer = 255;
  286. }
  287. if (TransportDuty[playerid] == 1)
  288. {
  289. TaxiDrivers -= 1;
  290. }
  291. else if (TransportDuty[playerid] == 2)
  292. {
  293. BusDrivers -= 1;
  294. }
  295. if (ThiefText[playerid] != Text3D:INVALID_3DTEXT_ID) DestroyDynamic3DTextLabel(ThiefText[playerid]);
  296. if (PlayerHadDeagle[playerid] == 1) PlayerInfo[playerid][pGun2] = 24;
  297. if (PlayerInfo[playerid][pJob] == 2)
  298. {
  299. if (JobDuty[playerid] == 1) { Lawyers -= 1; }
  300. }
  301. if (PlayerInfo[playerid][pJob] == 11)
  302. {
  303. if (JobDuty[playerid] == 1) { Medics -= 1; }
  304. }
  305. else if (PlayerInfo[playerid][pJob] == 7)
  306. {
  307. if (JobDuty[playerid] == 1) { Mechanics -= 1; }
  308. }
  309. new Float: UltimaX, Float: UltimaY, Float: UltimaZ;
  310. GetPlayerPos(playerid, UltimaX,UltimaY, UltimaZ);
  311. PlayerInfo[playerid][pUltimaX] = UltimaX;
  312. PlayerInfo[playerid][pUltimaY] = UltimaY;
  313. PlayerInfo[playerid][pUltimaZ] = UltimaZ;
  314. PlayerInfo[playerid][pUltimaX] = Float: UltimaX;
  315. PlayerInfo[playerid][pUltimaY] = Float: UltimaY;
  316. PlayerInfo[playerid][pUltimaZ] = Float: UltimaZ;
  317. printf("//Coordinate salvata %f %f %f", PlayerInfo[playerid][pUltimaX],PlayerInfo[playerid][pUltimaY],PlayerInfo[playerid][pUltimaZ]);
  318. OnPlayerSave(playerid);
  319. if (reason == 0)
  320. {
  321. format(string, sizeof(string), "%s ha lasciato la città! [Crash]", RPN(playerid));
  322. ProxDetector(50.0, playerid, string, COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN);
  323. PlayerInfo[playerid][pCrashato] = 1;
  324. //OnPlayerSave(playerid);
  325. }
  326. return 1;
  327. }
Advertisement
Add Comment
Please, Sign In to add comment