Advertisement
Guest User

Simples Mini-Game Matemático - HomeHots

a guest
Jun 10th, 2014
2,378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.92 KB | None | 0 0
  1. /*
  2. -* Simples FS de mini-game matemático. (Bug's não encontrado).
  3. -* Script de base por: Don Speed.
  4. -* Script modificado por: GReeN_WOoD.
  5. */
  6.  
  7. #define FILTERSCRIPT
  8.  
  9. #include < a_samp >
  10. #include < zcmd >
  11. #include < sscanf2 >
  12.  
  13. #if defined FILTERSCRIPT
  14.  
  15. //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=//
  16.  
  17. #define MINUTO 2 // Aqui você define o tempo em minutos que o mini-game ficará ativo.
  18. #define @VERDE 0x00D900C8 // Verde Florescente
  19. #define @AMARELOC 0xFFE868AA // Amarelo Claro
  20. #define @AZULC 0x60BFFFAA // Azul Claro
  21.  
  22. //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=//
  23.  
  24. forward Comeco(playerid);
  25. forward CancelarMiniGame(playerid);
  26.  
  27. new MinhaResposta[MAX_PLAYERS];
  28. new bool:PermitirResp[MAX_PLAYERS] = false;
  29. new bool:Mini_Game_Ativo;
  30. new RespCorreta = 0;
  31.  
  32. enum pmat {
  33. ContaMat[50],
  34. Resposta
  35. }
  36.  
  37. //Aqui você pode criar mais contas.
  38. new _Matematica[9][pmat] = {
  39. { " 9*7 ", 63},
  40. { " 27+4+6-3 ", 34},
  41. { " 31+4-2-3 ", 30},
  42. { " 4*4-4 ", 12},
  43. { " 5*5+2 ", 27},
  44. { " 7*7+2+5-1 ", 55},
  45. { " 3*2+5-1 ", 10},
  46. { " 2*8-2-3 ", 11},
  47. { " 2*4+3-6 ", 5}
  48. };
  49.  
  50. Nome(playerid){
  51. new pNome[MAX_PLAYER_NAME];
  52. GetPlayerName(playerid, pNome, 24);
  53. return pNome;
  54. }
  55.  
  56. //=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=//
  57.  
  58. public OnFilterScriptInit() return print("\n- FilterScript de mini-mame matemático carregado.\n");
  59.  
  60. public Comeco(playerid){
  61. new _Rand = random(sizeof(_Matematica));
  62. static strm[128];
  63. SendClientMessageToAll(@AZULC, "=============================================================");
  64. format(strm, sizeof strm,"[MINI-GAME / MATEMÁTICA]{FFFFFF} %s", _Matematica[_Rand][ContaMat]);
  65. SendClientMessageToAll(0xFF0000FF, strm);
  66. SendClientMessageToAll(0x00FF00FF, "[MINI-GAME]{FFFFFF} Responda corretamente e ganhe R$200.");
  67. SendClientMessageToAll(0x00FF00FF, "[MINI-GAME]{FFFFFF} Para responder (/resultado).");
  68. SendClientMessageToAll(@AZULC, "=============================================================");
  69. for(new o = 0; o < MAX_PLAYERS; o++) PermitirResp[o] = true;
  70. RespCorreta = _Matematica[_Rand][Resposta];
  71. Mini_Game_Ativo = true;
  72. SetTimer("CancelarMiniGame", MINUTO*60000, false);
  73. return true;
  74. }
  75.  
  76. public CancelarMiniGame(){
  77. if(Mini_Game_Ativo == true) return SendClientMessageToAll(0x00FF00FF, "[MINI-GAME ENCERRADO]{FFFFFF} Ninguém ganhou no mini-game."), Mini_Game_Ativo = false;
  78. return true;
  79. }
  80.  
  81. //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=//
  82.  
  83. CMD:minigame(playerid) {
  84. if(Mini_Game_Ativo == true) return SendClientMessage(playerid, -1, "[MINI-GAME]{FFFFFF} Já existe um mini-game ativo.");
  85. SetTimer("Comeco", 5000, false);
  86. SendClientMessage(playerid, @AZULC, "Você ligou o mini-game matemático, aguarde 5 segundos.");
  87. SendClientMessageToAll(@AZULC, "Mini-game matemático irá ser iniciado dentro de 5 segundos, preparem-se!");
  88. return true;
  89. }
  90.  
  91. CMD:resultado(playerid, params[]) {
  92. static N;
  93. if (Mini_Game_Ativo == false) return SendClientMessage(playerid, -1, "[ERRO] O mini-game está desativado.");
  94. if(PermitirResp[playerid] == false) return SendClientMessage(playerid, -1, "[ERRO] Você não pode mais responder.");
  95. if(sscanf(params, "d", N))return SendClientMessage(playerid, 0x00FF00FF, "Use: /resultado [resposta da conta matemática]");
  96. MinhaResposta[playerid] = N;
  97. SendClientMessage(playerid, @AMARELOC, "Verificando sua resposta ...");
  98. if(MinhaResposta[playerid] == RespCorreta){
  99. static str[128];
  100. format(str, sizeof str,"[MINI-GAME RESULTADO]{FFFFFF} %s acertou o resultado do mini-game que é: %d .", Nome(playerid), RespCorreta);
  101. SendClientMessageToAll(@VERDE, str);
  102. RespCorreta = 0;
  103. MinhaResposta[playerid] = 0;
  104. Mini_Game_Ativo = false;
  105. GivePlayerMoney(playerid, 200);
  106. }
  107. else SendClientMessage(playerid, -1, "[ERRO] Você errou o resultado e não pode mais responder."), PermitirResp[playerid] = false;
  108. return true;
  109. }
  110.  
  111. //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=//
  112.  
  113. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement