Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Sistema Votaciones Creado por Badyx */
- /* Idea de Lore_Lungarini */
- /* Modo de Uso
- Usar el comando /ComenzarElecciones para empezar las elecciones
- Para votar usen /Opcion1 para votar la primera opcion
- o /Opcion 2 para votar la segunda opcion */
- /* Includes */
- #include <a_samp>
- #include <dini>
- #define Verde 0x00BF60FF
- #define Rojo 0xE60000FF
- new Candidato1;
- new Candidato2;
- new IniciarVotacion = 0;
- new yavoto[MAX_PLAYERS] = 0;
- forward TerminarVotacion();
- #if defined FILTERSCRIPT
- #else
- main()
- {
- print("\n----------------------------------");
- print("Sistema de votaciones By Badyx");
- print("----------------------------------\n");
- }
- #endif
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/ComenzarElecciones", cmdtext, true, 10) == 0)
- {
- if(IniciarVotacion==1) return SendClientMessage(playerid,Rojo,"La votación fué iniciada.");
- SetTimer("TerminarVotacion", 10000, 0);
- IniciarVotacion=1;
- SendClientMessageToAll(Verde,"|______ Hay elecciones en el gobierno____|.");
- SendClientMessageToAll(Verde,"Las opciones son /Opcion1 o /Opcion2.");
- return 1;
- }
- if (strcmp("/Opcion1", cmdtext, true, 10) == 0)
- {
- if(IniciarVotacion==0) return SendClientMessage(playerid,Rojo,"No hay votación iniciada.");
- {
- Candidato1++;
- SendClientMessage(playerid,Verde,"Su voto fue contabilizado como opcion numero 1.");
- yavoto[playerid] = 1;
- return 1;
- }
- }
- if (strcmp("/Opcion2", cmdtext, true, 10) == 0)
- {
- if(IniciarVotacion==0) return SendClientMessage(playerid,Rojo,"No hay votación iniciada.");
- {
- Candidato2++;
- SendClientMessage(playerid,Verde,"Su voto fue contabilizado como opcion numero 2.");
- yavoto[playerid] = 1;
- return 1;
- }
- }
- return 0;
- }
- public TerminarVotacion()
- {
- if(Candidato1>Candidato2)
- {
- new mensaje[256];
- SendClientMessageToAll(Verde,"La opcion numero 1 fue la ganadora");
- format(mensaje,sizeof(mensaje),"La cantidad de votos que obtuvo fué %i.",Candidato1);
- SendClientMessageToAll(Verde,mensaje);
- for(new todos; todos<MAX_PLAYERS;todos++)
- {
- yavoto[todos] = 0;
- }
- }
- if(Candidato1<Candidato2)
- {
- new mensaje[256];
- SendClientMessageToAll(Verde,"La opcion numero 2 fue la ganadora.");
- format(mensaje,sizeof(mensaje),"La cantidad de votos que obtuvo fué %i.",Candidato2);
- SendClientMessageToAll(Verde,mensaje);
- for(new todos; todos<MAX_PLAYERS;todos++)
- {
- yavoto[todos] = 0;
- }
- }
- if(Candidato1==Candidato2)
- {
- new mensaje[256];
- SendClientMessageToAll(Verde,"El pueblo ha escogido en igual cantidad.");
- format(mensaje,sizeof(mensaje),"La cantidad de votos que obtuvo la opción 1 fué %i.",Candidato1);
- SendClientMessageToAll(Verde,mensaje);
- format(mensaje,sizeof(mensaje),"Y la cantidad de votos que obtuvo la opción 2 fué %i.",Candidato2);
- SendClientMessageToAll(Verde,mensaje);
- for(new todos; todos<MAX_PLAYERS;todos++)
- {
- yavoto[todos] = 0;
- }
- }
- Candidato1 = 0;
- Candidato2 = 0;
- IniciarVotacion=0;
- }
Advertisement
Add Comment
Please, Sign In to add comment