Advertisement
Chip7

[FS] FilterScript Sistema de Eleições Presidenciais/Prefeito

Oct 18th, 2012
1,168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.36 KB | None | 0 0
  1. /*VISITE NOSSO SITE: http://www.sampknd.com/
  2.   VISITE NOSSO FACEBOOK: http://www.facebook.com/SampKnd
  3.   SAMP KND MELHOR BLOG DE SAMP DO BRASIL
  4. */  
  5.  
  6.  
  7. //INCLUDES
  8. #include <a_samp>
  9. #include <zcmd>
  10.  
  11.  
  12. //DEFINES
  13.  
  14.  
  15. // CORES
  16. #define VERDE 0x008000C8 // {008000}
  17. #define VERMELHO 0xFF0000C8
  18. #define AMARELO 0xFFFF00C8
  19.  
  20. // NEWS'S
  21. new Votou[300], bool:Votacao;
  22. new Candidato1, Candidato2, Candidato3, Candidato4, VotoBranco;
  23. new Urna;
  24. new Text3D:Texto[MAX_PLAYERS];
  25.  
  26. public OnFilterScriptInit()
  27. {
  28.     print("\n----------------------------------------------");
  29.     print("SISTEMA DE ELEIÇÕES POR : DOUGLAS_PRT AKA RODRA");
  30.     print("----------------------------------------------\n");
  31.     return 1;
  32. }
  33.  
  34. public OnFilterScriptExit()
  35. {
  36.     return 1;
  37. }
  38.  
  39. public OnPlayerConnect(playerid)
  40. {
  41.     SendClientMessage(playerid, VERDE, "Sistema de Eleições por: {FFFFFF} Douglas_PRT aka Rodra.");
  42.     return 1;
  43. }
  44.  
  45. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  46. {
  47.     if(dialogid == 2345)
  48. {
  49.     if(response)
  50. {
  51.  
  52.     if(listitem == 0)
  53. {
  54.     SendClientMessage(playerid, AMARELO, "O seu voto foi registado. {FFFFFF}(Candidato 1).");
  55.     Candidato1++;
  56.     Votou[playerid] = 1;
  57. }
  58.  
  59.     if(listitem == 1)
  60. {
  61.     SendClientMessage(playerid, AMARELO, "O seu voto foi registado. {FFFFFF}(Candidato 2).");
  62.     Candidato2++;
  63.     Votou[playerid] = 1;
  64. }
  65.  
  66.     if(listitem == 2)
  67. {
  68.     SendClientMessage(playerid, AMARELO, "O seu voto foi registado. {FFFFFF}(Candidato 3).");
  69.     Candidato3++;
  70.     Votou[playerid] = 1;
  71. }
  72.  
  73.     if(listitem == 3)
  74. {
  75.     SendClientMessage(playerid, AMARELO, "O seu voto foi registado. {FFFFFF}(Candidato 4).");
  76.     Candidato4++;
  77.     Votou[playerid] = 1;
  78. }
  79.  
  80.     if(listitem == 4)
  81. {
  82.     SendClientMessage(playerid, AMARELO, "O seu voto foi registado. {FFFFFF}(Voto em Branco).");
  83.     Candidato4++;
  84.     Votou[playerid] = 1;
  85. }
  86. }
  87.     return 1;
  88. }
  89.     return 0;
  90. }
  91.  
  92. CMD:abrirurnas(playerid)
  93. {
  94.     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, VERMELHO, "[ERRO]: Não tens permissão para efectuar este comando.");
  95.     if(Votacao == true) return SendClientMessage(playerid, VERMELHO, "[ERRO]: Já está a decorrer uma eleição.");
  96.     SendClientMessageToAll(VERMELHO, "As urnas das Eleições Presidenciais estão oficialmente abertas, dirige-te ao local de voto e digita '/votar'.");
  97.     Votacao = true;
  98.     //PICKUP + 3DLABEL
  99.     new Float:x, Float:y, Float:z;
  100.     GetPlayerPos(playerid, x, y, z);
  101.     Urna = CreateObject(3013, x, y, z, 0.0, 0.0, 0.0, 96.0);
  102.     Texto[playerid] = Create3DTextLabel("{FFFF00}Urna de Voto\n Usa /votar", 0x000000FF, x, y, z, 40.0, 0, 0);
  103.     return 1;
  104. }
  105. CMD:fecharurnas(playerid)
  106. {
  107.     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, VERMELHO, "[ERRO]: Não tens permissão para efectuar este comando.");
  108.     if(Votacao == false) return SendClientMessage(playerid, VERMELHO, "[ERRO]: Não está a decorrer nenhuma votação de momento.");
  109.     new string[300];
  110.     new Total = (Candidato1 + Candidato2 + Candidato3 + Candidato4 + VotoBranco);
  111.     format(string,256, "{008000}[RESULTADOS]{FFFFFF} Candidato 1: [%d] | Candidato 2: [%d] | Candidato 3: [%d] | Candidato 4: [%d] || Total Votos: %d  | Votos em Branco: %d",Candidato1, Candidato2, Candidato3, Candidato4, Total, VotoBranco);
  112.     SendClientMessageToAll(0xFFFFFFFF, string);
  113.     // REMOVER PICKUP + 3DTEXT
  114.     DestroyObject(Urna);
  115.     Delete3DTextLabel(Texto[playerid]);
  116.     // FECHAR VOTACAO
  117.     Votacao = false;
  118.     // ANULAR TODOS OS DADOS
  119.     Candidato1 = 0;
  120.     Candidato2 = 0;
  121.     Candidato3 = 0;
  122.     Candidato4 = 0;
  123.     VotoBranco = 0;
  124.     // ACTIVAR VOTO PARA TODOS OS JOGADORES
  125.     for(new i; i < MAX_PLAYERS; i++)
  126.     if(Votou[i] == 1)
  127.     Votou[i] = 0;
  128.     return 1;
  129. }
  130. CMD:votar(playerid)
  131. {
  132.     if(Votacao == false) return SendClientMessage(playerid, VERMELHO, "[ERRO]: Não está a decorrer nenhuma votação, pelo que não podes votar.");
  133.     if(Votou[playerid] == 1) return SendClientMessage(playerid, VERMELHO, "[ERRO]: Apenas um voto por pessoa.");
  134.     new Float:X,Float:Y,Float:Z;
  135.     GetObjectPos(Urna,X,Y,Z);
  136.     if(!IsPlayerInRangeOfPoint(playerid, 2.0,X,Y,Z)) return SendClientMessage(playerid, VERMELHO, "[ERRO]: Não estás no local de votação.");
  137.     ShowPlayerDialog(playerid, 2345, DIALOG_STYLE_LIST, "Eleições | Escolha o seu Candidato:", "Candidato 1\nCandidato 2\nCandidato 3\nCandidato 4\nVoto Branco", "Votar", "Cancelar");
  138.     return 1;
  139. }
  140.  
  141. /* [FS] ELEIÇÕES PRESIDENCIAIS | CRIADO POR: DOUGLAS_PRT (NÃO RETIRE OS CREDITOS DO FS) */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement