Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2014
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 89.41 KB | None | 0 0
  1. // Revisado 100% //OK
  2. #pragma tabsize 0
  3. // ********************************************************************************************************************
  4. // Universo dos Caminhoneiros
  5. // ********************************************************************************************************************
  6. #define GameModeName "UDC 2.0"
  7. #include <a_samp>
  8. #include <core>
  9. new Text:ImagemEntrada;
  10. #define Azul 0x0000FFAA
  11. #define COR_BRANCO 0xFFFFFFAA
  12. #define COR_ROXO 0x9900FFAA
  13. #define COR_CINZA_AZUL 0x456EAF67
  14. #define Azul 0x0000FFAA
  15. #define COR_DARKROXO 0x800080AA
  16. #define COR_CINZA_AZUL 0x456EAF67
  17. forward SendMSG();
  18.  
  19. new RandomServerName[4][] = {
  20. "•Universo dos Caminhoneiros®",
  21. "•Universo dos Caminhoneiros™",
  22. "Versão 2.0",
  23. "•Universo dos Caminhoneiros™•"
  24. };
  25. public SendMSG() {
  26.  
  27. new string[128];
  28.  
  29. new randMSG = random( sizeof(RandomServerName) );
  30.  
  31. format( string, 128, "hostname %s", RandomServerName[randMSG] );
  32.  
  33. SendRconCommand( string );
  34.  
  35. return 1;
  36. }
  37. /********************************************************************************************************************
  38.  
  39. ///////////////////////////////////////////////////////////// 100% Desbugado \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  40. ||||||||||||||||||||||||||||||||||||||||||||| # PPC_Trucking Editada # |||||||||||||||||||||||||||
  41. ********************************************************************************************************************/
  42.  
  43. new PlayersBeforePolice = 0;
  44.  
  45. /////////////////////////////////////////
  46. // //
  47. // //
  48. // By João Monteiro //
  49. // //
  50. // //
  51. /////////////////////////////////////////
  52. #include <a_samp>
  53. #include <zcmd>
  54. #include <dutils>
  55. #include <sscanf2>
  56. #include <a_objects>
  57. #include <streamer>
  58. #include <dini>
  59. #include <SII>
  60. #include <m3dt>
  61. #include <foreach>
  62. #include <seif_walk>
  63. #include <a_players>
  64. /////////////////////////////////////////
  65. // //
  66. // //
  67. // By João Monteiro //
  68. // //
  69. // //
  70. /////////////////////////////////////////
  71.  
  72. #define SLOT 1
  73. #define TimerFlood 3000
  74. #define AlertFlood 4
  75. #define ColorFlood 0x24B1DBAA
  76. #define CLIMATEMPO 0xFFFFAFAA
  77. #define AMARELO 0xFFFF00AA
  78. #define VERMELHO 0xFF0000AA
  79. #define AZUL 0x0000FFAA
  80. #define VERDE 0x00FF00AA
  81. #define BRANCO 0xFFFFFFFF
  82.  
  83. // Include all define-statements and custom-type declarations and the arrays which use them
  84. // These files need to be included before the functions get included, because the functions use the defines, custom types and the arrays
  85. // Also include the defined loads (for truckers, military, mafia, ...) and locations arrays
  86. #include <PPC_DefTexts>
  87. #include <PPC_ServerSettings>
  88. #include <PPC_Defines>
  89. #include <PPC_DefLocations>
  90. #include <PPC_DefLoads>
  91. #include <PPC_DefCars>
  92. #include <PPC_DefPlanes>
  93. #include <PPC_DefTrailers>
  94. #include <PPC_DefBuyableVehicles>
  95. // Include functions for this gamemode
  96. #include <PPC_GlobalTimer>
  97. #include <PPC_Common>
  98. #include <PPC_Housing>
  99. #include <PPC_Business>
  100. #include <PPC_GameModeInit>
  101. #include <PPC_FileOperations>
  102. #include <PPC_Speedometer>
  103. #include <PPC_MissionsTrucking>
  104. #include <PPC_MissionsBus>
  105. #include <PPC_MissionsPilot>
  106. #include <PPC_MissionsPolice>
  107. #include <PPC_MissionsMafia>
  108. #include <PPC_MissionsAssistance>
  109. #include <PPC_MissionsCourier>
  110. #include <PPC_MissionsRoadworker>
  111. #include <PPC_Convoys>
  112. #include <PPC_Dialogs>
  113. #include <PPC_PlayerCommands>
  114. #include <PPC_Toll>
  115. #include <PPC_Extras>
  116.  
  117. #define SLOT 1
  118. #define TimerFlood 3000
  119. #define AlertFlood 4
  120. #define ColorFlood 0x24B1DBAA
  121. #define CLIMATEMPO 0xFFFFAFAA
  122. #define AMARELO 0xFFFF00AA
  123. #define VERMELHO 0xFF0000AA
  124. #define AZUL 0x0000FFAA
  125. #define VERDE 0x00FF00AA
  126. #define BRANCO 0xFFFFFFFF
  127.  
  128. forward timed(playerid);
  129. forward Climas();
  130.  
  131. //Relógio
  132. new timer1,timer2,timer3;
  133. //Nomezinho
  134. new Text:AberturaP0;
  135. new Text:AberturaP1;
  136. //Abertura
  137. new Text:Abertura0;
  138. new Text:Abertura1;
  139. new Text:Textdraw0;
  140. main ()
  141. {
  142. print("\nSistemas do Servidor");
  143. print(" Carregando...");
  144. print(" 100% - Servidor Online");
  145. }
  146. public OnGameModeInit()
  147. {
  148. ImagemEntrada = TextDrawCreate(1.000000, -1.000000, "loadsc7:loadsc7");
  149. TextDrawBackgroundColor(ImagemEntrada, 255);
  150. TextDrawFont(ImagemEntrada, 4);
  151. TextDrawLetterSize(ImagemEntrada, 0.500000, 1.000000);
  152. TextDrawColor(ImagemEntrada, -1);
  153. TextDrawSetOutline(ImagemEntrada, 0);
  154. TextDrawSetProportional(ImagemEntrada, 1);
  155. TextDrawSetShadow(ImagemEntrada, 1);
  156. TextDrawUseBox(ImagemEntrada, 1);
  157. TextDrawBoxColor(ImagemEntrada, 255);
  158. TextDrawTextSize(ImagemEntrada, 645.000000, 450.000000);
  159. SetTimer( "SendMSG", 1000, true );
  160. Create3DTextLabel("{FFFFFF}/cor1\n{FF0000}/cor2\n{FFFFFF}/pintura\n{FF0000}/neon\n{FFFFFF}/reparar\n{FF0000}/editarplaca", 0xFFFFFFFF, 2096.6445, 1120.9552, 11.13951, 30.0, 0, 0); //6 Avenida
  161. Create3DTextLabel("{FFFFFF}/cor1\n{FF0000}/cor2\n{FFFFFF}/pintura\n{FF0000}/neon\n{FFFFFF}/reparar", 0xFFFFFFFF, -47.7836, 270.6917, 2.2500, 30.0, 0, 0); //1 parking fazenda
  162. Create3DTextLabel("{FFFFFF}/cor1\n{FF0000}/cor2\n{FFFFFF}/pintura\n{FF0000}/neon\n{FFFFFF}/reparar", 0xFFFFFFFF, 24.6492, 2418.9697, 22.7578, 30.0, 0, 0); //2 aero
  163. Create3DTextLabel("{FFFFFF}/cor1\n{FF0000}/cor2\n{FFFFFF}/pintura\n{FF0000}/neon\n{FFFFFF}/reparar\n{FF0000}/editarplaca", 0xFFFFFFFF, 1348.4963, 946.5101, 10.5252, 30.0, 0, 0); //3 chuckup
  164. Create3DTextLabel("{FFFFFF}/cor1\n{FF0000}/cor2\n{FFFFFF}/pintura\n{FF0000}/neon\n{FFFFFF}/reparar", 0xFFFFFFFF, -547.3569,507.0492,2.5933, 30.0, 0, 0); //4 Dragao
  165. Create3DTextLabel("{FFFFFF}/cor1\n{FF0000}/cor2\n{FFFFFF}/pintura\n{FF0000}/neon\n{FFFFFF}/reparar\n{FF0000}/editarplaca", 0xFFFFFFFF, -1656.2089,454.5365,7.4053, 30.0, 0, 0); //5 SF
  166.  
  167. // Resgate
  168. Create3DTextLabel("{FF0000}[UDC]\n{FFFFFF}IP: 151.236.11.185:8780\n{FF0000}Universo dos Caminhoneiros - 2.0\n{FFFFFF}/ajuda\n{FF0000}/admins", 0xFFFFFFFF, -525.00, -501.66, 25.52, 30.0, 0, 0); //resgate 1
  169. Create3DTextLabel("{FF0000}[UDC]\n{FFFFFF}IP: 151.236.11.185:8780\n{FF0000}Universo dos Caminhoneiros - 2.0\n{FFFFFF}/ajuda\n{FF0000}/admins", 0xFFFFFFFF, -74.69, -1137.16, 4.20, 30.0, 0, 0); //resgate 2
  170. Create3DTextLabel("{FF0000}[UDC]\n{FFFFFF}IP: 151.236.11.185:8780\n{FF0000}Universo dos Caminhoneiros - 2.0\n{FFFFFF}/ajuda\n{FF0000}/admins", 0xFFFFFFFF, 1457.00, 975.83, 10.82, 30.0, 0, 0); //resgate 3
  171. Create3DTextLabel("{FF0000}[UDC]\n{FFFFFF}IP: 151.236.11.185:8780\n{FF0000}Universo dos Caminhoneiros - 2.0\n{FFFFFF}/ajuda\n{FF0000}/admins", 0xFFFFFFFF, -2135.68, -247.47, 36.12, 30.0, 0, 0); //resgate 4
  172. Create3DTextLabel("{FF0000}[UDC]\n{FFFFFF}IP: 151.236.11.185:8780\n{FF0000}Universo dos Caminhoneiros - 2.0\n{FFFFFF}/ajuda\n{FF0000}/admins", 0xFFFFFFFF, 1766.83, -2040.70, 13.52, 30.0, 0, 0); //resgate 5
  173. Create3DTextLabel("{FF0000}[UDC]\n{FFFFFF}IP: 151.236.11.185:8780\n{FF0000}Universo dos Caminhoneiros - 2.0\n{FFFFFF}/ajuda\n{FF0000}/admins", 0xFFFFFFFF, -545.66, 2593.99, 53.51, 30.0, 0, 0); //5 SF
  174. Create3DTextLabel("{FF0000}[UDC]\n{FFFFFF}IP: 151.236.11.185:8780\n{FF0000}Universo dos Caminhoneiros - 2.0\n{FFFFFF}/ajuda\n{FF0000}/admins", 0xFFFFFFFF, 332.13, 899.69, 24.77, 30.0, 0, 0); //5 SF
  175. Create3DTextLabel("{FF0000[UDC]\n{FFFFFF}IP: 151.236.11.185:8780\n{FF0000}Universo dos Caminhoneiros - 2.0\n{FFFFFF}/ajuda\n{FF0000}/admins", 0xFFFFFFFF, -1575.18, -2724.28, 48.53, 30.0, 0, 0); //5 SF
  176. Create3DTextLabel("{FF0000}[UDC]\n{FFFFFF}IP: 151.236.11.185:8780\n{FF0000}Universo dos Caminhoneiros - 2.0\n{FFFFFF}/ajuda\n{FF0000}/admins", 0xFFFFFFFF, 661.59, 1718.29, 7.18, 30.0, 0, 0); //5 SF
  177. Create3DTextLabel("{FF0000}[UDC]\n{FFFFFF}IP: 151.236.11.185:8780\n{FF0000}Universo dos Caminhoneiros - 2.0\n{FFFFFF}/ajuda\n{FF0000}/admins", 0xFFFFFFFF, 2180.39, -2257.07, 14.77, 30.0, 0, 0); //5 SF
  178. Create3DTextLabel("{FF0000}[UDC]\n{FFFFFF}IP: 151.236.11.185:8780\n{FF0000}Universo dos Caminhoneiros - 2.0\n{FFFFFF}/ajuda\n{FF0000}/admins", 0xFFFFFFFF, 3.30, 1551.66, 12.75, 30.0, 0, 0); //5 SF
  179.  
  180. // TextDraw
  181. AberturaP0 = TextDrawCreate(486.000000, 125.000000, "Universo dos Caminhoneiros");
  182. TextDrawBackgroundColor(AberturaP0, 255);
  183. TextDrawFont(AberturaP0, 3);
  184. TextDrawLetterSize(AberturaP0, 0.329999, 1.000000);
  185. TextDrawColor(AberturaP0, -1);
  186. TextDrawSetOutline(AberturaP0, 1);
  187. TextDrawSetProportional(AberturaP0, 1);
  188.  
  189. // TextDraw
  190. AberturaP1 = TextDrawCreate(603.000000, 133.000000, "2.0");
  191. TextDrawBackgroundColor(AberturaP1, 255);
  192. TextDrawFont(AberturaP1, 3);
  193. TextDrawLetterSize(AberturaP1, 0.310000, 1.000000);
  194. TextDrawColor(AberturaP1, -16776961);
  195. TextDrawSetOutline(AberturaP1, 1);
  196. TextDrawSetProportional(AberturaP1, 1);
  197.  
  198. // TextDraw
  199. Abertura0 = TextDrawCreate(210.000000, 105.000000, "Universo dos Caminhoneiros");
  200. TextDrawBackgroundColor(Abertura0, 255);
  201. TextDrawFont(Abertura0, 3);
  202. TextDrawLetterSize(Abertura0, 0.519999, 3.400000);
  203. TextDrawColor(Abertura0, -1);
  204. TextDrawSetOutline(Abertura0, 1);
  205. TextDrawSetProportional(Abertura0, 1);
  206.  
  207. // TextDraw
  208. Abertura1 = TextDrawCreate(403.000000, 134.000000, "2.0");
  209. TextDrawBackgroundColor(Abertura1, 255);
  210. TextDrawFont(Abertura1, 3);
  211. TextDrawLetterSize(Abertura1, 0.340000, 1.500000);
  212. TextDrawColor(Abertura1, -16776961);
  213. TextDrawSetOutline(Abertura1, 1);
  214. TextDrawSetProportional(Abertura1, 1);
  215.  
  216. // TextDraw
  217. Textdraw0 = TextDrawCreate(0.0, 0.0, "loadsc10:loadsc10");
  218. TextDrawBackgroundColor(Textdraw0, 255);
  219. TextDrawFont(Textdraw0, 3);
  220. TextDrawLetterSize(Textdraw0,0.290000, 1.300000);
  221. TextDrawColor(Textdraw0, -1);
  222. TextDrawSetOutline(Textdraw0, 0);
  223. TextDrawSetProportional(Textdraw0, 1);
  224. TextDrawSetShadow(Textdraw0, 1);
  225. TextDrawUseBox(Textdraw0, 1);
  226. TextDrawBoxColor(Textdraw0, 255);
  227. TextDrawTextSize(Textdraw0, 639.000000, 448.000000);
  228.  
  229. SetTimer("timed",1000, 1);
  230. SetTimer("Climas",600000, 1);
  231.  
  232. new HostCommand[128];
  233. SendRconCommand(HostCommand);
  234. SetGameModeText(GameModeName);
  235. GameModeInit_VehiclesPickups();
  236. GameModeInit_Classes();
  237. Convoys_Init();
  238.  
  239. ShowPlayerMarkers(1);
  240. ShowNameTags(1);
  241. ManualVehicleEngineAndLights();
  242. EnableStuntBonusForAll(0);
  243. DisableInteriorEnterExits();
  244. UsePlayerPedAnims();
  245. SetTimer("Timer_TimedMessages", 1000 * 60 * 2, true);
  246. SetTimer("ShowRandomBonusMission", 1000 * 60 * 5, true);
  247. SetTimer("Toll", 1000, true);
  248. FixHouses();
  249. SetTimer("GlobalTimer", 1000, true);
  250.  
  251. for(new i; i < MAX_PLAYERS; i ++)
  252. {
  253.  
  254.  
  255.  
  256. if(IsPlayerConnected(i))
  257. {
  258.  
  259.  
  260.  
  261. TextDrawShowForPlayer(i, AberturaP0);
  262. TextDrawShowForPlayer(i, AberturaP1);
  263. TextDrawShowForPlayer(i, Textdraw0);
  264. }
  265. }
  266. return 1;
  267. }
  268. public OnGameModeExit()
  269. {
  270.  
  271. KillTimer(timer1);
  272. KillTimer(timer2);
  273. KillTimer(timer3);
  274. TextDrawHideForAll(AberturaP0);
  275. TextDrawDestroy(AberturaP0);
  276. TextDrawHideForAll(AberturaP1);
  277. TextDrawDestroy(AberturaP1);
  278. return 1;
  279. }
  280.  
  281. // This callback gets called when a player connects to the server
  282. public OnPlayerConnect(playerid)
  283. {
  284.  
  285. TextDrawShowForPlayer(playerid, ImagemEntrada);
  286. SendClientMessage(playerid, 0x0000FFAA, "");
  287. SendClientMessage(playerid, 0x0000FFAA, "");
  288. SendClientMessage(playerid, 0x0000FFAA, "");
  289. SendClientMessage(playerid, 0x0000FFAA, "");
  290. SendClientMessage(playerid, 0x0000FFAA, "");
  291. SendClientMessage(playerid, 0x0000FFAA, "");
  292. SendClientMessage(playerid, 0x0000FFAA, "");
  293. SendClientMessage(playerid, 0x0000FFAA, "");
  294. SendClientMessage(playerid, 0x0000FFAA, "");
  295. SendClientMessage(playerid, 0x0000FFAA, "");
  296. SendClientMessage(playerid, 0x0000FFAA, "");
  297. SendClientMessage(playerid, 0x0000FFAA, "");
  298. SendClientMessage(playerid, 0x0000FFAA, "");
  299. SendClientMessage(playerid, 0x0000FFAA, "");
  300. SendClientMessage(playerid, 0x0000FFAA, "");
  301. SendClientMessage(playerid, 0x0000FFAA, "");
  302. SendClientMessage(playerid, 0x0000FFAA, "");
  303. SendClientMessage(playerid, 0x0000FFAA, "");
  304. SendClientMessage(playerid, 0x0000FFAA, "");
  305. SendClientMessage(playerid, 0x0000FFAA, "");
  306. SendClientMessage(playerid, 0x0000FFAA, "");
  307. SendClientMessage(playerid, 0x0000FFAA, "");
  308. SendClientMessage(playerid, 0x0000FFAA, "");
  309. SendClientMessage(playerid, 0x0000FFAA, "");
  310. SendClientMessage(playerid, 0x0000FFAA, "");
  311. SendClientMessage(playerid, 0x0000FFAA, "");
  312. SendClientMessage(playerid, 0x0000FFAA, "");
  313. SendClientMessage(playerid, 0x0000FFAA, "");
  314. SendClientMessage(playerid, 0x0000FFAA, "");
  315. SendClientMessage(playerid, 0x0000FFAA, "");
  316. SendClientMessage(playerid, 0x0000FFAA, "");
  317. SendClientMessage(playerid, 0x0000FFAA, "");
  318. SendClientMessage(playerid, 0x0000FFAA, "");
  319. SendClientMessage(playerid, 0x0000FFAA, "");
  320. SendClientMessage(playerid, 0x0FFDD349, "=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=");
  321. SendClientMessage(playerid, 0x0FFDD349, " Universo dos Caminhoneiros ");
  322. SendClientMessage(playerid, 0x0FFDD349, " Sejam bem Vindo ao Servidor ");
  323. SendClientMessage(playerid, 0x0FFDD349, " Divirta-se e Obrigado Pela Presença ");
  324. SendClientMessage(playerid, 0x0FFDD349, " Melhor Servidor de Truck do Brasil ");
  325. SendClientMessage(playerid, 0x0FFDD349, " Versão 2.0 ");
  326. SendClientMessage(playerid, 0x0FFDD349, "=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=");
  327.  
  328. // Always allow NPC's to login without password or account
  329. if (IsPlayerNPC(playerid))
  330. return 1;
  331.  
  332. // Setup local variables
  333. new Name[MAX_PLAYER_NAME], NewPlayerMsg[128], HouseID;
  334.  
  335. // Setup a PVar to allow cross-script money-transfers (only from filterscript to this mainscript) and scorepoints
  336. SetPVarInt(playerid, "PVarMoney", 10000);
  337. SetPVarInt(playerid, "PVarScore", 0);
  338.  
  339. // Get the playername
  340. GetPlayerName(playerid, Name, sizeof(Name));
  341. // Also store this name for the player
  342. GetPlayerName(playerid, APlayerData[playerid][PlayerName], 24);
  343.  
  344. // Send a message to all players to let them know somebody else joined the server
  345. format(NewPlayerMsg, 128, TXT_PlayerJoinedServer, Name, playerid);
  346. SendClientMessageToAll(0xFFFFFFFF, NewPlayerMsg);
  347.  
  348. // Try to load the player's datafile ("PlayerFile_Load" returns "1" is the file has been read, "0" when the file cannot be read)
  349. if (PlayerFile_Load(playerid) == 1)
  350. {
  351.  
  352.  
  353.  
  354. // Check if the player is still banned
  355. if (APlayerData[playerid][BanTime] < gettime()) // Player ban-time is passed
  356. ShowPlayerDialog(playerid, DialogLogin, DIALOG_STYLE_INPUT, TXT_DialogLoginTitle, TXT_DialogLoginMsg, TXT_DialogLoginButton1, TXT_DialogButtonCancel);
  357. else // Player is still banned
  358. {
  359.  
  360.  
  361.  
  362. ShowRemainingBanTime(playerid); // Show the remaining ban-time to the player is days, hours, minutes, seconds
  363. Kick(playerid); // Kick the player
  364. }
  365. }
  366. else
  367. ShowPlayerDialog(playerid, DialogRegister, DIALOG_STYLE_INPUT, TXT_DialogRegisterTitle, TXT_DialogRegisterMsg, TXT_DialogRegisterButton1, TXT_DialogButtonCancel);
  368.  
  369. // The houses have been loaded but not the cars, so load all vehicles assigned to the player's houses
  370. for (new HouseSlot; HouseSlot < MAX_HOUSESPERPLAYER; HouseSlot++)
  371. {
  372.  
  373.  
  374.  
  375. // Get the HouseID from this slot
  376. HouseID = APlayerData[playerid][Houses][HouseSlot];
  377. // Check if there is a house in this slot
  378. if (HouseID != 0)
  379. HouseFile_Load(HouseID, true); // Load the cars of the house
  380. }
  381.  
  382. // Speedometer setup
  383. Speedometer_Setup(playerid);
  384.  
  385. // MissionText TextDraw setup
  386. APlayerData[playerid][MissionText] = TextDrawCreate(320.0, 430.0, " "); // Setup the missiontext at the bottom of the screen
  387. TextDrawAlignment(APlayerData[playerid][MissionText], 2); // Align the missiontext to the center
  388. TextDrawUseBox(APlayerData[playerid][MissionText], 1); // Set the missiontext to display inside a box
  389. TextDrawBoxColor(APlayerData[playerid][MissionText], 0x00000066); // Set the box color of the missiontext
  390.  
  391. // Display a message if the player hasn't accepted the rules yet
  392. if (APlayerData[playerid][RulesRead] == false)
  393. SendClientMessage(playerid, 0xFFFFFFFF, "{828282}Você não viu as Regras do Universo dos Caminhoneiros digite {FFFF00}({ffffff}/regras.{FFFF00})");
  394.  
  395. return 1;
  396. }
  397.  
  398.  
  399.  
  400. // This function shows the player how long his ban still is when he tries to login (in days, hours, minutes, seconds)
  401. ShowRemainingBanTime(playerid)
  402. {
  403.  
  404. // Setup local variables
  405. new TotalBanTime, Days, Hours, Minutes, Seconds, Msg[128];
  406.  
  407. // Get the total ban-time
  408. TotalBanTime = APlayerData[playerid][BanTime] - gettime();
  409.  
  410. // Calculate days
  411. if (TotalBanTime >= 86400)
  412. {
  413.  
  414.  
  415.  
  416. Days = TotalBanTime / 86400;
  417. TotalBanTime = TotalBanTime - (Days * 86400);
  418. }
  419. // Calculate hours
  420. if (TotalBanTime >= 3600)
  421. {
  422.  
  423.  
  424.  
  425. Hours = TotalBanTime / 3600;
  426. TotalBanTime = TotalBanTime - (Hours * 3600);
  427. }
  428. // Calculate minutes
  429. if (TotalBanTime >= 60)
  430. {
  431.  
  432.  
  433.  
  434. Minutes = TotalBanTime / 60;
  435. TotalBanTime = TotalBanTime - (Minutes * 60);
  436. }
  437. // Calculate seconds
  438. Seconds = TotalBanTime;
  439.  
  440. // Display the remaining ban-time for this player
  441. SendClientMessage(playerid, 0xFFFFFFFF, TXT_StillBanned);
  442. format(Msg, 128, TXT_BannedDuration, Days, Hours, Minutes, Seconds);
  443. SendClientMessage(playerid, 0xFFFFFFFF, Msg);
  444. }
  445.  
  446.  
  447.  
  448. // This callback gets called when a player disconnects from the server
  449. public OnPlayerDisconnect(playerid, reason)
  450. {
  451.  
  452.  
  453. // Setup local variables
  454. new Name[24], Msg[128], HouseID;
  455.  
  456. // Get the playername
  457. GetPlayerName(playerid, Name, sizeof(Name));
  458.  
  459.  
  460. // Send a message to all players to let them know somebody left the server
  461. format(Msg, 128, TXT_PlayerLeftServer, Name, playerid);
  462. SendClientMessageToAll(0xFFFFFFFF, Msg);
  463.  
  464. // If the player entered a proper password (the player has an account)
  465. if (strlen(APlayerData[playerid][PlayerPassword]) != 0)
  466. {
  467.  
  468.  
  469.  
  470. // Save the player data and his houses
  471. PlayerFile_Save(playerid);
  472. }
  473.  
  474. // Stop any job that may have started (this also clears all mission data)
  475. switch (APlayerData[playerid][PlayerClass])
  476. {
  477.  
  478.  
  479.  
  480. case ClassTruckDriver: Trucker_EndJob(playerid); // Stop any trucker job
  481. case ClassBusDriver: BusDriver_EndJob(playerid); // Stop any busdriver job
  482. case ClassPilot: Pilot_EndJob(playerid); // Stop any pilot job
  483. case ClassPolice: Police_EndJob(playerid); // Stop any police job
  484. case ClassMafia: Mafia_EndJob(playerid); // Stop any mafia job
  485. case ClassAssistance: Assistance_EndJob(playerid);
  486. case ClassRoadWorker: Roadworker_EndJob(playerid);
  487. }
  488. // If the player is part of a convoy, kick him from it
  489. Convoy_Leave(playerid);
  490.  
  491. // Unload all the player's house-vehicles to make room for other player's vehicles
  492. for (new HouseSlot; HouseSlot < MAX_HOUSESPERPLAYER; HouseSlot++)
  493. {
  494.  
  495.  
  496.  
  497. // Get the HouseID from this slot
  498. HouseID = APlayerData[playerid][Houses][HouseSlot];
  499. // Check if there is a house in this slot
  500. if (HouseID != 0)
  501. {
  502.  
  503.  
  504.  
  505. // Unload the cars of the house
  506. House_RemoveVehicles(HouseID);
  507. // Set the house so it cannot be entered by anyone (close the house)
  508. AHouseData[HouseID][HouseOpened] = false;
  509. }
  510. }
  511.  
  512. // Clear the data in the APlayerData array to make sure the next player with the same id doesn't hold wrong data
  513. APlayerData[playerid][SpectateID] = -1;
  514. APlayerData[playerid][SpectateVehicle] = -1;
  515. APlayerData[playerid][SpectateType] = ADMIN_SPEC_TYPE_NONE;
  516. APlayerData[playerid][LoggedIn] = false;
  517. APlayerData[playerid][AssistanceNeeded] = false;
  518. APlayerData[playerid][PlayerPassword] = 0;
  519. APlayerData[playerid][PlayerLevel] = 0;
  520. APlayerData[playerid][PlayerJailed] = 0;
  521. APlayerData[playerid][PlayerFrozen] = 0; // Clearing this variable automatically kills the frozentimer
  522. APlayerData[playerid][Bans] = 0;
  523. APlayerData[playerid][BanTime] = 0;
  524. APlayerData[playerid][Muted] = false;
  525. APlayerData[playerid][RulesRead] = false;
  526. APlayerData[playerid][AutoReportTime] = 0;
  527. APlayerData[playerid][TruckerLicense] = 0;
  528. APlayerData[playerid][BusLicense] = 0;
  529. APlayerData[playerid][PlayerClass] = 0;
  530. APlayerData[playerid][Warnings] = 0;
  531. APlayerData[playerid][PlayerMoney] = 0;
  532. APlayerData[playerid][PlayerScore] = 0;
  533. for (new HouseSlot; HouseSlot < MAX_HOUSESPERPLAYER; HouseSlot++)
  534. APlayerData[playerid][Houses][HouseSlot] = 0;
  535. for (new BusSlot; BusSlot < MAX_BUSINESSPERPLAYER; BusSlot++)
  536. APlayerData[playerid][Business][BusSlot] = 0;
  537. APlayerData[playerid][CurrentHouse] = 0;
  538.  
  539. // Clear bank account info
  540. APlayerData[playerid][BankPassword] = 0;
  541. APlayerData[playerid][BankLoggedIn] = false;
  542. APlayerData[playerid][BankMoney] = 0;
  543.  
  544. // Clear stats
  545. APlayerData[playerid][StatsTruckerJobs] = 0;
  546. APlayerData[playerid][StatsConvoyJobs] = 0;
  547. APlayerData[playerid][StatsBusDriverJobs] = 0;
  548. APlayerData[playerid][StatsPilotJobs] = 0;
  549. APlayerData[playerid][StatsMafiaJobs] = 0;
  550. APlayerData[playerid][StatsMafiaStolen] = 0;
  551. APlayerData[playerid][StatsPoliceFined] = 0;
  552. APlayerData[playerid][StatsPoliceJailed] = 0;
  553. APlayerData[playerid][StatsCourierJobs] = 0;
  554. APlayerData[playerid][StatsRoadworkerJobs] = 0;
  555. APlayerData[playerid][StatsAssistance] = 0;
  556. APlayerData[playerid][StatsMetersDriven] = 0.0;
  557.  
  558. // Clear police warnings
  559. APlayerData[playerid][PoliceCanJailMe] = false;
  560. APlayerData[playerid][PoliceWarnedMe] = false;
  561. APlayerData[playerid][Value_PoliceCanJailMe] = 0;
  562.  
  563. // Make sure the jailtimer has been destroyed
  564. KillTimer(APlayerData[playerid][PlayerJailedTimer]);
  565. KillTimer(APlayerData[playerid][Timer_PoliceCanJailMe]);
  566.  
  567. // Destroy the speedometer TextDraw for this player and the timer, also set the speed to 0
  568. Speedometer_Cleanup(playerid);
  569.  
  570. // Also destroy the missiontext TextDraw for this player
  571. TextDrawDestroy(APlayerData[playerid][MissionText]);
  572.  
  573. // Destroy a rented vehicle is the player had any
  574. if (APlayerData[playerid][RentedVehicleID] != 0)
  575. {
  576.  
  577.  
  578.  
  579. // Clear the data for the already rented vehicle
  580. AVehicleData[APlayerData[playerid][RentedVehicleID]][Model] = 0;
  581. AVehicleData[APlayerData[playerid][RentedVehicleID]][Fuel] = 100;
  582. AVehicleData[APlayerData[playerid][RentedVehicleID]][Owned] = false;
  583. AVehicleData[APlayerData[playerid][RentedVehicleID]][Owner] = 0;
  584. AVehicleData[APlayerData[playerid][RentedVehicleID]][PaintJob] = 0;
  585. for (new j; j < 14; j++)
  586. {
  587.  
  588.  
  589.  
  590. AVehicleData[APlayerData[playerid][RentedVehicleID]][Components][j] = 0;
  591. }
  592. // Destroy the vehicle
  593. DestroyVehicle(APlayerData[playerid][RentedVehicleID]);
  594. // Clear the RentedVehicleID
  595. APlayerData[playerid][RentedVehicleID] = 0;
  596. }
  597.  
  598. return 1;
  599. }
  600.  
  601.  
  602.  
  603. public OnPlayerText(playerid, text[])
  604. {
  605.  
  606. if(APlayerData[playerid][PlayerLevel] >= 1)
  607. {
  608. new textv2[128], name[MAX_PLAYER_NAME];
  609. GetPlayerName(playerid, name, sizeof (name));
  610. format(textv2, sizeof (textv2), "{FFFFFF}[ADMIN] {FF0000}%s {FFFFFF}[ID:%d]:{FFFFFF} %s", name, playerid, text);
  611. SendClientMessageToAll(GetPlayerColor(playerid),textv2);
  612. return 0;
  613. }
  614.  
  615.  
  616. // Players ///
  617. if (APlayerData[playerid][Muted] == false)
  618. {
  619. new textv2[128], name[MAX_PLAYER_NAME];
  620. GetPlayerName(playerid, name, sizeof (name));
  621. format(textv2, sizeof (textv2), "%s {FFFFFF}[ID:%d]:{FFFFFF} %s", name, playerid, text);
  622. SendClientMessageToAll(GetPlayerColor(playerid),textv2);
  623. return 0;
  624. }
  625.  
  626.  
  627. // Block the player's text if he has been muted
  628. if (APlayerData[playerid][Muted] == true)
  629. {
  630.  
  631.  
  632. SendClientMessage(playerid, 0xFFFFFFFF, "Você está mudo e não pode Falar!");
  633. return 0;
  634. }
  635. return 1;
  636. }
  637.  
  638.  
  639. // This callback gets called when a player interacts with a dialog
  640. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  641. {
  642.  
  643. // Select the proper dialog to process
  644. switch (dialogid)
  645. {
  646.  
  647.  
  648.  
  649. case DialogRegister: Dialog_Register(playerid, response, inputtext); // The "Register"-dialog
  650. case DialogLogin: Dialog_Login(playerid, response, inputtext); // The "Login"-dialog
  651.  
  652. case DialogStatsOtherPlayer: Dialog_StatsOtherPlayer(playerid, response, listitem);
  653. case DialogStatsHouse: Dialog_StatsHouse(playerid, response, listitem);
  654. case DialogStatsGoHouse: Dialog_StatsGoHouse(playerid, response, listitem);
  655. case DialogStatsGoBusiness: Dialog_StatsGoBusiness(playerid, response, listitem);
  656.  
  657. case DialogRescue: Dialog_Rescue(playerid, response, listitem); // The rescue-dialog
  658.  
  659. case DialogBuyLicenses: Dialog_BuyLicenses(playerid, response, listitem); // The license-dialog (allows the player to buy trucker/busdriver licenses)
  660.  
  661. case DialogRules: Dialog_Rules(playerid, response);
  662.  
  663. case DialogTruckerJobMethod: Dialog_TruckerSelectJobMethod(playerid, response, listitem); // The work-dialog for truckers (shows the loads he can carry and lets the player choose the load)
  664. case DialogTruckerSelectLoad: Dialog_TruckerSelectLoad(playerid, response, listitem); // The load-selection dialog for truckers (shows the startlocations for the selected load and let the player choose his startlocation)
  665. case DialogTruckerStartLoc: Dialog_TruckerSelectStartLoc(playerid, response, listitem); // The start-location dialog for truckers (shows the endlocations for the selected load and let the player choose his endlocation)
  666. case DialogTruckerEndLoc: Dialog_TruckerSelectEndLoc(playerid, response, listitem); // The end-location dialog for truckers (processes the selected endlocation and starts the job)
  667.  
  668. case DialogBusJobMethod: Dialog_BusSelectJobMethod(playerid, response, listitem); // The work-dialog for busdrivers (process the options to choose own busroute or auto-assigned busroute)
  669. case DialogBusSelectRoute: Dialog_BusSelectRoute(playerid, response, listitem); // Choose the busroute and start the job
  670.  
  671. case DialogCourierSelectQuant: Dialog_CourierSelectQuant(playerid, response, listitem);
  672.  
  673. case DialogBike: Dialog_Bike(playerid, response, listitem); // The bike-dialog
  674. case DialogCar: Dialog_Car(playerid, response, listitem); // The car-dialog (which uses a split dialog structure)
  675. case DialogPlane: Dialog_Plane(playerid, response, listitem); // The plane-dialog (which uses a split dialog structure)
  676. case DialogTrailer: Dialog_Trailer(playerid, response, listitem); // The trailer-dialog (which uses a split dialog structure)
  677. case DialogBoat: Dialog_Boat(playerid, response, listitem); // The boat-dialog
  678.  
  679. case DialogRentCarClass: Dialog_RentProcessClass(playerid, response, listitem); // The player chose a vehicleclass from where he can rent a vehicle
  680. case DialogRentCar: Dialog_RentCar(playerid, response, listitem); // The player chose a vehicle from the list of vehicles from the vehicleclass he chose before
  681.  
  682. case DialogPlayerCommands: Dialog_PlayerCommands(playerid, response, listitem); // Displays all commands in a split-dialog structure
  683. case DialogPrimaryCarColor: Dialog_PrimaryCarColor(playerid, response, listitem);
  684. case DialogSedundaryCarColor: Dialog_SedundaryCarColor(playerid, response, listitem);
  685.  
  686. case DialogWeather: Dialog_Weather(playerid, response, listitem); // The weather dialog
  687. case DialogCarOption: Dialog_CarOption(playerid, response, listitem); // The caroption dialog
  688.  
  689. case DialogSelectConvoy: Dialog_SelectConvoy(playerid, response, listitem);
  690.  
  691. case DialogHouseMenu: Dialog_HouseMenu(playerid, response, listitem); // Process the main housemenu
  692. case DialogUpgradeHouse: Dialog_UpgradeHouse(playerid, response, listitem); // Process the house-upgrade menu
  693. case DialogGoHome: Dialog_GoHome(playerid, response, listitem); // Port to one of your houses
  694. case DialogHouseNameChange: Dialog_ChangeHouseName(playerid, response, inputtext); // Change the name of your house
  695. case DialogSellHouse: Dialog_SellHouse(playerid, response); // Sell the house
  696. case DialogBuyCarClass: Dialog_BuyCarClass(playerid, response, listitem); // The player chose a vehicleclass from where he can buy a vehicle
  697. case DialogBuyCar: Dialog_BuyCar(playerid, response, listitem); // The player chose a vehicle from the list of vehicles from the vehicleclass he chose before
  698. case DialogSellCar: Dialog_SellCar(playerid, response, listitem);
  699. case DialogBuyInsurance: Dialog_BuyInsurance(playerid, response);
  700. case DialogGetCarSelectHouse: Dialog_GetCarSelectHouse(playerid, response, listitem);
  701. case DialogGetCarSelectCar: Dialog_GetCarSelectCar(playerid, response, listitem);
  702. case DialogUnclampVehicles: Dialog_UnclampVehicles(playerid, response);
  703.  
  704. case DialogCreateBusSelType: Dialog_CreateBusSelType(playerid, response, listitem);
  705. case DialogBusinessMenu: Dialog_BusinessMenu(playerid, response, listitem);
  706. case DialogGoBusiness: Dialog_GoBusiness(playerid, response, listitem);
  707. case DialogBusinessNameChange: Dialog_ChangeBusinessName(playerid, response, inputtext); // Change the name of your business
  708. case DialogSellBusiness: Dialog_SellBusiness(playerid, response); // Sell the business
  709.  
  710. case DialogBankPasswordRegister: Dialog_BankPasswordRegister(playerid, response, inputtext);
  711. case DialogBankPasswordLogin: Dialog_BankPasswordLogin(playerid, response, inputtext);
  712. case DialogBankOptions: Dialog_BankOptions(playerid, response, listitem);
  713. case DialogBankDeposit: Dialog_BankDeposit(playerid, response, inputtext);
  714. case DialogBankWithdraw: Dialog_BankWithdraw(playerid, response, inputtext);
  715. case DialogBankTransferMoney: Dialog_BankTransferMoney(playerid, response, inputtext);
  716. case DialogBankTransferName: Dialog_BankTransferName(playerid, response, inputtext);
  717. case DialogBankCancel: Dialog_BankCancel(playerid, response);
  718.  
  719. case DialogHelpItemChosen: Dialog_HelpItemChosen(playerid, response, listitem);
  720. case DialogHelpItem: Dialog_HelpItem(playerid, response);
  721.  
  722. case DialogOldPassword: Dialog_OldPassword(playerid, response, inputtext);
  723. case DialogNewPassword: Dialog_NewPassword(playerid, response, inputtext);
  724. case DialogConfirmPassword: Dialog_ConfirmPassword(playerid, response);
  725. }
  726.  
  727. return 1;
  728. }
  729.  
  730. // this callback gets called when a player clicks on another player on the scoreboard
  731. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  732. {
  733.  
  734. // Check if the player is an admin of at least level 1
  735. if (APlayerData[playerid][PlayerLevel] >= 1)
  736. {
  737.  
  738.  
  739.  
  740. // Setup local variables
  741. new Name[24], DialogTitle[128], PlayerStatList[3000], PlayerIP[16], NumHouses, NumBusinesses;
  742.  
  743. // Construct the dialog-title
  744. GetPlayerName(clickedplayerid, Name, sizeof(Name));
  745. format(DialogTitle, 128, "Statisticas do jogador: %s", Name);
  746.  
  747. // Add the IP of the player to the list
  748. GetPlayerIp(clickedplayerid, PlayerIP, sizeof(PlayerIP));
  749. format(PlayerStatList, sizeof(PlayerStatList), "%s{FFFFFF}IP: {00FF00}%s\n", PlayerStatList, PlayerIP);
  750. // Add the level of the player to the list
  751. format(PlayerStatList, sizeof(PlayerStatList), "%s{FFFFFF}Level de Admin: {00FF00}%i\n", PlayerStatList, APlayerData[clickedplayerid][PlayerLevel]);
  752. // Add the class of the player to the list
  753. switch(APlayerData[clickedplayerid][PlayerClass])
  754. {
  755.  
  756.  
  757.  
  758. case ClassTruckDriver: format(PlayerStatList, sizeof(PlayerStatList), "%s{FFFFFF}Classe: {00FF00}Caminhoneiro\n", PlayerStatList);
  759. case ClassBusDriver: format(PlayerStatList, sizeof(PlayerStatList), "%s{FFFFFF}Classe: {00FF00}Motorista de Ônibus\n", PlayerStatList);
  760. case ClassPilot: format(PlayerStatList, sizeof(PlayerStatList), "%s{FFFFFF}Classe: {00FF00}Piloto de Avião\n", PlayerStatList);
  761. case ClassPolice: format(PlayerStatList, sizeof(PlayerStatList), "%s{FFFFFF}Classe: {00FF00}Policial\n", PlayerStatList);
  762. case ClassMafia: format(PlayerStatList, sizeof(PlayerStatList), "%s{FFFFFF}Classe: {00FF00}Mafia\n", PlayerStatList);
  763. case ClassCourier: format(PlayerStatList, sizeof(PlayerStatList), "%s{FFFFFF}Classe: {00FF00}Correios\n", PlayerStatList);
  764. case ClassAssistance: format(PlayerStatList, sizeof(PlayerStatList), "%s{FFFFFF}Classe: {00FF00}Mecânico\n", PlayerStatList);
  765. case ClassRoadWorker: format(PlayerStatList, sizeof(PlayerStatList), "%s{FFFFFF}Classe: {00FF00}DNIT\n", PlayerStatList);
  766. }
  767. // Add money and score of the player to the list
  768. format(PlayerStatList, sizeof(PlayerStatList), "%s{FFFFFF}Dinheiro: {00FF00}%i\n", PlayerStatList, APlayerData[clickedplayerid][PlayerMoney]);
  769. format(PlayerStatList, sizeof(PlayerStatList), "%s{FFFFFF}Score: {00FF00}%i\n", PlayerStatList, APlayerData[clickedplayerid][PlayerScore]);
  770. // Add wanted-level of the player to the list
  771. format(PlayerStatList, sizeof(PlayerStatList), "%s{FFFFFF}Level de Procurado: {00FF00}%i\n", PlayerStatList, GetPlayerWantedLevel(clickedplayerid));
  772. // Add truckerlicense and busdriver license of the player to the list
  773. if (APlayerData[clickedplayerid][TruckerLicense] == 1)
  774. format(PlayerStatList, sizeof(PlayerStatList), "%s{FFFFFF}Licença de Caminhão: {00FF00}Sim\n", PlayerStatList);
  775. else
  776. format(PlayerStatList, sizeof(PlayerStatList), "%s{FFFFFF}Licença de Caminhão: {00FF00}Não\n", PlayerStatList);
  777.  
  778. if (APlayerData[clickedplayerid][BusLicense] == 1)
  779. format(PlayerStatList, sizeof(PlayerStatList), "%s{FFFFFF}Licença de Ônibus: {00FF00}Sim\n", PlayerStatList);
  780. else
  781. format(PlayerStatList, sizeof(PlayerStatList), "%s{FFFFFF}Licença de Ônibus: {00FF00}Não\n", PlayerStatList);
  782.  
  783. format(PlayerStatList, sizeof(PlayerStatList), "%s{FFFFFF}Trabalhos de Caminhoneiro: {00FF00}%i\n", PlayerStatList, APlayerData[clickedplayerid][StatsTruckerJobs]);
  784. format(PlayerStatList, sizeof(PlayerStatList), "%s{FFFFFF}Trabalhos em Comboio: {00FF00}%i\n", PlayerStatList, APlayerData[clickedplayerid][StatsConvoyJobs]);
  785. format(PlayerStatList, sizeof(PlayerStatList), "%s{FFFFFF}Trabalhos de Motorista de Ônibus: {00FF00}%i\n", PlayerStatList, APlayerData[clickedplayerid][StatsBusDriverJobs]);
  786. format(PlayerStatList, sizeof(PlayerStatList), "%s{FFFFFF}Trabalhos de Piloto: {00FF00}%i\n", PlayerStatList, APlayerData[clickedplayerid][StatsPilotJobs]);
  787. format(PlayerStatList, sizeof(PlayerStatList), "%s{FFFFFF}Trabalhos de Máfia: {00FF00}%i\n", PlayerStatList, APlayerData[clickedplayerid][StatsMafiaJobs]);
  788. format(PlayerStatList, sizeof(PlayerStatList), "%s{FFFFFF}Cargas-Máfia Roubadas: {00FF00}%i\n", PlayerStatList, APlayerData[clickedplayerid][StatsMafiaStolen]);
  789. format(PlayerStatList, sizeof(PlayerStatList), "%s{FFFFFF}Jogadores Multados: {00FF00}%i\n", PlayerStatList, APlayerData[clickedplayerid][StatsPoliceFined]);
  790. format(PlayerStatList, sizeof(PlayerStatList), "%s{FFFFFF}Jogadores Presos: {00FF00}%i\n", PlayerStatList, APlayerData[clickedplayerid][StatsPoliceJailed]);
  791. format(PlayerStatList, sizeof(PlayerStatList), "%s{FFFFFF}Trabalhos de Correios: {00FF00}%i\n", PlayerStatList, APlayerData[clickedplayerid][StatsCourierJobs]);
  792. format(PlayerStatList, sizeof(PlayerStatList), "%s{FFFFFF}Trabalhos de DNIT: {00FF00}%i\n", PlayerStatList, APlayerData[clickedplayerid][StatsRoadworkerJobs]);
  793. format(PlayerStatList, sizeof(PlayerStatList), "%s{FFFFFF}Jogadores Socorridos: {00FF00}%i\n", PlayerStatList, APlayerData[clickedplayerid][StatsAssistance]);
  794. format(PlayerStatList, sizeof(PlayerStatList), "%s{FFFFFF}Distância Percorrida: {00FF00}%f\n", PlayerStatList, APlayerData[clickedplayerid][StatsMetersDriven]);
  795.  
  796. // Count the number of houses/businesses that the player has and add them to the list
  797. for (new i; i < MAX_HOUSESPERPLAYER; i++)
  798. if (APlayerData[clickedplayerid][Houses][i] != 0)
  799. NumHouses++;
  800.  
  801. for (new i; i < MAX_BUSINESSPERPLAYER; i++)
  802. if (APlayerData[clickedplayerid][Business][i] != 0)
  803. NumBusinesses++;
  804.  
  805. format(PlayerStatList, sizeof(PlayerStatList), "%s{FFFFFF}Casas: {00FF00}%i (dois clicks para ver)\n", PlayerStatList, NumHouses);
  806. format(PlayerStatList, sizeof(PlayerStatList), "%s{FFFFFF}Empresas: {00FF00}%i (dois clicks para ver)\n", PlayerStatList, NumBusinesses);
  807.  
  808. // Store the player-id of the other player so the other dialogs can display his statistics further (houses, businesses, cars)
  809. APlayerData[playerid][DialogOtherPlayer] = clickedplayerid;
  810.  
  811. // Show the statistics of the other player
  812. ShowPlayerDialog(playerid, DialogStatsOtherPlayer, DIALOG_STYLE_LIST, DialogTitle, PlayerStatList, TXT_DialogButtonSelect, TXT_DialogButtonCancel); // Let the player buy a license
  813. }
  814.  
  815. return 1;
  816. }
  817.  
  818.  
  819.  
  820. // This callback gets called when a player picks up any pickup
  821. public OnPlayerPickUpPickup(playerid, pickupid)
  822. {
  823.  
  824. // If the player picks up the Buy_License pickup at the driving school in Doherty
  825. if (pickupid == Pickup_License)
  826. // Ask the player which license he wants to buy
  827. ShowPlayerDialog(playerid, DialogBuyLicenses, DIALOG_STYLE_LIST, TXT_DialogLicenseTitle, TXT_DialogLicenseList, TXT_DialogButtonBuy, TXT_DialogButtonCancel); // Let the player buy a license
  828.  
  829. return 1;
  830. }
  831.  
  832.  
  833.  
  834. // This callback gets called when a player spawns somewhere
  835. public OnPlayerSpawn(playerid)
  836. {
  837.  
  838. if (APlayerData[playerid][RulesRead] == false)
  839. {
  840.  
  841.  
  842.  
  843. new Msg[2000];
  844. format(Msg, 2000, "%s1. Sempre dirigir do lado direito nas estradas para evitar acidentes.\n", Msg);
  845. format(Msg, 2000, "%s2. Nao chingar ou desrespeitar os outros jogadores, eles sao seus companheiros.\n", Msg);
  846. format(Msg, 2000, "%s3. Usar a linguagem padrão 'Português'.\n", Msg);
  847. format(Msg, 2000, "%s4. Nao usar hackers ou será banido permanentemente.\n", Msg);
  848. format(Msg, 2000, "%s5. Nao floodar no chat, pode ser calado por um admin.\n", Msg);
  849. format(Msg, 2000, "%s6. Nao roubar carros, sujeito a prisao caso haja denuncia.\n", Msg);
  850. format(Msg, 2000, "%s7. Nunca chingue ou desrespeite um administrador, voce sera banido.\n", Msg);
  851. ShowPlayerDialog(playerid, DialogRules, DIALOG_STYLE_MSGBOX, "Regras", Msg, "Aceitar", TXT_DialogButtonCancel);
  852. }
  853. // Always allow NPC's to spawn without logging in
  854. if (IsPlayerNPC(playerid))
  855. return 1;
  856.  
  857. // Check if the player properly logged in by typing his password
  858. if (APlayerData[playerid][LoggedIn] == false)
  859. {
  860.  
  861.  
  862.  
  863. SendClientMessage(playerid, 0xFFFFFFFF, TXT_FailedLoginProperly);
  864. Kick(playerid); // Kick the player if he didn't log in properly
  865. }
  866.  
  867. // Setup local variables
  868. new missiontext[200];
  869.  
  870. // Spawn the player in the global world (where everybody plays the game)
  871. SetPlayerVirtualWorld(playerid, 0);
  872. SetPlayerInterior(playerid, 0);
  873. // Also set a variable that tracks in which house the player currently is
  874. APlayerData[playerid][CurrentHouse] = 0;
  875.  
  876. // Disable the clock
  877. TogglePlayerClock(playerid, 0);
  878.  
  879. // Delete all weapons from the player
  880. ResetPlayerWeapons(playerid);
  881.  
  882. // Set the missiontext based on the chosen class
  883. switch (APlayerData[playerid][PlayerClass])
  884. {
  885.  
  886.  
  887.  
  888. case ClassTruckDriver: // Truck-driver class
  889. {
  890.  
  891.  
  892.  
  893. format(missiontext, sizeof(missiontext), Trucker_NoJobText); // Preset the missiontext
  894. SetPlayerColor(playerid, ColorClassTruckDriver); // Set the playercolor (chatcolor for the player and color on the map)
  895. }
  896. case ClassBusDriver: // Bus-driver class
  897. {
  898.  
  899.  
  900.  
  901. format(missiontext, sizeof(missiontext), BusDriver_NoJobText); // Preset the missiontext
  902. SetPlayerColor(playerid, ColorClassBusDriver); // Set the playercolor (chatcolor for the player and color on the map)
  903. }
  904. case ClassPilot: // Pilot class
  905. {
  906.  
  907.  
  908.  
  909. format(missiontext, sizeof(missiontext), Pilot_NoJobText); // Preset the missiontext
  910. SetPlayerColor(playerid, ColorClassPilot); // Set the playercolor (chatcolor for the player and color on the map)
  911. }
  912. case ClassPolice: // Police class
  913. {
  914.  
  915.  
  916.  
  917. format(missiontext, sizeof(missiontext), Police_NoJobText); // Preset the missiontext
  918. SetPlayerColor(playerid, ColorClassPolice); // Set the playercolor (chatcolor for the player and color on the map)
  919. // Start the PlayerCheckTimer to scan for wanted players (be sure the timer has been destroyed first)
  920. KillTimer(APlayerData[playerid][PlayerCheckTimer]);
  921. APlayerData[playerid][PlayerCheckTimer] = SetTimerEx("Police_CheckWantedPlayers", 1000, true, "i", playerid);
  922. // Check if the police player can get weapons
  923. if (PoliceGetsWeapons == true)
  924. {
  925.  
  926.  
  927.  
  928. // Give up to 12 weapons to the player
  929. for (new i; i < 12; i++)
  930. GivePlayerWeapon(playerid, APoliceWeapons[i], PoliceWeaponsAmmo);
  931. }
  932. }
  933. case ClassMafia: // Mafia class
  934. {
  935.  
  936.  
  937.  
  938. format(missiontext, sizeof(missiontext), Mafia_NoJobText); // Preset the missiontext
  939. SetPlayerColor(playerid, ColorClassMafia); // Set the playercolor (chatcolor for the player and color on the map)
  940. // Start the PlayerCheckTimer to scan for players that carry mafia-loads (be sure the timer has been destroyed first)
  941. KillTimer(APlayerData[playerid][PlayerCheckTimer]);
  942. APlayerData[playerid][PlayerCheckTimer] = SetTimerEx("Mafia_CheckMafiaLoads", 1000, true, "i", playerid);
  943. }
  944. case ClassCourier: // Courier class
  945. {
  946.  
  947.  
  948.  
  949. format(missiontext, sizeof(missiontext), Courier_NoJobText); // Preset the missiontext
  950. SetPlayerColor(playerid, ColorClassCourier); // Set the playercolor (chatcolor for the player and color on the map)
  951. }
  952. case ClassAssistance: // Assistance class
  953. {
  954.  
  955.  
  956.  
  957. format(missiontext, sizeof(missiontext), Assistance_NoJobText); // Preset the missiontext
  958. SetPlayerColor(playerid, ColorClassAssistance); // Set the playercolor (chatcolor for the player and color on the map)
  959. // Start the PlayerCheckTimer to scan for players who need assistance (be sure the timer has been destroyed first)
  960. KillTimer(APlayerData[playerid][PlayerCheckTimer]);
  961. APlayerData[playerid][PlayerCheckTimer] = SetTimerEx("Assistance_CheckPlayers", 1000, true, "i", playerid);
  962. }
  963. case ClassRoadWorker: // Roadworker class
  964. {
  965.  
  966.  
  967.  
  968. format(missiontext, sizeof(missiontext), RoadWorker_NoJobText); // Preset the missiontext
  969. SetPlayerColor(playerid, ColorClassRoadWorker); // Set the playercolor (chatcolor for the player and color on the map)
  970. }
  971. }
  972.  
  973. // Set the missiontext
  974. TextDrawSetString(APlayerData[playerid][MissionText], missiontext);
  975. // Show the missiontext for this player
  976. TextDrawShowForPlayer(playerid, APlayerData[playerid][MissionText]);
  977.  
  978. // If the player spawns and his jailtime hasn't passed yet, put him back in jail
  979. if (APlayerData[playerid][PlayerJailed] != 0)
  980. Police_JailPlayer(playerid, APlayerData[playerid][PlayerJailed]);
  981. return 1;
  982. }
  983.  
  984.  
  985.  
  986. // This callback gets called whenever a player enters a checkpoint
  987. public OnPlayerEnterCheckpoint(playerid)
  988. {
  989.  
  990. // Check the player's class
  991. switch (APlayerData[playerid][PlayerClass])
  992. {
  993.  
  994.  
  995.  
  996. case ClassTruckDriver: // Truckdriver class
  997. Trucker_OnPlayerEnterCheckpoint(playerid); // Process the checkpoint (load or unload goods)
  998. case ClassBusDriver: // BusDriver class
  999. {
  1000.  
  1001.  
  1002.  
  1003. GameTextForPlayer(playerid, TXT_BusDriverMissionPassed, 3000, 4); // Show a message to let the player know he finished his job
  1004. BusDriver_EndJob(playerid); // End the current mission
  1005. }
  1006. case ClassPilot: // Pilot class
  1007. Pilot_OnPlayerEnterCheckpoint(playerid); // Process the checkpoint (load or unload)
  1008. case ClassMafia: // Mafia class
  1009. Mafia_OnPlayerEnterCheckpoint(playerid);
  1010. case ClassCourier: // Courier class
  1011. Courier_OnPlayerEnterCheckpoint(playerid);
  1012. case ClassRoadWorker: // Roadworker class
  1013. {
  1014.  
  1015.  
  1016.  
  1017. // Only end the mission when doing "repair-speedcamera" jobtype (checkpoint is the base of the roadworker)
  1018. if (APlayerData[playerid][JobID] == 1) // Repairing speedcamera's
  1019. {
  1020.  
  1021.  
  1022.  
  1023. GameTextForPlayer(playerid, TXT_RoadworkerMissionPassed, 3000, 4); // Show a message to let the player know he finished his job
  1024. Roadworker_EndJob(playerid); // End the current mission
  1025. }
  1026. if (APlayerData[playerid][JobID] == 2) // Towing broken vehicle to shredder
  1027. Roadworker_EnterCheckpoint(playerid);
  1028. }
  1029. }
  1030.  
  1031. return 1;
  1032. }
  1033.  
  1034.  
  1035.  
  1036. // This callback gets called when a player enters a race-checkpoint
  1037. public OnPlayerEnterRaceCheckpoint(playerid)
  1038. {
  1039.  
  1040. // Check the player's class
  1041. switch (APlayerData[playerid][PlayerClass])
  1042. {
  1043.  
  1044.  
  1045.  
  1046. case ClassBusDriver: // BusDriver class
  1047. Bus_EnterRaceCheckpoint(playerid); // Process the checkpoint
  1048. case ClassRoadWorker: // Roadworker class
  1049. Roadworker_EnterRaceCheckpoint(playerid);
  1050. }
  1051.  
  1052. return 1;
  1053. }
  1054.  
  1055.  
  1056.  
  1057. // This callback gets called whenever a player dies
  1058. public OnPlayerDeath(playerid, killerid, reason)
  1059. {
  1060.  
  1061. // Setup local variables
  1062. new VictimName[24], KillerName[24], Msg[128];
  1063.  
  1064. // Clear the missiontext
  1065. TextDrawSetString(APlayerData[playerid][MissionText], " ");
  1066. // Hide the missiontext for this player (when the player is choosing a class, it's not required to show any mission-text)
  1067. TextDrawHideForPlayer(playerid, APlayerData[playerid][MissionText]);
  1068.  
  1069. // Stop any job that may have started
  1070. switch (APlayerData[playerid][PlayerClass])
  1071. {
  1072.  
  1073.  
  1074.  
  1075. case ClassTruckDriver: Trucker_EndJob(playerid);
  1076. case ClassBusDriver: BusDriver_EndJob(playerid);
  1077. case ClassPilot: Pilot_EndJob(playerid);
  1078. case ClassPolice: Police_EndJob(playerid);
  1079. case ClassMafia: Mafia_EndJob(playerid);
  1080. case ClassCourier: Courier_EndJob(playerid);
  1081. case ClassAssistance: Assistance_EndJob(playerid);
  1082. case ClassRoadWorker: Roadworker_EndJob(playerid);
  1083. }
  1084.  
  1085. // If the player is part of a convoy,kick him from it
  1086. Convoy_Leave(playerid);
  1087.  
  1088. // If another player kills you, he'll get an extra star of his wanted level
  1089. if (killerid != INVALID_PLAYER_ID)
  1090. {
  1091.  
  1092.  
  1093.  
  1094. // Increase the wanted level of the killer by one star
  1095. SetPlayerWantedLevel(killerid, GetPlayerWantedLevel(killerid) + 1);
  1096. // Get the name of the killed player and the killer
  1097. GetPlayerName(playerid, VictimName, sizeof(VictimName));
  1098. GetPlayerName(killerid, KillerName, sizeof(KillerName));
  1099. // Let the killed know the police are informed about the kill
  1100. format(Msg, 128, "{FF0000}Você matou {FFFF00}%s{FF0000}, e agora está sendo procurado pela polícia.", VictimName);
  1101. SendClientMessage(killerid, 0xFFFFFFFF, Msg);
  1102. // Inform all police players about the kill
  1103. format(Msg, 128, "{00FF00}O jogador {FFFF00}%s{00FF00} matou {FFFF00}%s{00FF00}. [Objetvo]: Persiga-o e Multe-o.", KillerName, VictimName);
  1104. Police_SendMessage(Msg);
  1105. }
  1106.  
  1107. return 1;
  1108. }
  1109.  
  1110.  
  1111.  
  1112. // This callback gets called when the player is selecting a class (but hasn't clicked "Spawn" yet)
  1113. public OnPlayerRequestClass(playerid, classid)
  1114. {
  1115.  
  1116. TextDrawHideForPlayer(playerid, ImagemEntrada);
  1117. SetPlayerInterior(playerid,0);
  1118. SetPlayerFacingAngle(playerid, 90.0);
  1119. SetPlayerPos(playerid,-1932.51,2603.14,47.36);
  1120. SetPlayerCameraPos(playerid,-1938.92,2602.74,47.60);
  1121. SetPlayerCameraLookAt(playerid,-1932.51,2603.14,47.36);
  1122.  
  1123. // Display a short message to inform the player about the class he's about to choose
  1124. switch (classid)
  1125. {
  1126.  
  1127.  
  1128.  
  1129. case 0, 1, 2, 3, 4, 5, 6, 7: // Classes that will be truckdrivers
  1130. {
  1131.  
  1132.  
  1133.  
  1134. // Display the name of the class
  1135. GameTextForPlayer(playerid, TXT_ClassTrucker, 3000, 4);
  1136. // Store the class for the player (truckdriver)
  1137. APlayerData[playerid][PlayerClass] = ClassTruckDriver;
  1138. }
  1139. case 8, 9: // Classes that will be bus-drivers
  1140. {
  1141.  
  1142.  
  1143.  
  1144. // Display the name of the class
  1145. GameTextForPlayer(playerid, TXT_ClassBusDriver, 3000, 4);
  1146. // Store the class for the player (busdriver)
  1147. APlayerData[playerid][PlayerClass] = ClassBusDriver;
  1148. }
  1149. case 10: // Classes that will be Pilot
  1150. {
  1151.  
  1152.  
  1153.  
  1154. // Display the name of the class
  1155. GameTextForPlayer(playerid, TXT_ClassPilot, 3000, 4);
  1156. // Store the class for the player (pilot)
  1157. APlayerData[playerid][PlayerClass] = ClassPilot;
  1158. }
  1159. case 11, 12, 13: // Classes that will be police
  1160. {
  1161.  
  1162.  
  1163.  
  1164. // Display the name of the class
  1165. GameTextForPlayer(playerid, TXT_ClassPolice, 3000, 4);
  1166. // Store the class for the player (police)
  1167. APlayerData[playerid][PlayerClass] = ClassPolice;
  1168. }
  1169. case 14, 15, 16: // Classes that will be mafia
  1170. {
  1171.  
  1172.  
  1173.  
  1174. // Display the name of the class
  1175. GameTextForPlayer(playerid, TXT_ClassMafia, 3000, 4);
  1176. // Store the class for the player (mafia)
  1177. APlayerData[playerid][PlayerClass] = ClassMafia;
  1178. }
  1179. case 17, 18: // Classes that will be courier
  1180. {
  1181.  
  1182.  
  1183.  
  1184. // Display the name of the class
  1185. GameTextForPlayer(playerid, TXT_ClassCourier, 3000, 4);
  1186. // Store the class for the player (courier)
  1187. APlayerData[playerid][PlayerClass] = ClassCourier;
  1188. }
  1189. case 19: // Classes that will be assistance
  1190. {
  1191.  
  1192.  
  1193.  
  1194. // Display the name of the class
  1195. GameTextForPlayer(playerid, TXT_ClassAssistance, 3000, 4);
  1196. // Store the class for the player (assistance)
  1197. APlayerData[playerid][PlayerClass] = ClassAssistance;
  1198. }
  1199. case 20, 21, 22: // Classes that will be roadworker
  1200. {
  1201.  
  1202.  
  1203.  
  1204. // Display the name of the class
  1205. GameTextForPlayer(playerid, TXT_ClassRoadWorker, 3000, 4);
  1206. // Store the class for the player (roadworker)
  1207. APlayerData[playerid][PlayerClass] = ClassRoadWorker;
  1208. }
  1209. }
  1210.  
  1211. return 1;
  1212. }
  1213.  
  1214.  
  1215.  
  1216. // This callback is called when the player attempts to spawn via class-selection
  1217. public OnPlayerRequestSpawn(playerid)
  1218. {
  1219.  
  1220. new Index, Float:x, Float:y, Float:z, Float:Angle, Name[24], Msg[128];
  1221.  
  1222. // Get the player's name
  1223. GetPlayerName(playerid, Name, sizeof(Name));
  1224.  
  1225. // Choose a random spawnlocation based on the player's class
  1226. switch (APlayerData[playerid][PlayerClass])
  1227. {
  1228.  
  1229.  
  1230.  
  1231. case ClassTruckDriver:
  1232. {
  1233.  
  1234.  
  1235.  
  1236. Index = random(sizeof(ASpawnLocationsTrucker)); // Get a random array-index to chose a random spawnlocation
  1237. x = ASpawnLocationsTrucker[Index][SpawnX]; // Get the X-position for the spawnlocation
  1238. y = ASpawnLocationsTrucker[Index][SpawnY]; // Get the Y-position for the spawnlocation
  1239. z = ASpawnLocationsTrucker[Index][SpawnZ]; // Get the Z-position for the spawnlocation
  1240. Angle = ASpawnLocationsTrucker[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation
  1241. format(Msg, 128, "{FF8000}O Jogador {FFFFff}%s{FF8000} entrou no server como um {FF8000}Caminhoneiro.", Name);
  1242. }
  1243. case ClassBusDriver:
  1244. {
  1245.  
  1246.  
  1247.  
  1248. Index = random(sizeof(ASpawnLocationsBusDriver));
  1249. x = ASpawnLocationsBusDriver[Index][SpawnX]; // Get the X-position for the spawnlocation
  1250. y = ASpawnLocationsBusDriver[Index][SpawnY]; // Get the Y-position for the spawnlocation
  1251. z = ASpawnLocationsBusDriver[Index][SpawnZ]; // Get the Z-position for the spawnlocation
  1252. Angle = ASpawnLocationsBusDriver[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation
  1253. format(Msg, 128, "{00FFFF}O Jogador {FFFFff}%s{00FFFF} entrou no server como um {00FFFF}Motorista de Onibus.", Name);
  1254. }
  1255. case ClassPilot:
  1256. {
  1257.  
  1258.  
  1259.  
  1260. Index = random(sizeof(ASpawnLocationsPilot));
  1261. x = ASpawnLocationsPilot[Index][SpawnX]; // Get the X-position for the spawnlocation
  1262. y = ASpawnLocationsPilot[Index][SpawnY]; // Get the Y-position for the spawnlocation
  1263. z = ASpawnLocationsPilot[Index][SpawnZ]; // Get the Z-position for the spawnlocation
  1264. Angle = ASpawnLocationsPilot[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation
  1265. format(Msg, 128, "{008080}O Jogador {FFFFff}%s{008080} entrou no server como um {008080}Piloto de Avião.", Name);
  1266. }
  1267. case ClassPolice:
  1268. {
  1269.  
  1270.  
  1271.  
  1272. // Count the number of normal players (all classes except police) and count the amount of police players
  1273. new NormalPlayers, PolicePlayers, bool:CanSpawnAsCop = false;
  1274.  
  1275. // Block this check if PlayersBeforePolice is set to 0 (this allows anyone to join as police)
  1276. if (PlayersBeforePolice > 0)
  1277. {
  1278.  
  1279.  
  1280.  
  1281. // Loop through all players
  1282. for (new pid; pid < MAX_PLAYERS; pid++)
  1283. {
  1284.  
  1285.  
  1286.  
  1287. // Exclude this player, as he doesn't have a class yet, he's still choosing here
  1288. if (pid != playerid)
  1289. {
  1290.  
  1291.  
  1292.  
  1293. // Also exclude all players who are still in the class-selection screen, as they don't have a class selected yet
  1294. if (GetPlayerInterior(pid) != 14)
  1295. {
  1296.  
  1297.  
  1298.  
  1299. // Check if this player is logged in
  1300. if (APlayerData[pid][LoggedIn] == true)
  1301. {
  1302.  
  1303.  
  1304.  
  1305. // Count the amount of normal players and police players
  1306. switch (APlayerData[pid][PlayerClass])
  1307. {
  1308.  
  1309.  
  1310.  
  1311. case ClassPolice:
  1312. PolicePlayers++;
  1313. case ClassTruckDriver, ClassBusDriver, ClassPilot, ClassMafia, ClassCourier, ClassAssistance, ClassRoadWorker:
  1314. NormalPlayers++;
  1315. }
  1316. }
  1317. }
  1318. }
  1319. }
  1320. // Check if there are less police players than allowed
  1321. if (PolicePlayers < (NormalPlayers * PlayersBeforePolice))
  1322. CanSpawnAsCop = true; // There are less police players than allowed, so the player can choose this class
  1323. else
  1324. CanSpawnAsCop = false; // The maximum amount of police players has been reached, the player can't choose to be a cop
  1325.  
  1326. // Check if the player isn't allowed to spawn as police
  1327. if (CanSpawnAsCop == false)
  1328. {
  1329.  
  1330.  
  1331.  
  1332. // Let the player know the maximum amount of cops has been reached
  1333. GameTextForPlayer(playerid, "O número máximo de COP's online foi atingido.", 5000, 4);
  1334. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}O número máximo de COP's online foi atingido, por favor selecione outra classe.");
  1335. return 0; // Don't allow the player to spawn as police player
  1336. }
  1337. }
  1338.  
  1339. // If the player has less than 100 scorepoints
  1340. if (APlayerData[playerid][PlayerScore] < 200)
  1341. {
  1342.  
  1343.  
  1344.  
  1345. // Let the player know he needs 100 scorepoints
  1346. GameTextForPlayer(playerid, "~r~Voce precisa de ~b~200 ~r~pontos de score, para ser um ~y~policial~r~.", 5000, 4);
  1347. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Você precisa ter 200 pontos de score para ser um policial.");
  1348. return 0; // Don't allow the player to spawn as police player
  1349. }
  1350. // If the player has a wanted level
  1351. if (GetPlayerWantedLevel(playerid) > 0)
  1352. {
  1353.  
  1354.  
  1355.  
  1356. // Let the player know he cannot have a wanted level to join police
  1357. GameTextForPlayer(playerid, "Voce nao pode ser um policial enquanto estiver sendo procurado", 5000, 4);
  1358. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Você não pode ser um policial enquanto estiver sendo procurado.");
  1359. return 0; // Don't allow the player to spawn as police player
  1360. }
  1361.  
  1362. Index = random(sizeof(ASpawnLocationsPolice));
  1363. x = ASpawnLocationsPolice[Index][SpawnX]; // Get the X-position for the spawnlocation
  1364. y = ASpawnLocationsPolice[Index][SpawnY]; // Get the Y-position for the spawnlocation
  1365. z = ASpawnLocationsPolice[Index][SpawnZ]; // Get the Z-position for the spawnlocation
  1366. Angle = ASpawnLocationsPolice[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation
  1367. format(Msg, 128, "{0000FF}O Jogador {FFFFff}%s{0000FF} entrou no server como um Policial.", Name);
  1368. }
  1369. case ClassMafia:
  1370. {
  1371.  
  1372.  
  1373. Index = random(sizeof(ASpawnLocationsMafia));
  1374. x = ASpawnLocationsMafia[Index][SpawnX]; // Get the X-position for the spawnlocation
  1375. y = ASpawnLocationsMafia[Index][SpawnY]; // Get the Y-position for the spawnlocation
  1376. z = ASpawnLocationsMafia[Index][SpawnZ]; // Get the Z-position for the spawnlocation
  1377. Angle = ASpawnLocationsMafia[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation
  1378. format(Msg, 128, "{8000FF}O Jogador {FFFFff}%s{8000FF} entrou no server como um {8000FF}Mafioso.", Name);
  1379. }
  1380. case ClassCourier:
  1381. {
  1382.  
  1383.  
  1384.  
  1385. Index = random(sizeof(ASpawnLocationsCourier));
  1386. x = ASpawnLocationsCourier[Index][SpawnX]; // Get the X-position for the spawnlocation
  1387. y = ASpawnLocationsCourier[Index][SpawnY]; // Get the Y-position for the spawnlocation
  1388. z = ASpawnLocationsCourier[Index][SpawnZ]; // Get the Z-position for the spawnlocation
  1389. Angle = ASpawnLocationsCourier[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation
  1390. format(Msg, 128, "{FF00FF}O Jogador {FFFFff}%s{FF00FF} entrou no server como um {FF00FF}Agente dos Correios.", Name);
  1391. }
  1392. case ClassAssistance:
  1393. {
  1394.  
  1395.  
  1396.  
  1397. Index = random(sizeof(ASpawnLocationsAssistance));
  1398. x = ASpawnLocationsAssistance[Index][SpawnX]; // Get the X-position for the spawnlocation
  1399. y = ASpawnLocationsAssistance[Index][SpawnY]; // Get the Y-position for the spawnlocation
  1400. z = ASpawnLocationsAssistance[Index][SpawnZ]; // Get the Z-position for the spawnlocation
  1401. Angle = ASpawnLocationsAssistance[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation
  1402. format(Msg, 128, "{A5ED54}O Jogador {FFFFff}%s{A5ED54} entrou no server como um Mecânico.", Name);
  1403. }
  1404. case ClassRoadWorker:
  1405. {
  1406.  
  1407.  
  1408.  
  1409. Index = random(sizeof(ASpawnLocationsRoadWorker));
  1410. x = ASpawnLocationsRoadWorker[Index][SpawnX]; // Get the X-position for the spawnlocation
  1411. y = ASpawnLocationsRoadWorker[Index][SpawnY]; // Get the Y-position for the spawnlocation
  1412. z = ASpawnLocationsRoadWorker[Index][SpawnZ]; // Get the Z-position for the spawnlocation
  1413. Angle = ASpawnLocationsRoadWorker[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation
  1414. format(Msg, 128, "{FFFF80}O Jogador {FFFFff}%s{FFFF80} entrou no server como um {FFFF80}Funcionário do DNIT.", Name);
  1415. }
  1416. }
  1417.  
  1418.  
  1419. // Spawn the player with his chosen skin at a random location based on his class
  1420. SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), x, y, z, Angle, 0, 0, 0, 0, 0, 0);
  1421. // Send the message to all players (who joined which class)
  1422. SendClientMessageToAll(0xFFFFFFFF, Msg);
  1423.  
  1424. return 1;
  1425. }
  1426.  
  1427.  
  1428.  
  1429. // This callback gets called when a vehicle respawns at it's spawn-location (where it was created)
  1430. public OnVehicleSpawn(vehicleid)
  1431. {
  1432.  
  1433. // Set the vehicle as not-wanted by the mafia
  1434. AVehicleData[vehicleid][MafiaLoad] = false;
  1435. // Also reset the fuel to maximum (only for non-owned vehicles)
  1436. if (AVehicleData[vehicleid][Owned] == false)
  1437. AVehicleData[vehicleid][Fuel] = MaxFuel;
  1438.  
  1439. // Re-apply the paintjob (if any was applied)
  1440. if (AVehicleData[vehicleid][PaintJob] != 0)
  1441. {
  1442.  
  1443.  
  1444.  
  1445. // Re-apply the paintjob
  1446. ChangeVehiclePaintjob(vehicleid, AVehicleData[vehicleid][PaintJob] - 1);
  1447. }
  1448.  
  1449. // Also update the car-color
  1450. ChangeVehicleColor(vehicleid, AVehicleData[vehicleid][Color1], AVehicleData[vehicleid][Color2]);
  1451.  
  1452. // Re-add all components that were installed (if they were there)
  1453. for (new i; i < 14; i++)
  1454. {
  1455.  
  1456.  
  1457.  
  1458. // Remove all mods from the vehicle (all added mods applied by hackers will hopefully be removed this way when the vehicle respawns)
  1459. RemoveVehicleComponent(vehicleid, GetVehicleComponentInSlot(vehicleid, i));
  1460.  
  1461. // Check if the componentslot has a valid component-id
  1462. if (AVehicleData[vehicleid][Components][i] != 0)
  1463. AddVehicleComponent(vehicleid, AVehicleData[vehicleid][Components][i]); // Add the component to the vehicle
  1464. }
  1465.  
  1466. return 1;
  1467. }
  1468.  
  1469.  
  1470.  
  1471. // This callback is called when the vehicle leaves a mod shop
  1472. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  1473. {
  1474.  
  1475. // Let the player pay $150 for changing the color (if they have been changed)
  1476. if ((AVehicleData[vehicleid][Color1] != color1) || (AVehicleData[vehicleid][Color2] != color2))
  1477. {
  1478.  
  1479.  
  1480.  
  1481. RewardPlayer(playerid, -150, 0);
  1482. SendClientMessage(playerid, 0xFFFFFFFF, "{00FF00}Você alterou a cor do seu veículo por R$150.");
  1483. }
  1484.  
  1485. // Save the colors
  1486. AVehicleData[vehicleid][Color1] = color1;
  1487. AVehicleData[vehicleid][Color2] = color2;
  1488.  
  1489. // If the primary color is black, remove the paintjob
  1490. if (color1 == 0)
  1491. AVehicleData[vehicleid][PaintJob] = 0;
  1492.  
  1493. return 1;
  1494. }
  1495.  
  1496.  
  1497.  
  1498. // This callback gets called when a player enters or exits a mod-shop
  1499. public OnEnterExitModShop(playerid, enterexit, interiorid)
  1500. {
  1501.  
  1502. return 1;
  1503. }
  1504.  
  1505.  
  1506.  
  1507. // This callback gets called whenever a player mods his vehicle
  1508. public OnVehicleMod(playerid, vehicleid, componentid)
  1509. {
  1510.  
  1511. // When the player changes a component of his vehicle, reduce the price of the component from the player's money
  1512. APlayerData[playerid][PlayerMoney] = APlayerData[playerid][PlayerMoney] - AVehicleModPrices[componentid - 1000];
  1513.  
  1514. // Store the component in the AVehicleData array
  1515. AVehicleData[vehicleid][Components][GetVehicleComponentType(componentid)] = componentid;
  1516.  
  1517. return 1;
  1518. }
  1519.  
  1520.  
  1521.  
  1522. // This callback gets called whenever a player VIEWS at a paintjob in a mod garage (viewing automatically applies it)
  1523. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  1524. {
  1525.  
  1526. // Store the paintjobid for the vehicle (add 1 to the value, otherwise checking for an applied paintjob is difficult)
  1527. AVehicleData[vehicleid][PaintJob] = paintjobid + 1;
  1528.  
  1529. return 1;
  1530. }
  1531.  
  1532.  
  1533.  
  1534. // This callback gets called whenever a player enters a vehicle
  1535. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  1536. {
  1537.  
  1538. // Setup local variables
  1539. new engine, lights, alarm, doors, bonnet, boot, objective;
  1540.  
  1541. // Check if the vehicle has fuel
  1542. if (AVehicleData[vehicleid][Fuel] > 0)
  1543. {
  1544.  
  1545.  
  1546.  
  1547. // Start the engine and turn on the lights
  1548. GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  1549. SetVehicleParamsEx(vehicleid, 1, 1, alarm, doors, bonnet, boot, objective);
  1550. }
  1551.  
  1552. // Store the player's current location and interior-id, otherwise anti-airbreak hack code could kick you
  1553. GetPlayerPos(playerid, APlayerData[playerid][PreviousX], APlayerData[playerid][PreviousY], APlayerData[playerid][PreviousZ]);
  1554. APlayerData[playerid][PreviousInt] = GetPlayerInterior(playerid);
  1555.  
  1556. return 1;
  1557. }
  1558.  
  1559.  
  1560.  
  1561. // This callback gets called when a player exits his vehicle
  1562. public OnPlayerExitVehicle(playerid, vehicleid)
  1563. {
  1564.  
  1565. // Setup local variables
  1566. new engine, lights, alarm, doors, bonnet, boot, objective;
  1567.  
  1568. // Check if the player is the driver of the vehicle
  1569. if (GetPlayerVehicleSeat(playerid) == 0)
  1570. {
  1571.  
  1572.  
  1573.  
  1574. // Turn off the lights and engine
  1575. GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  1576. SetVehicleParamsEx(vehicleid, 0, 0, alarm, doors, bonnet, boot, objective);
  1577. }
  1578.  
  1579. // Chech if the player is a pilot
  1580. if (APlayerData[playerid][PlayerClass] == ClassPilot)
  1581. {
  1582.  
  1583.  
  1584.  
  1585. // If the pilot started a job --> as soon as a pilot leaves his plane while doing a job, he fails his mission
  1586. if (APlayerData[playerid][JobStarted] == true)
  1587. {
  1588.  
  1589.  
  1590.  
  1591. // End the job (clear data)
  1592. Pilot_EndJob(playerid);
  1593. // Inform the player that he failed the mission
  1594. GameTextForPlayer(playerid, TXT_FailedMission, 5000, 4);
  1595. // Reduce the player's cash by 1000
  1596. RewardPlayer(playerid, -1000, 0);
  1597. }
  1598. }
  1599.  
  1600. return 1;
  1601. }
  1602.  
  1603.  
  1604.  
  1605. // This callback gets called whenever a vehicle enters the water or is destroyed (explodes)
  1606. public OnVehicleDeath(vehicleid)
  1607. {
  1608.  
  1609. // Get the houseid to which this vehicle belongs
  1610. new HouseID = AVehicleData[vehicleid][BelongsToHouse];
  1611.  
  1612. // Check if this vehicle belongs to a house
  1613. if (HouseID != 0)
  1614. {
  1615.  
  1616.  
  1617.  
  1618. // If the house doesn't have insurance for it's vehicles
  1619. if (AHouseData[HouseID][Insurance] == 0)
  1620. {
  1621.  
  1622.  
  1623.  
  1624. // Delete the vehicle, clear the data and remove it from the house it belongs to
  1625. Vehicle_Delete(vehicleid);
  1626.  
  1627. // Save the house (and linked vehicles)
  1628. HouseFile_Save(HouseID);
  1629. }
  1630. }
  1631.  
  1632. return 1;
  1633. }
  1634.  
  1635.  
  1636.  
  1637. // This callback gets called when the player changes state
  1638. public OnPlayerStateChange(playerid,newstate,oldstate)
  1639. {
  1640.  
  1641. // Setup local variables
  1642. new vid, Name[24], Msg[128], engine, lights, alarm, doors, bonnet, boot, objective;
  1643.  
  1644. switch (newstate)
  1645. {
  1646.  
  1647.  
  1648.  
  1649. case PLAYER_STATE_DRIVER: // Player became the driver of a vehicle
  1650. {
  1651.  
  1652.  
  1653.  
  1654. // Get the ID of the player's vehicle
  1655. vid = GetPlayerVehicleID(playerid);
  1656. // Get the player's name (the one who is trying to enter the vehicle)
  1657. GetPlayerName(playerid, Name, sizeof(Name));
  1658.  
  1659. // Check if the vehicle is owned
  1660. if (AVehicleData[vid][Owned] == true)
  1661. {
  1662.  
  1663.  
  1664.  
  1665. // Check if the vehicle is owned by somebody else (strcmp will not be 0)
  1666. if (strcmp(AVehicleData[vid][Owner], Name, false) != 0)
  1667. {
  1668.  
  1669.  
  1670.  
  1671. // Force the player out of the vehicle
  1672. RemovePlayerFromVehicle(playerid);
  1673. // Turn off the lights and engine
  1674. GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
  1675. SetVehicleParamsEx(vid, 0, 0, alarm, doors, bonnet, boot, objective);
  1676. // Let the player know he cannot use somebody else's vehicle
  1677. format(Msg, 128, TXT_SpeedometerCannotUseVehicle, AVehicleData[vid][Owner]);
  1678. SendClientMessage(playerid, 0xFFFFFFFF, Msg);
  1679. }
  1680.  
  1681. // Check if the vehicle is clamped
  1682. if (AVehicleData[vid][Clamped] == true)
  1683. {
  1684.  
  1685.  
  1686.  
  1687. // Force the player out of the vehicle
  1688. RemovePlayerFromVehicle(playerid);
  1689. // Turn off the lights and engine
  1690. GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
  1691. SetVehicleParamsEx(vid, 0, 0, alarm, doors, bonnet, boot, objective);
  1692. // Let the player know he cannot use a clamped vehicle
  1693. format(Msg, 128, TXT_SpeedometerClampedVehicle);
  1694. SendClientMessage(playerid, 0xFFFFFFFF, Msg);
  1695. format(Msg, 128, TXT_SpeedometerClampedVehicle2);
  1696. SendClientMessage(playerid, 0xFFFFFFFF, Msg);
  1697. }
  1698. }
  1699.  
  1700. // Check if the player is not a cop
  1701. if (APlayerData[playerid][PlayerClass] != ClassPolice)
  1702. {
  1703.  
  1704.  
  1705.  
  1706. // First check if the vehicle is a static vehicle (player can still use a bought cop-car that he bought in his house,
  1707. // as a bought vehicle isn't static)
  1708. if (AVehicleData[vid][StaticVehicle] == true)
  1709. {
  1710.  
  1711.  
  1712.  
  1713. // Check if the entered vehicle is a cop vehicle
  1714. switch (GetVehicleModel(vid))
  1715. {
  1716.  
  1717.  
  1718.  
  1719. case VehiclePoliceLSPD, VehiclePoliceSFPD, VehiclePoliceLVPD, VehicleHPV1000, VehiclePoliceRanger:
  1720. {
  1721.  
  1722.  
  1723.  
  1724. // Force the player out of the vehicle
  1725. RemovePlayerFromVehicle(playerid);
  1726. // Turn off the lights and engine
  1727. GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
  1728. SetVehicleParamsEx(vid, 0, 0, alarm, doors, bonnet, boot, objective);
  1729. // Let the player know he cannot use a cop car
  1730. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Você não pode usar um veículo policial.");
  1731. }
  1732. }
  1733. }
  1734. }
  1735.  
  1736. // Check if the player is not a pilot
  1737. if (APlayerData[playerid][PlayerClass] != ClassPilot)
  1738. {
  1739.  
  1740.  
  1741.  
  1742. // First check if the vehicle is a static vehicle (player can still use a bought plane that he bought in his house,
  1743. // as a bought vehicle isn't static)
  1744. if (AVehicleData[vid][StaticVehicle] == true)
  1745. {
  1746.  
  1747.  
  1748.  
  1749. // Check if the entered vehicle is a plane or helicopter vehicle
  1750. switch (GetVehicleModel(vid))
  1751. {
  1752.  
  1753.  
  1754.  
  1755. case VehicleShamal, VehicleNevada, VehicleStuntPlane, VehicleDodo, VehicleMaverick, VehicleCargobob:
  1756. {
  1757.  
  1758.  
  1759.  
  1760. // Force the player out of the vehicle
  1761. RemovePlayerFromVehicle(playerid);
  1762. // Turn off the lights and engine
  1763. GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
  1764. SetVehicleParamsEx(vid, 0, 0, alarm, doors, bonnet, boot, objective);
  1765. // Let the player know he cannot use a cop car
  1766. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Você não pode usar um veículo de piloto.");
  1767. }
  1768. }
  1769. }
  1770. }
  1771. }
  1772. }
  1773.  
  1774. return 1;
  1775. }
  1776.  
  1777.  
  1778.  
  1779. // This callback gets called whenever a player presses a key
  1780. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  1781. {
  1782.  
  1783. // Debug the keypresses
  1784. // DebugKeys(playerid, newkeys, oldkeys);
  1785.  
  1786. // ****************************************************************************************
  1787. // NOTE: the keys are messed up, so the code may look strange when testing for certain keys
  1788. // ****************************************************************************************
  1789.  
  1790. // Fining and jailing players when you're police and press the correct keys
  1791. // Check the class of the player
  1792. switch (APlayerData[playerid][PlayerClass])
  1793. {
  1794.  
  1795.  
  1796.  
  1797. case ClassPolice:
  1798. {
  1799.  
  1800.  
  1801.  
  1802. // If the police-player pressed the RMB key (AIM key) when OUTSIDE his vehicle
  1803. if (((newkeys & KEY_HANDBRAKE) && !(oldkeys & KEY_HANDBRAKE)) && (GetPlayerVehicleID(playerid) == 0))
  1804. Police_FineNearbyPlayers(playerid);
  1805.  
  1806. // If the police-player pressed the LCTRL (SECUNDAIRY key) key when INSIDE his vehicle
  1807. if (((newkeys & KEY_ACTION) && !(oldkeys & KEY_ACTION)) && (GetPlayerVehicleID(playerid) != 0))
  1808. Police_WarnNearbyPlayers(playerid);
  1809. }
  1810. case ClassAssistance:
  1811. {
  1812.  
  1813.  
  1814.  
  1815. // If the assistance-player pressed the RMB key (AIM key) when OUTSIDE his vehicle
  1816. if (((newkeys & KEY_HANDBRAKE) && !(oldkeys & KEY_HANDBRAKE)) && (GetPlayerVehicleID(playerid) == 0))
  1817. Assistance_FixVehicle(playerid);
  1818.  
  1819. // If the police-player pressed the LCTRL (SECUNDAIRY key) key when INSIDE his vehicle
  1820. if (((newkeys & KEY_ACTION) && !(oldkeys & KEY_ACTION)) && (GetPlayerVehicleID(playerid) != 0))
  1821. Assistance_FixOwnVehicle(playerid);
  1822. }
  1823. }
  1824.  
  1825. // Trying to attach the closest vehicle to the towtruck when the player pressed FIRE when inside a towtruck
  1826. // Check if the player is inside a towtruck
  1827. if(GetVehicleModel(GetPlayerVehicleID(playerid)) == VehicleTowTruck)
  1828. {
  1829.  
  1830.  
  1831.  
  1832. // Check if the player pushed the fire-key
  1833. if(newkeys & KEY_FIRE)
  1834. {
  1835.  
  1836.  
  1837.  
  1838. // Get the vehicle-id of the closest vehicle
  1839. new closest = GetClosestVehicle(playerid);
  1840. if(VehicleToPlayer(playerid, closest) < 10) // Check if the closest vehicle is within 10m from the player
  1841. AttachTrailerToVehicle(closest, GetPlayerVehicleID(playerid)); // Attach the vehicle to the towtruck
  1842. }
  1843. }
  1844.  
  1845. // Refuel a vehicle when driving a vehicle and pressing the HORN key
  1846. // Check if the player presses the HORN key
  1847. if ((newkeys & KEY_CROUCH) && !(oldkeys & KEY_CROUCH))
  1848. {
  1849.  
  1850.  
  1851.  
  1852. // Check if the player is driving a vehicle
  1853. if (GetPlayerVehicleSeat(playerid) == 0)
  1854. {
  1855.  
  1856.  
  1857.  
  1858. // Loop through all ARefuelPickups
  1859. for (new i; i < sizeof(ARefuelPickups); i++)
  1860. {
  1861.  
  1862.  
  1863.  
  1864. // Check if the player is in range of a refuelpickup
  1865. if(IsPlayerInRangeOfPoint(playerid, 2.5, ARefuelPickups[i][pux], ARefuelPickups[i][puy], ARefuelPickups[i][puz]))
  1866. {
  1867.  
  1868.  
  1869.  
  1870. // Show a message that the player's vehicle is refuelling
  1871. GameTextForPlayer(playerid, TXT_Refuelling, 3000, 4);
  1872. // Don't allow the player to move again (the timer will allow it after refuelling)
  1873. TogglePlayerControllable(playerid, 0);
  1874. // Start a timer (let the player wait until the vehicle is refuelled)
  1875. SetTimerEx("RefuelVehicle", 5000, false, "i", playerid);
  1876. // Stop the search
  1877. break;
  1878. }
  1879. }
  1880. }
  1881. }
  1882.  
  1883. return 1;
  1884. }
  1885.  
  1886.  
  1887.  
  1888. forward VehicleToPlayer(playerid,vehicleid);
  1889. // Get the distance between the vehicle and the player
  1890. public VehicleToPlayer(playerid, vehicleid)
  1891. {
  1892.  
  1893. // Setup local variables
  1894. new Float:pX, Float:pY, Float:pZ, Float:cX, Float:cY, Float:cZ, Float:distance;
  1895. // Get the player position
  1896. GetPlayerPos(playerid, pX, pY, pZ);
  1897. // Get the vehicle position
  1898. GetVehiclePos(vehicleid, cX, cY, cZ);
  1899. // Calculate the distance
  1900. distance = floatsqroot(floatpower(floatabs(floatsub(cX, pX)), 2) + floatpower(floatabs(floatsub(cY, pY)), 2) + floatpower(floatabs(floatsub(cZ, pZ)), 2));
  1901. // Return the distance to the calling routine
  1902. return floatround(distance);
  1903. }
  1904.  
  1905.  
  1906.  
  1907. forward GetClosestVehicle(playerid);
  1908. // Find the vehicle closest to the player
  1909. public GetClosestVehicle(playerid)
  1910. {
  1911.  
  1912. // Setup local variables
  1913. new Float:distance = 99999.000+1, Float:distance2, result = -1;
  1914. // Loop through all vehicles
  1915. for(new i = 0; i < MAX_VEHICLES; i++)
  1916. {
  1917.  
  1918.  
  1919.  
  1920. // First check if the player isn't driving the current vehicle that needs to be checked for it's distance to the player
  1921. if (GetPlayerVehicleID(playerid) != i)
  1922. {
  1923.  
  1924.  
  1925.  
  1926. // Get the distance between player and vehicle
  1927. distance2 = VehicleToPlayer(playerid, i);
  1928. // Check if the distance is smaller than the previous distance
  1929. if(distance2 < distance)
  1930. {
  1931.  
  1932.  
  1933.  
  1934. // Store the distance
  1935. distance = distance2;
  1936. // Store the vehicle-id
  1937. result = i;
  1938. }
  1939. }
  1940. }
  1941.  
  1942. // Return the vehicle-id of the closest vehicle
  1943. return result;
  1944. }
  1945.  
  1946.  
  1947.  
  1948. // This function is used to debug the key-presses
  1949. stock DebugKeys(playerid, newkeys, oldkeys)
  1950. {
  1951.  
  1952. // Debug keys
  1953. if ((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE))
  1954. SendClientMessage(playerid, 0x0000FFFF, "You pressed the KEY_FIRE key");
  1955. if ((newkeys & KEY_ACTION) && !(oldkeys & KEY_ACTION))
  1956. SendClientMessage(playerid, 0x0000FFFF, "You pressed the KEY_ACTION key");
  1957. if ((newkeys & KEY_CROUCH) && !(oldkeys & KEY_CROUCH))
  1958. SendClientMessage(playerid, 0x0000FFFF, "You pressed the KEY_CROUCH key");
  1959. if ((newkeys & KEY_SPRINT) && !(oldkeys & KEY_SPRINT))
  1960. SendClientMessage(playerid, 0x0000FFFF, "You pressed the KEY_SPRINT key");
  1961. if ((newkeys & KEY_SECONDARY_ATTACK) && !(oldkeys & KEY_SECONDARY_ATTACK))
  1962. SendClientMessage(playerid, 0x0000FFFF, "You pressed the KEY_SECONDARY_ATTACK key");
  1963. if ((newkeys & KEY_JUMP) && !(oldkeys & KEY_JUMP))
  1964. SendClientMessage(playerid, 0x0000FFFF, "You pressed the KEY_JUMP key");
  1965. if ((newkeys & KEY_LOOK_RIGHT) && !(oldkeys & KEY_LOOK_RIGHT))
  1966. SendClientMessage(playerid, 0x0000FFFF, "You pressed the KEY_LOOK_RIGHT key");
  1967. if ((newkeys & KEY_HANDBRAKE) && !(oldkeys & KEY_HANDBRAKE))
  1968. SendClientMessage(playerid, 0x0000FFFF, "You pressed the KEY_HANDBRAKE key");
  1969. if ((newkeys & KEY_LOOK_LEFT) && !(oldkeys & KEY_LOOK_LEFT))
  1970. SendClientMessage(playerid, 0x0000FFFF, "You pressed the KEY_LOOK_LEFT key");
  1971. if ((newkeys & KEY_SUBMISSION) && !(oldkeys & KEY_SUBMISSION))
  1972. SendClientMessage(playerid, 0x0000FFFF, "You pressed the KEY_SUBMISSION key");
  1973. if ((newkeys & KEY_LOOK_BEHIND) && !(oldkeys & KEY_LOOK_BEHIND))
  1974. SendClientMessage(playerid, 0x0000FFFF, "You pressed the KEY_LOOK_BEHIND key");
  1975. if ((newkeys & KEY_WALK) && !(oldkeys & KEY_WALK))
  1976. SendClientMessage(playerid, 0x0000FFFF, "You pressed the KEY_WALK key");
  1977. if ((newkeys & KEY_ANALOG_UP) && !(oldkeys & KEY_ANALOG_UP))
  1978. SendClientMessage(playerid, 0x0000FFFF, "You pressed the KEY_ANALOG_UP key");
  1979. if ((newkeys & KEY_ANALOG_DOWN) && !(oldkeys & KEY_ANALOG_DOWN))
  1980. SendClientMessage(playerid, 0x0000FFFF, "You pressed the KEY_ANALOG_DOWN key");
  1981. if ((newkeys & KEY_ANALOG_LEFT) && !(oldkeys & KEY_ANALOG_LEFT))
  1982. SendClientMessage(playerid, 0x0000FFFF, "You pressed the KEY_ANALOG_LEFT key");
  1983. if ((newkeys & KEY_ANALOG_RIGHT) && !(oldkeys & KEY_ANALOG_RIGHT))
  1984. SendClientMessage(playerid, 0x0000FFFF, "You pressed the KEY_ANALOG_RIGHT key");
  1985. if ((newkeys & KEY_UP) && !(oldkeys & KEY_UP))
  1986. SendClientMessage(playerid, 0x0000FFFF, "You pressed the KEY_UP key");
  1987. if ((newkeys & KEY_DOWN) && !(oldkeys & KEY_DOWN))
  1988. SendClientMessage(playerid, 0x0000FFFF, "You pressed the KEY_DOWN key");
  1989. if ((newkeys & KEY_LEFT) && !(oldkeys & KEY_LEFT))
  1990. SendClientMessage(playerid, 0x0000FFFF, "You pressed the KEY_LEFT key");
  1991. if ((newkeys & KEY_RIGHT) && !(oldkeys & KEY_RIGHT))
  1992. SendClientMessage(playerid, 0x0000FFFF, "You pressed the KEY_RIGHT key");
  1993.  
  1994. return 1;
  1995.  
  1996. public timed(playerid)
  1997. {
  1998.  
  1999.  
  2000. new str2[128];
  2001. new hour;
  2002. new minute;
  2003. new second;
  2004.  
  2005. gettime(hour,minute,second);
  2006. format(str2, sizeof(str2), "%d:%d:%d", hour, minute, second);
  2007. TextDrawSetString(Text:txtTimeDisp, str2);
  2008. SetWorldTime(hour+3);
  2009. }
  2010. stock IsABike(vehicleid)
  2011. {
  2012.  
  2013.  
  2014. new result;
  2015. new model = GetVehicleModel(vehicleid);
  2016. switch(model)
  2017. {
  2018.  
  2019.  
  2020.  
  2021. case 509, 481, 510, 462, 448, 581, 522, 461, 521, 523, 463, 586, 468, 471: result = model;
  2022. default: result = 0;
  2023. }
  2024. return result;
  2025. }
  2026. public Climas()
  2027. {
  2028.  
  2029.  
  2030. new cl = random(13);
  2031. if(cl == 0) { SetWeather(0);SendClientMessageToAll(CLIMATEMPO, "[Rádio] Dia Limpo, Mínima de {0342F8}22°C{FFFFAF}, Máxima de {F80303}26°C{FFFFAF}."); }
  2032. if(cl == 1) { SetWeather(1);SendClientMessageToAll(CLIMATEMPO, "[Rádio] Clima Seco, Mínima de {0342F8}24°C{FFFFAF}, Máxima de {F80303}28°C{FFFFAF}."); }
  2033. if(cl == 2) { SetWeather(3);SendClientMessageToAll(CLIMATEMPO, "[Rádio] Ventos Fortes, Mínima de {0342F8}19°C{FFFFAF}, Máxima de {F80303}22°C{FFFFAF}."); }
  2034. if(cl == 3) { SetWeather(7);SendClientMessageToAll(CLIMATEMPO, "[Rádio] Tempo Nublado com Ventos fortes, Mínima de {0342F8}15°C{FFFFAF}, Máxima de {F80303}18°C{FFFFAF}."); }
  2035. if(cl == 4) { SetWeather(8);SendClientMessageToAll(CLIMATEMPO, "[Rádio] Tempo Chuvoso com Ventos fortes, Mínima de {0342F8}12°C{FFFFAF}, Máxima de {F80303}15°C{FFFFAF}."); }
  2036. if(cl == 5) { SetWeather(9);SendClientMessageToAll(CLIMATEMPO, "[Rádio] Neblina forte, Mínima de {0342F8}2°C{FFFFAF}, Máxima de {F80303}5°C{FFFFAF}."); }
  2037. if(cl == 6) { SetWeather(11);SendClientMessageToAll(CLIMATEMPO, "[Rádio] Céu Limpo, Mínima de {0342F8}22°C{FFFFAF}, Máxima de {F80303}26°C{FFFFAF}."); }
  2038. if(cl == 7) { SetWeather(12);SendClientMessageToAll(CLIMATEMPO, "[Rádio] Nublado com Ventos fracos, Mínima de {0342F8}15°C{FFFFAF}, Máxima de {F80303}18°C{FFFFAF}."); }
  2039. if(cl == 8) { SetWeather(13);SendClientMessageToAll(CLIMATEMPO, "[Rádio] Céu amarelado, Mínima de {0342F8}19°C{FFFFAF}, Máxima de {F80303}21°C{FFFFAF}."); }
  2040. if(cl == 9) { SetWeather(15);SendClientMessageToAll(CLIMATEMPO, "[Rádio] Tempo Nublado, Mínima de {0342F8}12°C{FFFFAF}, Máxima de {F80303}15°C{FFFFAF}."); }
  2041. if(cl == 10) { SetWeather(16);SendClientMessageToAll(CLIMATEMPO, "[Rádio] Chuva Forte, Cuidado com a pista escorregadia, Mínima de {0342F8}4°C{FFFFAF}, Máxima de {F80303}7°C{FFFFAF}."); }
  2042. if(cl == 11) { SetWeather(17);SendClientMessageToAll(CLIMATEMPO, "[Rádio] Céu Alaranjado, Mínima de {0342F8}11°C{FFFFAF}, Máxima de {F80303}14°C{FFFFAF}."); }
  2043. if(cl == 12) { SetWeather(19);SendClientMessageToAll(CLIMATEMPO, "[Rádio] Neblina Densa com Vento forte, Mínima de {0342F8}-2°C{FFFFAF}, Máxima de {F80303}1°C{FFFFAF}."); }
  2044. }
  2045. stock GetOnLinePlayers()
  2046. {
  2047.  
  2048.  
  2049. new OnLine;
  2050. for(new i, g = GetMaxPlayers(); i < g; i++)
  2051. if(IsPlayerConnected(i))
  2052. OnLine++;
  2053. return OnLine;
  2054. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement