Guest User

Szavazórendszer

a guest
Nov 23rd, 2015
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 6.49 KB | None | 0 0
  1. // This is a comment
  2. // uncomment the line below if you want to write a filterscript
  3. //#define FILTERSCRIPT
  4. //A Szavazórendszert magyarította: GoldTec
  5.  
  6. #include <a_samp>
  7. #include <IsPlayerLAdmin>
  8.  
  9. #define LARANJA             0xFF6600AA
  10. #define VERDECLARO          0x00FF0CAA
  11. #define VERDEMEDIO          0xa5b1A3AA
  12. #define BRANCO              0xFFFFFFAA
  13. #define VERMELHO            0xFF0000AA
  14. #define VERDEFRACO          0x80cf80AA
  15. #define COLOR_ULTRARED      0xFF0606FF
  16. #define COLOR_GREEN 0x33AA33AA
  17.  
  18. enum e_votacao
  19. {
  20.         bool:iniciada,
  21.         sim,
  22.         nao,
  23.         total
  24. }
  25. new votacao[e_votacao];
  26. new votou[MAX_PLAYERS];
  27.  
  28.  
  29. main()
  30. {
  31.     print("\n----------------------------------");
  32.     print(" Blank Gamemode by your name here");
  33.     print("----------------------------------\n");
  34. }
  35.  
  36. public OnGameModeInit()
  37. {
  38.     // Don't use these lines if it's a filterscript
  39.     SetGameModeText("Blank Script");
  40.     AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  41.     return 1;
  42. }
  43.  
  44. public OnGameModeExit()
  45. {
  46.     return 1;
  47. }
  48.  
  49.  
  50. public OnPlayerCommandText(playerid, cmdtext[])
  51. {
  52.     new string[256];
  53.     if(!strcmp(cmdtext, "/vote", true,5))
  54.         {
  55.                 if (IsPlayerAdminLevel(playerid, 5))
  56.                 {
  57.                     if(!votacao[iniciada])
  58.                     {
  59.                                 if(!strlen(cmdtext[6]))
  60.                                 return SendClientMessage(playerid,COLOR_ULTRARED, "Használat: /vote [kérdés]");
  61.                                 SendClientMessageToAll(LARANJA,"====================================");
  62.                                 format(string, sizeof string, "==> Új kérdés: %s?", cmdtext[6]);
  63.                                 SendClientMessageToAll(VERDECLARO, string);
  64.                                 SendClientMessageToAll(LARANJA,"        ");
  65.                                 SendClientMessageToAll(LARANJA," > A szavazáshoz írd be::");
  66.                                 SendClientMessageToAll(VERDEMEDIO, "> /igen - Hogy igennel szavazz.");
  67.                                 SendClientMessageToAll(VERDEMEDIO, "> /nem - Hogy nemmel szavazz.");
  68.                                 SendClientMessageToAll(LARANJA,"====================================");
  69.                                 votacao[iniciada] = true;
  70.                                 votacao[sim] = 0;
  71.                                 votacao[nao] = 0;
  72.                                 GameTextForAll("~r~Szavazas~w~~b~ letrehozva!",6000,3);
  73.                                 for(new i; i <MAX_PLAYERS; i++)
  74.                                 {
  75.                                         votou[i] = false;
  76.                                 }
  77.                         } else {
  78.                                 SendClientMessage(playerid,COLOR_ULTRARED,"Egy szavazás már el van indítva!");
  79.                         }
  80.                 } else {
  81.                         SendClientMessage(playerid,COLOR_ULTRARED,"Nincs elég magas szinted a parancs használatához!");
  82.                 }
  83.                 return 1;
  84.         }
  85.     if(!strcmp(cmdtext, "/igen", true))
  86.         {
  87.                 if(votacao[iniciada] && !votou[playerid])
  88.                 {
  89.                         SendClientMessage(playerid,LARANJA, "Sikeresen szavaztál az igenre!");
  90.                         votacao[sim]++;
  91.                         votacao[total]++;
  92.                         votou[playerid] = true;
  93.                         return 1;
  94.                 }
  95.                 return 0;
  96.         }
  97.     if(!strcmp(cmdtext, "/nem", true))
  98.         {
  99.                 if(votacao[iniciada] && !votou[playerid])
  100.                 {
  101.                         SendClientMessage(playerid,LARANJA, "Sikeresen szavaztál a nemre!");
  102.                         votacao[nao]++;
  103.                         votacao[total]++;
  104.                         votou[playerid] = true;
  105.                         return 1;
  106.                 }
  107.                 return 0;
  108.         }
  109.     if(!strcmp(cmdtext, "/end", true))
  110.         {
  111.                 if (IsPlayerAdminLevel(playerid, 5))
  112.                 {
  113.                         if(votacao[iniciada])
  114.                         {
  115.                                 SendClientMessageToAll(LARANJA,"====================================");
  116.                                 SendClientMessageToAll(LARANJA, "==> Eredmény: <<==");
  117.                                 format(string, sizeof string, "> %d Játékos igennel szavazott.", votacao[sim]);
  118.                                 SendClientMessageToAll(VERDEMEDIO,string);
  119.                                 format(string, sizeof string, "> %d Játékos nemmel szavazott.", votacao[nao]);
  120.                                 SendClientMessageToAll(VERDEMEDIO, string);
  121.                                 format(string, sizeof string, "> Ennyi szavazat érkezett: %d",votacao[total]);
  122.                                 SendClientMessageToAll(BRANCO, string);
  123.                                 if(votacao[sim] == votacao[nao])
  124.                                 {
  125.                                         SendClientMessageToAll(COLOR_GREEN, "==> Döntetlen lett!");
  126.                                 } else if(votacao[sim] > votacao[nao])
  127.                                 {
  128.                                         SendClientMessageToAll(COLOR_GREEN, "==> A legtöbb ember igennel szavazott.");
  129.                                 } else if(votacao[sim] < votacao[nao])
  130.                                 {
  131.                                         SendClientMessageToAll(COLOR_GREEN, "==> A legtöbb ember nemmel szavazott.");
  132.                                 }
  133.                                 SendClientMessageToAll(LARANJA,"====================================");
  134.                                 GameTextForAll("~r~A szavazasnak~w~ ~r~ ~b~vege!",6000,3);
  135.                                 votacao[iniciada] = false;
  136.                                 votacao[sim] = 0;
  137.                                 votacao[nao] = 0;
  138.                                 votacao[total] = 0;
  139.                                 for(new i; i <MAX_PLAYERS; i++)
  140.                                 {
  141.                                         votou[i] = false;
  142.                                 }
  143.                         } else {
  144.                                 SendClientMessage(playerid,BRANCO, "Nem érkezett szavazás a kérdésre!");
  145.                         }
  146.                 } else {
  147.                         SendClientMessage(playerid,COLOR_ULTRARED, "Nincs elég magas szinted a parancs használatához!");
  148.                 }
  149.                 return 1;
  150.         }
  151.     return 0;
  152. }
Advertisement
Add Comment
Please, Sign In to add comment