Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define cVotacao 1
- #define cPergunta 2
- #define Creditos 3
- #if defined MAX_PLAYERS
- #undef MAX_PLAYERS
- #define MAX_PLAYERS 50
- #endif
- new
- Sim,
- Nao,
- aStr[90],
- Votou[MAX_PLAYERS],
- Votacao[MAX_PLAYERS]
- ;
- public OnFilterScriptInit()
- {
- print("Sistema de Votação - Allan Kardec\n");
- return 1;
- }
- main()
- {
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(strcmp("/criarvotacao", cmdtext, true) == 0)
- {
- if(Votacao[playerid] == 1) return SendClientMessage(playerid, -1, "Já existe uma votação em andamento!");
- 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");
- return 1;
- }
- if(strcmp("/encerrarvotacao", cmdtext, true) == 0)
- {
- SendClientMessage(playerid, 0x00FF00FF, "Encerrastes a votação!");
- Votacao[playerid] = 0;
- new Nome[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Nome, sizeof(Nome));
- format(aStr, sizeof(aStr), "%s encerrou a votação » VOTOS: {00FF00}SIM » [%d] {FFFFFF}e {E31919}NÃO » [%d]", Nome, Sim, Nao);
- SendClientMessageToAll(-1, aStr);
- Sim = 0;
- Nao = 0;
- for(new a = 0; a < MAX_PLAYERS; a++)
- {
- Votou[a] = 0;
- }
- return 1;
- }
- if(strcmp("/creditos", cmdtext, true) == 0)
- {
- ShowPlayerDialog(playerid, Creditos, DIALOG_STYLE_MSGBOX, "{FFFF00}» Créditos do Sistema «","Desenvolvido por Allan Kardec\nAgradecimentos Especial: [O.z]Caroline ","Ok","Fechar");
- return 1;
- }
- return 0;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == cPergunta)
- {
- if(response)
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- 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. ^^
- }
- }
- }
- }
- if(dialogid == cVotacao)
- {
- if(response)
- {
- if(Votou[playerid] == 1) return SendClientMessage(playerid, 0xFFFFFFFF, "Você já votou uma vez!");
- Votou[playerid] = 1;
- Sim++;
- SendClientMessage(playerid, 0xFFFFFFFF, "Você votou em {00FF00}SIM{FFFFFF}!");
- }
- else if(!response)
- {
- if(Votou[playerid] == 1) return SendClientMessage(playerid, 0xFFFFFFFF, "Você já votou uma vez!");
- Votou[playerid] = 1;
- Nao++;
- SendClientMessage(playerid, 0xFFFFFFFF, "Você votou em {E31919}NÃO{FFFFFF}!");
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement