Advertisement
Guest User

Untitled

a guest
Sep 14th, 2011
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define cVotacao 1
  4. #define cPergunta 2
  5. #define Creditos 3
  6.  
  7. #if defined MAX_PLAYERS
  8. #undef MAX_PLAYERS
  9. #define MAX_PLAYERS 50
  10. #endif
  11.  
  12. new
  13. Sim,
  14. Nao,
  15. aStr[90],
  16. Votou[MAX_PLAYERS],
  17. Votacao[MAX_PLAYERS]
  18. ;
  19.  
  20. public OnFilterScriptInit()
  21. {
  22. print("Sistema de Votação - Allan Kardec\n");
  23. return 1;
  24. }
  25.  
  26. main()
  27. {
  28. }
  29.  
  30. public OnPlayerCommandText(playerid, cmdtext[])
  31. {
  32. if(strcmp("/criarvotacao", cmdtext, true) == 0)
  33. {
  34. if(Votacao[playerid] == 1) return SendClientMessage(playerid, -1, "Já existe uma votação em andamento!");
  35. ShowPlayerDialog(playerid, cPergunta, DIALOG_STYLE_INPUT, "{FFFFFF}» {C9C9C9}Insira a pergunta da votação: {FFFFFF}«", "Insira a pergunta que será feita na votação:", "Confirmar","Cancelar");
  36. return 1;
  37. }
  38. if(strcmp("/encerrarvotacao", cmdtext, true) == 0)
  39. {
  40. SendClientMessage(playerid, 0x00FF00FF, "Encerrastes a votação!");
  41. Votacao[playerid] = 0;
  42. new Nome[MAX_PLAYER_NAME];
  43. GetPlayerName(playerid, Nome, sizeof(Nome));
  44. format(aStr, sizeof(aStr), "%s encerrou a votação » VOTOS: {00FF00}SIM » [%d] {FFFFFF}e {E31919}NÃO » [%d]", Nome, Sim, Nao);
  45. SendClientMessageToAll(-1, aStr);
  46. Sim = 0;
  47. Nao = 0;
  48. for(new a = 0; a < MAX_PLAYERS; a++)
  49. {
  50. Votou[a] = 0;
  51. }
  52. return 1;
  53. }
  54. if(strcmp("/creditos", cmdtext, true) == 0)
  55. {
  56. ShowPlayerDialog(playerid, Creditos, DIALOG_STYLE_MSGBOX, "{FFFF00}» Créditos do Sistema «","Desenvolvido por Allan Kardec\nAgradecimentos Especial: [O.z]Caroline ","Ok","Fechar");
  57. return 1;
  58. }
  59. return 0;
  60. }
  61.  
  62. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  63. {
  64. if(dialogid == cPergunta)
  65. {
  66. if(response)
  67. {
  68. for(new i = 0; i < MAX_PLAYERS; i++)
  69. {
  70. if(IsPlayerConnected(i))
  71. {
  72. ShowPlayerDialog(i, cVotacao, DIALOG_STYLE_MSGBOX, "{E31919}» {00FFFF}Votação: {E31919}«",inputtext,"Sim","Não"); // e essa 'string' seria o que ele inseriu no caso a pergunta no cmd tendeu? blxz. ^^
  73. }
  74. }
  75. }
  76. }
  77. if(dialogid == cVotacao)
  78. {
  79. if(response)
  80. {
  81. if(Votou[playerid] == 1) return SendClientMessage(playerid, 0xFFFFFFFF, "Você já votou uma vez!");
  82. Votou[playerid] = 1;
  83. Sim++;
  84. SendClientMessage(playerid, 0xFFFFFFFF, "Você votou em {00FF00}SIM{FFFFFF}!");
  85. }
  86. else if(!response)
  87. {
  88. if(Votou[playerid] == 1) return SendClientMessage(playerid, 0xFFFFFFFF, "Você já votou uma vez!");
  89. Votou[playerid] = 1;
  90. Nao++;
  91. SendClientMessage(playerid, 0xFFFFFFFF, "Você votou em {E31919}NÃO{FFFFFF}!");
  92. }
  93. }
  94. return 1;
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement