Guest User

Untitled

a guest
Sep 14th, 2011
499
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.47 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define cVoting 1
  4. #define cAnswer 2
  5. #define Credits 3
  6.  
  7. #if defined MAX_PLAYERS
  8. #undef MAX_PLAYERS
  9. #define MAX_PLAYERS 50
  10. #endif
  11.  
  12. new
  13. Yes,
  14. No,
  15. aStr[90],
  16. Voted[MAX_PLAYERS],
  17. Votiing[MAX_PLAYERS]
  18. ;
  19.  
  20. public OnFilterScriptInit()
  21. {
  22. print("Voting System - Allan Kardec\n");
  23. return 1;
  24. }
  25.  
  26. main()
  27. {
  28. }
  29.  
  30. public OnPlayerCommandText(playerid, cmdtext[])
  31. {
  32. if(strcmp("/createvoting", cmdtext, true) == 0)
  33. {
  34. if(Votiing[playerid] == 1) return SendClientMessage(playerid, -1, "There is already a vote in progress!");
  35. ShowPlayerDialog(playerid, cAnswer, DIALOG_STYLE_INPUT, "{FFFFFF}» {C9C9C9}Enter the question that will be made in the vote: {FFFFFF}«", "", "Confirm","Cancel");
  36. return 1;
  37. }
  38. if(strcmp("/endvoting", cmdtext, true) == 0)
  39. {
  40. SendClientMessage(playerid, 0x00FF00FF, "Concludes the voting!");
  41. Votiing[playerid] = 0;
  42. new Name[MAX_PLAYER_NAME];
  43. GetPlayerName(playerid, Name, sizeof(Name));
  44. format(aStr, sizeof(aStr), "%s concludes the voting » VOTES: {00FF00}YES » [%d] {FFFFFF}and {E31919}NO » [%d]", Name, Yes, No);
  45. SendClientMessageToAll(-1, aStr);
  46. Yes = 0;
  47. No = 0;
  48. for(new a = 0; a < MAX_PLAYERS; a++)
  49. {
  50. Voted[a] = 0;
  51. }
  52. return 1;
  53. }
  54. if(strcmp("/Credits", cmdtext, true) == 0)
  55. {
  56. ShowPlayerDialog(playerid, Credits, DIALOG_STYLE_MSGBOX, "{FFFF00}» System Credits «","Developed By Allan Kardec\nSpecial Thanks: [O.z]Caroline ","Ok","Close");
  57. return 1;
  58. }
  59. return 0;
  60. }
  61.  
  62. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  63. {
  64. if(dialogid == cAnswer)
  65. {
  66. if(response)
  67. {
  68. for(new i = 0; i < MAX_PLAYERS; i++)
  69. {
  70. if(IsPlayerConnected(i))
  71. {
  72. ShowPlayerDialog(i, cVoting, DIALOG_STYLE_MSGBOX, "{E31919}» {00FFFF}Voting: {E31919}«",inputtext,"Yes","No");
  73. }
  74. }
  75. }
  76. }
  77. if(dialogid == cVoting)
  78. {
  79. if(response)
  80. {
  81. if(Voted[playerid] == 1) return SendClientMessage(playerid, 0xFFFFFFFF, "You already voted once!");
  82. Voted[playerid] = 1;
  83. Yes++;
  84. SendClientMessage(playerid, 0xFFFFFFFF, "You voted in {00FF00}Yes{FFFFFF}!");
  85. }
  86. else if(!response)
  87. {
  88. if(Voted[playerid] == 1) return SendClientMessage(playerid, 0xFFFFFFFF, "You already voted once!!");
  89. Voted[playerid] = 1;
  90. No++;
  91. SendClientMessage(playerid, 0xFFFFFFFF, "You voted in {E31919}NO{FFFFFF}!");
  92. }
  93. }
  94. return 1;
  95. }
Advertisement
Add Comment
Please, Sign In to add comment