Advertisement
Aninhaah

aElection v3.0 by Aninhaah (humildadeforever)

Jan 5th, 2015
354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 17.73 KB | None | 0 0
  1. //_______________________________________INCLUDES_________________________________________//
  2. #include <a_samp>
  3. #include <zcmd>
  4. #include <sscanf>
  5. #include <DOF2>
  6. #include <streamer>
  7.  
  8. //_______________________________________DEFINES_______________________________________//
  9. //_________ARQUIVOS______//
  10. #define PASTA_USUARIOS              "Jogadores/%s.ini"
  11. #define CANDIDATOS_ELEICAO          "aElection/Candidatos/Candidato %d.ini"
  12. #define URNAS                       "aElection/Urnas/Urna %d.ini"
  13. #define ConfigEleicao               "aElection/ConfigEleicao.ini"
  14. #define NumerosOcupados             "aElection/NumerosOcupados.ini"
  15. //__________LIMITES_________//
  16. #define MAX_CANDIDATOS              31
  17. #define MAX_URNAS                   11
  18.  
  19. //__________DIALOGS_________//
  20. #define DIALOG_CONFIRMAR_VOTO       101
  21. #define DIALOG_INFO                 102
  22.  
  23. //___________CORES__________//
  24. #define COR_VERDE                   0xADFF2FFF
  25. #define COR_AZUL                    0x00BFFFFF
  26. #define COR_VERMELHO                0xFF0000FF
  27.  
  28. enum iUrna
  29. {
  30.     Float:PosX,
  31.     Float:PosY,
  32.     Float:PosZ,
  33.     Obj,
  34.     Text3D:TextUrna
  35. };
  36.  
  37. new InfoUrnas[MAX_URNAS][iUrna];
  38.  
  39.  
  40. public OnFilterScriptInit()
  41. {
  42.     print("\n---------------------------------------------------------------------");
  43.     print("aElection (Sistema de Eleição) v3.0 By Aninhaah (humildadeforever) - ");
  44.     print("---------------------------------------------------------------------\n");
  45.    
  46.     CarregarUrnas();
  47.     return 1;
  48. }
  49.  
  50. public OnFilterScriptExit()
  51. {
  52.     DOF2_Exit();
  53.     return 1;
  54. }
  55. //________________________________________________________COMANDOS______________________________
  56.  
  57. //____________________ COMANDO INFORMATIVO
  58.  
  59. CMD:aelection(playerid)
  60. {
  61.     SendClientMessage(playerid, COR_AZUL,"|______________________________________ Créditos______________________________________|");
  62.     SendClientMessage(playerid, -1, "Esse servidor utiliza o FilterScript {00BFFF}aElection v3.0{FFFFFF} criado por {00BFFF}Aninhaah{FFFFFF} ({00BFFF}humildadeforever{FFFFFF}).");
  63.     SendClientMessage(playerid, COR_AZUL, "Comandos de jogadores: {FFFFFF}/Candidatos, /MeCandidatar, /Votar, /Propaganda, /ResultadoVotacao.");
  64.     SendClientMessage(playerid, COR_AZUL, "Comandos de admins: {FFFFFF}/IniciarEleicao, /InterromperEleicao, /IniciarVotacao, /TerminarVotacao.");
  65.     SendClientMessage(playerid, COR_AZUL, "Comandos de admins: {FFFFFF}/CriarUrna, /DeletarUrna e /ZerarCandidatos.");
  66.     SendClientMessage(playerid, COR_AZUL,"|_____________________________________________________________________________________|");
  67.     return 1;
  68. }
  69.  
  70. //__________________ COMANDOS ADMINISTRATIVOS
  71. CMD:iniciareleicao(playerid)
  72. {
  73.     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COR_VERMELHO, "ERRO: Sem permissão!");
  74.     if(!DOF2_FileExists(ConfigEleicao)) { DOF2_CreateFile(ConfigEleicao); }
  75.     if(DOF2_GetBool(ConfigEleicao,"EleicaoAberta") == true) return SendClientMessage(playerid, COR_VERMELHO, "ERRO: A eleição já começou. Para interrompê-la utilize \"{FFFFFF}/interrompereleicao{FF0000}\".");
  76.     DOF2_SetBool(ConfigEleicao,"EleicaoAberta", true);
  77.     DOF2_SetBool(ConfigEleicao,"VotacaoIniciada", false);
  78.     DOF2_SaveFile();
  79.     SendClientMessageToAll(COR_AZUL, "Foi iniciada a nova eleição! Se candidate (/mecandidatar)");
  80.     return 1;
  81. }
  82. CMD:interrompereleicao(playerid)
  83. {
  84.     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COR_VERMELHO, "ERRO: Sem permissão!");
  85.     if(!DOF2_FileExists(ConfigEleicao) || DOF2_GetBool(ConfigEleicao,"EleicaoAberta") == false) return SendClientMessage(playerid, COR_VERMELHO,"ERRO: Nenhuma eleição foi iniciada.");
  86.     DOF2_SetBool(ConfigEleicao,"EleicaoAberta", false);
  87.     DOF2_SetBool(ConfigEleicao,"VotacaoIniciada", false);
  88.     DOF2_SaveFile();
  89.     new str[90];
  90.     format(str, sizeof(str),"%s interrompeu a eleição.", NomeJogador(playerid));
  91.     SendClientMessageToAll(COR_AZUL, str);
  92.     EncerrarEleicoes();
  93.     return 1;
  94. }
  95. CMD:iniciarvotacao(playerid)
  96. {
  97.     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COR_VERMELHO, "ERRO: Sem permissão!");
  98.     if(!DOF2_FileExists(ConfigEleicao)) return SendClientMessage(playerid, COR_VERMELHO, "ERRO: Não foi iniciada nenhuma eleição!");
  99.     if(DOF2_GetBool(ConfigEleicao,"EleicaoAberta") == false) return SendClientMessage(playerid, COR_VERMELHO, "ERRO: Não está tendo eleição, comece uma eleição! (/iniciareleicao)");
  100.     if(DOF2_GetBool(ConfigEleicao,"VotacaoIniciada") == true) return SendClientMessage(playerid,COR_VERMELHO,"ERRO: A votação já foi iniciada.");
  101.     DOF2_SetBool(ConfigEleicao,"VotacaoIniciada", true);
  102.     DOF2_SaveFile();
  103.     SendClientMessageToAll(COR_AZUL, "O prazo para se candidatar acabou. A votação foi iniciada!");
  104.     SendClientMessageToAll(COR_AZUL, "Para efetuar seu voto, vá até uma urna e digite \"{FFFFFF}/votar{00BFFF}\".");
  105.     SendClientMessage(playerid,COR_AZUL,"<!> Digite \"{FFFFFF}/terminarvotacao{00BFFF}\" para terminar a votação.");
  106.     CarregarUrnas();
  107.     return 1;
  108. }
  109. CMD:terminarvotacao(playerid)
  110. {
  111.     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COR_VERMELHO, "ERRO: Sem permissão!");
  112.     if(!DOF2_FileExists(ConfigEleicao) || DOF2_GetBool(ConfigEleicao,"EleicaoAberta") == false) return SendClientMessage(playerid, COR_VERMELHO, "ERRO: Nenhuma eleição foi iniciada.");
  113.     if(DOF2_GetBool(ConfigEleicao,"VotacaoIniciada") == false) return SendClientMessage(playerid, COR_VERMELHO, "ERRO: Não está tendo votação. Comece uma digitando \"{FFFFFF}/IniciarVotacao{FF0000}\".");
  114.     DOF2_SetBool(ConfigEleicao,"EleicaoAberta", false);
  115.     DOF2_SetBool(ConfigEleicao,"VotacaoIniciada", false);
  116.     DOF2_SetBool(ConfigEleicao,"Resultado", true);
  117.     DOF2_SaveFile();
  118.     new string[600], str[150], file[56];
  119.     for(new c = 1; c < MAX_CANDIDATOS; c++)
  120.     {
  121.         format(file, sizeof(file),CANDIDATOS_ELEICAO, c);
  122.         if(DOF2_FileExists(file) && DOF2_IsSet(file,"Nome") && DOF2_IsSet(file,"Votos"))
  123.         {
  124.             format(str, sizeof(str),"Candidato %s: \t\t%d votos\n", DOF2_GetString(file, "Nome"), DOF2_GetInt(file, "Votos"));
  125.             strcat(string, str);
  126.         }
  127.     }
  128.     for(new i = 0; i < MAX_PLAYERS; i++)
  129.     {
  130.         ShowPlayerDialog(i, DIALOG_INFO, DIALOG_STYLE_MSGBOX,"RESULTADO DAS ELEIÇÕES:", string, "Fechar","");
  131.     }
  132.     EncerrarEleicoes();
  133.     return 1;
  134. }
  135. CMD:criarurna(playerid)
  136. {
  137.     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COR_VERMELHO, "ERRO: Sem permissao!");
  138.     if(!DOF2_FileExists(ConfigEleicao) || DOF2_GetBool(ConfigEleicao,"EleicaoAberta") == false) return SendClientMessage(playerid, COR_VERMELHO, "ERRO: As eleições não começaram!");
  139.     new Float:Pos[3], arq[56];
  140.     GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
  141.     for(new u = 1; u < MAX_URNAS; u++)
  142.     {
  143.         format(arq, sizeof(arq), URNAS, u);
  144.         if(!DOF2_FileExists(arq))
  145.         {
  146.             DOF2_CreateFile(arq);
  147.             DOF2_SetFloat(arq, "PosX", Pos[0]);
  148.             DOF2_SetFloat(arq, "PosY", Pos[1]);
  149.             DOF2_SetFloat(arq, "PosZ", Pos[2]);
  150.             DOF2_SaveFile();
  151.             new string[100];
  152.             format(string, sizeof(string),"Urna {ADFF2F}%d {FFFFFF}criada com sucesso!", u);
  153.             SendClientMessage(playerid, -1, string);
  154.             InfoUrnas[u][Obj] = CreateDynamicObject(2941, Pos[0], Pos[1], Pos[2], 0,0,0);
  155.             InfoUrnas[u][TextUrna] = Create3DTextLabel("Urna de eleição!\nUse: /votar", -1, Pos[0], Pos[1], Pos[2], 14.0,0,0);
  156.             InfoUrnas[u][PosX] = Pos[0];
  157.             InfoUrnas[u][PosY] = Pos[1];
  158.             InfoUrnas[u][PosZ] = Pos[2];
  159.             break;
  160.         }
  161.     }
  162.     return 1;
  163. }
  164. CMD:deletarurna(playerid, params[])
  165. {
  166.     new idurna = 0, str[90], file[56];
  167.     if(isnull(params))
  168.     {
  169.         for(new u = 1; u < MAX_URNAS; u++)
  170.         {
  171.             if(IsPlayerInRangeOfPoint(playerid, 2.0, InfoUrnas[u][PosX], InfoUrnas[u][PosY], InfoUrnas[u][PosZ]))
  172.             {
  173.                 idurna = u;
  174.                 break ;
  175.             }
  176.         }
  177.     }
  178.     else if(!isnull(params))
  179.     {
  180.         idurna = strval(params);
  181.     }
  182.     if(idurna == 0) return SendClientMessage(playerid, -1, "Use: /DeletarUrna [ID] ou digite o comando perto de uma urna.");
  183.     format(file, sizeof(file), URNAS, idurna);
  184.     if(!DOF2_FileExists(file)) return SendClientMessage(playerid, -1, "ERRO: O arquivo dessa urna não existe.");
  185.     DOF2_RemoveFile(file);
  186.     Delete3DTextLabel(InfoUrnas[idurna][TextUrna]);
  187.     DestroyDynamicObject(InfoUrnas[idurna][Obj]);
  188.     format(str, sizeof(str),"A urna {ADFF2F}%d {FFFFFF}foi deletada com sucesso!", idurna);
  189.     SendClientMessage(playerid, -1, str);
  190.     return 1;
  191. }
  192. CMD:zerarcandidatos(playerid)
  193. {
  194.     new file[56];
  195.     for(new c = 1; c < MAX_CANDIDATOS; c++)
  196.     {
  197.         format(file, sizeof(file),CANDIDATOS_ELEICAO, c);
  198.         if(DOF2_FileExists(file))
  199.         {
  200.             DOF2_RemoveFile(file);
  201.         }
  202.     }
  203.     DOF2_RemoveFile(ConfigEleicao);
  204.     return 1;
  205. }
  206. //___________________________COMANDOS DE JOGADORES
  207.  
  208. CMD:candidatos(playerid)
  209. {
  210.     if(!DOF2_FileExists(ConfigEleicao) || DOF2_GetBool(ConfigEleicao,"EleicaoAberta") == false) return SendClientMessage(playerid, COR_VERMELHO,"ERRO: Não é época de eleição.");
  211.     new str[146], file[56], string[600], bool: count = false;
  212.     for(new c = 1; c < MAX_CANDIDATOS; c++)
  213.     {
  214.         format(file, sizeof(file), CANDIDATOS_ELEICAO, c);
  215.         if(DOF2_FileExists(file) && DOF2_IsSet(file,"Partido") && DOF2_IsSet(file,"Nome") && DOF2_IsSet(file,"Numero"))
  216.         {
  217.             format(str, sizeof(str),"{00BFFF}Candidato: {FFFFFF}%s\t{00BFFF}Partido: {FFFFFF}%s\t{00BFFF}Número: {FFFFFF}%d\n", DOF2_GetString(file,"Nome"), DOF2_GetString(file,"Partido"), DOF2_GetInt(file,"Numero"));
  218.             strcat(string, str);
  219.             count = true;
  220.         }
  221.     }
  222.     if(count == false) return SendClientMessage(playerid, -1, "<!> Nenhum candidato até o momento.");
  223.     ShowPlayerDialog(playerid, DIALOG_INFO, DIALOG_STYLE_MSGBOX,"[aElection] - Candidatos", string, "Fechar","");
  224.     return 1;
  225. }
  226. CMD:mecandidatar(playerid, params[])
  227. {
  228.     if(!DOF2_FileExists(ConfigEleicao) || DOF2_GetBool(ConfigEleicao,"VotacaoIniciada") == true || DOF2_GetBool(ConfigEleicao,"EleicaoAberta") == false) return SendClientMessage(playerid, COR_VERMELHO, "ERRO: Não está na época de eleição ou a votação já foi iniciada.");
  229.     if(!DOF2_FileExists(ContaJogador(playerid))) return SendClientMessage(playerid, COR_VERMELHO, "ERRO: Sua conta não está registrada.");
  230.     if(DOF2_GetInt(ContaJogador(playerid),"Candidato") > 0) return SendClientMessage(playerid, COR_VERMELHO, "ERRO: Você já é candidato.");
  231.     new numero, partido[30], string[180];
  232.     if(sscanf(params,"ds", numero, partido)) return SendClientMessage(playerid, COR_AZUL, "Use: /MeCandidatar [Número pra votar] [Nome Partido]");
  233.     if(numero < 10 || numero > 99) return SendClientMessage(playerid, COR_VERMELHO,"ERRO: O número deve conter 2 algarismos.");
  234.     format(string, sizeof(string),"%d", numero);
  235.     if(DOF2_FileExists(NumerosOcupados) && DOF2_IsSet(NumerosOcupados, string)) return SendClientMessage(playerid, COR_VERMELHO,"ERRO: Esse número já está sendo usado.");
  236.     new file[56], bool: count = false;
  237.     for(new c = 1; c < MAX_CANDIDATOS; c++)
  238.     {
  239.         format(file, sizeof(file), CANDIDATOS_ELEICAO, c);
  240.         if(!DOF2_FileExists(file))
  241.         {
  242.             DOF2_CreateFile(file);
  243.             DOF2_SetString(file,"Nome", NomeJogador(playerid));
  244.             DOF2_SetString(file,"Partido", partido);
  245.             DOF2_SetInt(file,"Numero", numero);
  246.             DOF2_SetInt(file,"Votos", 0);
  247.             DOF2_SaveFile();
  248.             format(string, sizeof(string),"%d", numero);
  249.             if(!DOF2_FileExists(NumerosOcupados)) { DOF2_CreateFile(NumerosOcupados); }
  250.             DOF2_SetBool(NumerosOcupados, string, true);
  251.             DOF2_SaveFile();
  252.             DOF2_SetInt(ContaJogador(playerid),"Candidato", c);
  253.             DOF2_SaveFile();
  254.             count = true;
  255.             break;
  256.         }
  257.     }
  258.     if(count == false) return SendClientMessage(playerid, COR_VERMELHO, "ERRO: Não foi possível realizar a candidatura.");
  259.     format(string, sizeof(string),"%s {FFFFFF}é o mais novo candidato! Partido: {FF0000}%s{FFFFFF}. Número: {FF0000} %d{FFFFFF}.", NomeJogador(playerid), partido, numero);
  260.     SendClientMessageToAll(COR_VERMELHO, string);
  261.     return 1;
  262. }
  263. CMD:propaganda(playerid, params[])
  264. {
  265.     if(!DOF2_FileExists(ContaJogador(playerid)) || !DOF2_IsSet(ContaJogador(playerid),"Candidato") || DOF2_GetInt(ContaJogador(playerid),"Candidato") < 1) return SendClientMessage(playerid, COR_VERMELHO, "ERRO: Você não é um candidato.");
  266.     if(DOF2_GetBool(ConfigEleicao,"VotacaoIniciada") == true) return SendClientMessage(playerid, COR_VERMELHO,"ERRO: A votação já foi iniciada. É proibido fazer propaganda.");
  267.     if(isnull(params)) return SendClientMessage(playerid, COR_AZUL,"Use: /Propaganda [Texto]");
  268.     new string[128], file[56];
  269.     format(file, sizeof(file), CANDIDATOS_ELEICAO, DOF2_GetInt(ContaJogador(playerid),"Candidato"));
  270.     format(string, sizeof(string),"[%s] %s: %s", DOF2_GetString(file,"Partido"), NomeJogador(playerid), params);
  271.     SendClientMessageToAll(COR_AZUL, "|__________________________Propaganda Política__________________________|");
  272.     SendClientMessageToAll(-1, string);
  273.     SendClientMessageToAll(COR_AZUL,"|______________________________________________________________________|");
  274.     return 1;
  275. }
  276. CMD:votar(playerid, params[])
  277. {
  278.     if(!DOF2_FileExists(ConfigEleicao) || DOF2_GetBool(ConfigEleicao,"EleicaoAberta") == false) return SendClientMessage(playerid, COR_VERMELHO, "ERRO: Não está na época de votação!");
  279.     if(DOF2_GetBool(ConfigEleicao, "VotacaoIniciada") == false) return SendClientMessage(playerid, COR_VERMELHO, "ERRO: Ainda não começou a votação!");
  280.     if(!DOF2_FileExists(ContaJogador(playerid))) return SendClientMessage(playerid, COR_VERMELHO,"ERRO: Você não é registrado.");
  281.     new file[56], bool: counturna = false, bool: countcand = false;
  282.     for(new u = 1; u  < MAX_URNAS; u++)
  283.     {
  284.         if(IsPlayerInRangeOfPoint(playerid, 2.0, InfoUrnas[u][PosX], InfoUrnas[u][PosY], InfoUrnas[u][PosZ]))
  285.         {
  286.             counturna = true;
  287.             if(DOF2_GetBool(ContaJogador(playerid),"JaVotou") == true) return SendClientMessage(playerid, COR_VERMELHO, "ERRO: Você já votou.");
  288.             if(isnull(params))
  289.             {
  290.                 SendClientMessage(playerid, COR_AZUL,"Use: /Votar [Número].");
  291.                 SendClientMessage(playerid, COR_AZUL,"<!> Não sabe os números? Digite: \"{FFFFFF}/Candidatos{00BFFF}\".");
  292.                 return 1;
  293.             }
  294.             for(new c = 1; c < MAX_CANDIDATOS; c++)
  295.             {
  296.                 format(file, sizeof(file), CANDIDATOS_ELEICAO, c);
  297.                 if(strval(params) == DOF2_GetInt(file,"Numero"))
  298.                 {
  299.                     SetPVarInt(playerid,"VotoCandidato", c);
  300.                     new string[170];
  301.                     format(string, sizeof(string),"{FFFFFF}Você está prestes a votar em {00BFFF}%s {FFFFFF}({00BFFF}%d{FFFFFF}). Partido {00BFFF}%s{FFFFFF}.\n\n{FFFFFF}Deseja confirmar esse voto?", DOF2_GetString(file, "Nome"), DOF2_GetInt(file,"Numero"), DOF2_GetString(file,"Partido"));
  302.                     ShowPlayerDialog(playerid, DIALOG_CONFIRMAR_VOTO, DIALOG_STYLE_MSGBOX,"[aElection] - Votação", string,"Votar","Cancelar");
  303.                     countcand = true;
  304.                     break;
  305.                 }
  306.             }
  307.         }
  308.     }
  309.     if(counturna == false) return SendClientMessage(playerid, -1, "ERRO: Nenhuma urna por perto.");
  310.     if(countcand == false) return SendClientMessage(playerid, -1, "ERRO: Nenhum candidato com esse número.");
  311.     return 1;
  312. }
  313. CMD:resultadovotacao(playerid)
  314. {
  315.     if(!DOF2_FileExists(ConfigEleicao) || !DOF2_IsSet(ConfigEleicao, "Resultado") || DOF2_GetBool(ConfigEleicao,"Resultado") == false) return SendClientMessage(playerid, COR_VERMELHO, "ERRO: Nenhum resultado disponível.");
  316.     new string[600], str[150], file[56];
  317.     for(new c = 1; c < MAX_CANDIDATOS; c++)
  318.     {
  319.         format(file, sizeof(file),CANDIDATOS_ELEICAO, c);
  320.         if(DOF2_FileExists(file) && DOF2_IsSet(file,"Nome") && DOF2_IsSet(file,"Votos"))
  321.         {
  322.             format(str, sizeof(str),"Candidato %s: \t\t%d votos\n", DOF2_GetString(file, "Nome"), DOF2_GetInt(file, "Votos"));
  323.             strcat(string, str);
  324.         }
  325.     }
  326.     ShowPlayerDialog(playerid, DIALOG_INFO, DIALOG_STYLE_MSGBOX,"RESULTADO DAS ELEIÇÕES:", string, "Fechar","");
  327.     return 1;
  328. }
  329. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  330. {
  331.     if(dialogid == DIALOG_CONFIRMAR_VOTO)
  332.     {
  333.         if(!response) return SendClientMessage(playerid, COR_VERDE, "<!> Você cancelou a votação!");
  334.         new voto = GetPVarInt(playerid,"VotoCandidato"), file[56];
  335.         format(file, sizeof(file), CANDIDATOS_ELEICAO, voto);
  336.         new string[96];
  337.         format(string, sizeof(string),"Você computou um voto para{FFFFFF} %s{00BFFF}. Obrigado por votar.", DOF2_GetString(file,"Nome"));
  338.         SendClientMessage(playerid, COR_AZUL, string);
  339.         DOF2_SetBool(ContaJogador(playerid),"JaVotou", true);
  340.         DOF2_SaveFile();
  341.         DOF2_SetInt(file, "Votos", DOF2_GetInt(file,"Votos")+1);
  342.         DOF2_SaveFile();
  343.         return 1;
  344.     }
  345.     return 1;
  346. }
  347.  
  348. NomeJogador(playerid)
  349. {
  350.     new nome[MAX_PLAYER_NAME];
  351.     GetPlayerName(playerid, nome, sizeof(nome));
  352.     return nome;
  353. }
  354. ContaJogador(playerid)
  355. {
  356.     new file[56];
  357.     format(file, sizeof(file),PASTA_USUARIOS, NomeJogador(playerid));
  358.     return file;
  359. }
  360. CarregarUrnas()
  361. {
  362.     new count = 0;
  363.     for(new u = 0; u  < MAX_URNAS; u++)
  364.     {
  365.         new file[56];
  366.         format(file, sizeof(file), URNAS, u);
  367.         if(DOF2_FileExists(file) && DOF2_FileExists(ConfigEleicao) && DOF2_GetBool(ConfigEleicao,"EleicaoAberta") == true)
  368.         {
  369.             InfoUrnas[u][PosX] = DOF2_GetFloat(file,"PosX");
  370.             InfoUrnas[u][PosY] = DOF2_GetFloat(file,"PosY");
  371.             InfoUrnas[u][PosZ] = DOF2_GetFloat(file,"PosZ");
  372.             InfoUrnas[u][Obj] = CreateDynamicObject(2941, InfoUrnas[u][PosX], InfoUrnas[u][PosY], InfoUrnas[u][PosZ], 0,0,0);
  373.             InfoUrnas[u][TextUrna] = Create3DTextLabel("Urna de eleição!\nUse: /votar", -1, InfoUrnas[u][PosX], InfoUrnas[u][PosY], InfoUrnas[u][PosZ], 14.0,0);
  374.             count++;
  375.         }
  376.     }
  377.     printf("%d urnas carregadas!", count);
  378.     return 1;
  379. }
  380. EncerrarEleicoes()
  381. {
  382.     //DOF2_RemoveFile(ConfigEleicao);
  383.     DOF2_RemoveFile(NumerosOcupados);
  384.     for(new u = 0; u < MAX_URNAS; u++)
  385.     {
  386.         DestroyDynamicObject(InfoUrnas[u][Obj]);
  387.         Delete3DTextLabel(InfoUrnas[u][TextUrna]);
  388.     }
  389.     for(new i = 0; i < MAX_PLAYERS; i++)
  390.     {
  391.         if(DOF2_FileExists(ContaJogador(i)))
  392.         {
  393.             DOF2_Unset(ContaJogador(i),"JaVotou");
  394.             DOF2_Unset(ContaJogador(i),"Candidato");
  395.             DOF2_SaveFile();
  396.         }
  397.     }
  398.     return 1;
  399. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement