Guest User

[GM] Roubar Caixa

a guest
May 8th, 2022
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.74 KB | None | 0 0
  1. #include <a_samp>
  2. #include <DOF2>
  3. #include <zcmd>
  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. enum pInfo
  11. {
  12. Ladrao,
  13. Roubou
  14. }
  15. new PlayerInfo[MAX_PLAYERS][pInfo];
  16.  
  17. forward RoubandoCaixa(playerid);
  18.  
  19. new Str[144];
  20.  
  21. public OnGameModeInit()
  22. {
  23. //=-=-=-=-=-=-=-=-= Caixas =-=-=-=-=-=-=-=-=//
  24. CreateObject(2942, 2941.12231, -1023.85358, 11.41078, 0.00000, 0.00000, 86.46001);//1
  25. CreateObject(2942, 2941.15088, -1025.81519, 11.41078, 0.00000, 0.00000, 86.46001);//2
  26. CreateObject(2942, 2941.20190, -1021.55511, 11.41078, 0.00000, 0.00000, 86.46001);//3
  27. //=-=-=-=-=-=-=-=-= 3D =-=-=-=-=-=-=-=-=//
  28. Create3DTextLabel("Caixa 1'\n use:/roubar",0x5EAF03FF,2941.8210,-1025.9080,11.8258,10.0,0);//caixa1
  29. Create3DTextLabel("Caixa 2'\n use:/roubar",0x5EAF03FF,2941.7786,-1023.9998,11.8258,10.0,0);//caixa2
  30. Create3DTextLabel("Caixa 3'\n use:/roubar",0x5EAF03FF,2941.8572,-1021.6834,11.8258,10.0,0);//caixa3
  31. //=-=-=-=-=-=-=-=-= Pickup =-=-=-=-=-=-=-=-=//
  32. CreatePickup(1274, 1, 2941.8210,-1025.9080,11.8258,0);//caixa1
  33. CreatePickup(1274, 1, 2941.7786,-1023.9998,11.8258,0);//caixa2
  34. CreatePickup(1274, 1, 2941.8572,-1021.6834,11.8258,0);//caixa3
  35. return 1;
  36. }
  37.  
  38. public OnGameModeExit()
  39. {
  40. DOF2_Exit();
  41. return 1;
  42. }
  43.  
  44. public OnPlayerRequestClass(playerid, classid)
  45. {
  46. SetSpawnInfo(playerid, 0, 0, 1154.0398,-1771.1340,16.5992,2.6546, 0, 0, 0, 0, 0, 0);
  47. SpawnPlayer(playerid);
  48. return 1;
  49. }
  50. main()
  51. {
  52. }
  53. public OnVehicleSpawn(vehicleid)
  54. {
  55. return 1;
  56. }
  57.  
  58. public OnVehicleDeath(vehicleid, killerid)
  59. {
  60. return 1;
  61. }
  62.  
  63. public OnPlayerText(playerid, text[])
  64. {
  65. return 1;
  66. }
  67.  
  68. public OnPlayerCommandText(playerid, cmdtext[])
  69. {
  70. if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  71. {
  72. // Do something here
  73. return 1;
  74. }
  75. return 0;
  76. }
  77. public OnPlayerConnect(playerid)
  78. {
  79. new arquivo[34], playername[MAX_PLAYER_NAME];
  80. GetPlayerName(playerid, playername, sizeof(playername));
  81. format(arquivo, sizeof(arquivo), "Roubos/%s", playername);
  82.  
  83.  
  84. PlayerInfo[playerid][Ladrao] = DOF2_GetInt(arquivo, "Ladrao");
  85. PlayerInfo[playerid][Roubou] = DOF2_GetInt(arquivo, "Roubou");
  86. return 1;
  87. }
  88. public OnPlayerDisconnect(playerid, reason)
  89. {
  90. new arquivo[34], playername[MAX_PLAYER_NAME];
  91. GetPlayerName(playerid, playername, sizeof(playername));
  92. format(arquivo, sizeof(arquivo), "Roubos/%s", playername);
  93. if(DOF2_FileExists(arquivo))
  94. {
  95. DOF2_SetInt(arquivo, "Ladrao", PlayerInfo[playerid][Ladrao]);
  96. DOF2_SetInt(arquivo, "Roubou", PlayerInfo[playerid][Roubou]);
  97. }
  98. else
  99. {
  100. DOF2_CreateFile(arquivo);
  101. DOF2_SetInt(arquivo, "Ladrao", PlayerInfo[playerid][Ladrao]);
  102. DOF2_SetInt(arquivo, "Roubou", PlayerInfo[playerid][Roubou]);
  103. }
  104. return 1;
  105. }
  106.  
  107. CMD:roubar(playerid)
  108. {
  109. SetTimerEx("RoubandoCaixa", 10000, false, "i", playerid);
  110. GameTextForPlayer(playerid, "Roubando!", 10000, 5);
  111. TogglePlayerControllable(playerid,0);
  112. format(Str, sizeof(Str), "[ INFO ] O Player[%s][%d] Esta Roubando o banco central!", GetPlayerNameEx(playerid), playerid);
  113. SendClientMessageToAll(-1, Str);
  114. SendClientMessage(playerid, COLOR_RED, "A policia foi alertada!");
  115. return 1;
  116. }
  117. public RoubandoCaixa(playerid)
  118. {
  119. format(Str, sizeof(Str), "[ INFO ] O Player[%s][%d] Conseguiu Roubar o Banco Central", GetPlayerNameEx(playerid), playerid);
  120. SendClientMessageToAll(-1, Str);
  121. GivePlayerMoney(playerid, 10000);
  122. TogglePlayerControllable(playerid,1);
  123. return 1;
  124. }
  125. stock GetPlayerNameEx(playerid)
  126. {
  127. new PlayerName[MAX_PLAYER_NAME];
  128. GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
  129. return PlayerName;
  130. }
  131.  
Advertisement
Add Comment
Please, Sign In to add comment