Guest User

Untitled

a guest
May 9th, 2022
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.54 KB | None | 0 0
  1. #include <a_samp>
  2. #include <DOF2>
  3. #include <Pawn.CMD> // Usei pawn.cmd porque não tinha zcmd aqui, mas é só trocar pra zcmd que funciona perfeitamente.
  4. #include <streamer>
  5. #include <sscanf2>
  6.  
  7. #define function%0(%1) forward %0(%1); public %0(%1);
  8. #define COLOR_RED 0xFF0000FF
  9.  
  10. #define PASTA_ROUBOS "Roubos/%s"
  11.  
  12.  
  13.  
  14. enum pInfo
  15. {
  16. Ladrao,
  17. Roubou,
  18. Procurado
  19. };
  20. new PlayerInfo[MAX_PLAYERS][pInfo];
  21.  
  22. forward RoubandoCaixa(playerid);
  23.  
  24. new Str[128];
  25.  
  26. public OnGameModeInit()
  27. {
  28. //=-=-=-=-=-=-=-=-= Caixas =-=-=-=-=-=-=-=-=//
  29. CreateObject(2942, 2941.12231, -1023.85358, 11.41078, 0.00000, 0.00000, 86.46001);//1
  30. CreateObject(2942, 2941.15088, -1025.81519, 11.41078, 0.00000, 0.00000, 86.46001);//2
  31. CreateObject(2942, 2941.20190, -1021.55511, 11.41078, 0.00000, 0.00000, 86.46001);//3
  32. //=-=-=-=-=-=-=-=-= 3D =-=-=-=-=-=-=-=-=//
  33. Create3DTextLabel("Caixa 1'\n use:/roubar",0x5EAF03FF,2941.8210,-1025.9080,11.8258,10.0,0);//caixa1
  34. Create3DTextLabel("Caixa 2'\n use:/roubar",0x5EAF03FF,2941.7786,-1023.9998,11.8258,10.0,0);//caixa2
  35. Create3DTextLabel("Caixa 3'\n use:/roubar",0x5EAF03FF,2941.8572,-1021.6834,11.8258,10.0,0);//caixa3
  36. //=-=-=-=-=-=-=-=-= Pickup =-=-=-=-=-=-=-=-=//
  37. CreatePickup(1274, 1, 2941.8210,-1025.9080,11.8258,0);//caixa1
  38. CreatePickup(1274, 1, 2941.7786,-1023.9998,11.8258,0);//caixa2
  39. CreatePickup(1274, 1, 2941.8572,-1021.6834,11.8258,0);//caixa3
  40. return 1;
  41. }
  42.  
  43. public OnGameModeExit()
  44. {
  45. DOF2_Exit();
  46.  
  47. for(new playerid = 0; playerid < MAX_PLAYERS; playerid++) {
  48. if(IsPlayerConnected(playerid)) SaveIni(playerid);
  49. }
  50. return 1;
  51. }
  52.  
  53. public OnPlayerRequestClass(playerid, classid)
  54. {
  55. SetSpawnInfo(playerid, 0, 0, 1154.0398,-1771.1340,16.5992,2.6546, 0, 0, 0, 0, 0, 0);
  56. SpawnPlayer(playerid);
  57. return 1;
  58. }
  59. main()
  60. {
  61. }
  62.  
  63. public OnPlayerCommandText(playerid, cmdtext[])
  64. {
  65. return 0;
  66. }
  67. public OnPlayerConnect(playerid)
  68. {
  69. LoadInfo(playerid);
  70. return 1;
  71. }
  72. public OnPlayerDisconnect(playerid, reason)
  73. {
  74. new arquivo[128];
  75. format(arquivo, sizeof(arquivo), "Roubos/%s", GetPlayerNameEx(playerid));
  76. if(!DOF2_FileExists(arquivo)) return 1;
  77. DOF2_CreateFile(arquivo);
  78.  
  79. SaveIni(playerid);
  80. return 1;
  81. }
  82.  
  83. CMD:roubar(playerid)
  84. {
  85. if(IsPlayerInRangeOfPoint(playerid, 2.0, 2941.8210,-1025.9080,11.8258) || IsPlayerInRangeOfPoint(playerid, 2.0, 2941.7786,-1023.9998,11.8258) || IsPlayerInRangeOfPoint(playerid, 2.0, 2941.8572,-1021.6834,11.8258)) {
  86. SetTimerEx("RoubandoCaixa", 5000, false, "d", playerid);
  87. GameTextForPlayer(playerid, "Roubando!", 10000, 5);
  88. TogglePlayerControllable(playerid, 0);
  89. format(Str, sizeof(Str), "[ INFO ] O Player[%s][%d] Esta Roubando o banco central!", GetPlayerNameEx(playerid), playerid);
  90. SendClientMessageToAll(-1, Str), PlayerInfo[playerid][Roubou] = 1;
  91. SendClientMessage(playerid, COLOR_RED, "[ BANCO ] A polícia foi alertada."), SetPlayerWantedLevel(playerid, 5), PlayerInfo[playerid][Procurado] = 1;
  92. } else {
  93. SendClientMessage(playerid, COLOR_RED, "Você não está perto de um caixa para assalta-lo!");
  94. }
  95. return 1;
  96. }
  97.  
  98. forward RoubandoCaixa(playerid);
  99. public RoubandoCaixa(playerid)
  100. {
  101. format(Str, sizeof(Str), "[ INFO ] O Player[%s][%d] Conseguiu Roubar o Banco Central", GetPlayerNameEx(playerid), playerid);
  102. SendClientMessageToAll(-1, Str);
  103. GivePlayerMoney(playerid, 10000);
  104. TogglePlayerControllable(playerid, 1);
  105. return 1;
  106. }
  107.  
  108. stock SaveIni(playerid)
  109. {
  110. new arquivo[128];
  111. format(arquivo, sizeof(arquivo), PASTA_ROUBOS, GetPlayerNameEx(playerid));
  112.  
  113. DOF2_SetInt(arquivo, "Ladrao", PlayerInfo[playerid][Ladrao]);
  114. DOF2_SetInt(arquivo, "Roubou", PlayerInfo[playerid][Roubou]);
  115. DOF2_SetInt(arquivo, "Procurados", PlayerInfo[playerid][Procurado]);
  116. return 1;
  117. }
  118.  
  119. stock LoadInfo(playerid)
  120. {
  121. new arquivo[128];
  122.  
  123. format(arquivo, sizeof(arquivo), PASTA_ROUBOS, GetPlayerNameEx(playerid));
  124.  
  125.  
  126. DOF2_SetInt(arquivo, "Ladrao", PlayerInfo[playerid][Ladrao]);
  127. DOF2_SetInt(arquivo, "Roubou", PlayerInfo[playerid][Roubou]);
  128.  
  129. PlayerInfo[playerid][Ladrao] = DOF2_GetInt(arquivo, "Ladrao");
  130. PlayerInfo[playerid][Roubou] = DOF2_GetInt(arquivo, "Roubou");
  131.  
  132. PlayerInfo[playerid][Procurado] = DOF2_GetInt(arquivo, "Procurados");
  133.  
  134. if(PlayerInfo[playerid][Procurado] > 0)
  135. {
  136. SetPlayerWantedLevel(playerid, 5);
  137. } else {
  138. SetPlayerWantedLevel(playerid, 0);
  139. }
  140. return 1;
  141. }
  142.  
  143. stock GetPlayerNameEx(playerid)
  144. {
  145. static pName[MAX_PLAYER_NAME];
  146. GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
  147. return pName;
  148. }
Advertisement
Add Comment
Please, Sign In to add comment