Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define cVoting 1
- #define cAnswer 2
- #define Credits 3
- #if defined MAX_PLAYERS
- #undef MAX_PLAYERS
- #define MAX_PLAYERS 50
- #endif
- new
- Yes,
- No,
- aStr[90],
- Voted[MAX_PLAYERS],
- Votiing[MAX_PLAYERS]
- ;
- public OnFilterScriptInit()
- {
- print("Voting System - Allan Kardec\n");
- return 1;
- }
- main()
- {
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(strcmp("/createvoting", cmdtext, true) == 0)
- {
- if(Votiing[playerid] == 1) return SendClientMessage(playerid, -1, "There is already a vote in progress!");
- ShowPlayerDialog(playerid, cAnswer, DIALOG_STYLE_INPUT, "{FFFFFF}» {C9C9C9}Enter the question that will be made in the vote: {FFFFFF}«", "", "Confirm","Cancel");
- return 1;
- }
- if(strcmp("/endvoting", cmdtext, true) == 0)
- {
- SendClientMessage(playerid, 0x00FF00FF, "Concludes the voting!");
- Votiing[playerid] = 0;
- new Name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Name, sizeof(Name));
- format(aStr, sizeof(aStr), "%s concludes the voting » VOTES: {00FF00}YES » [%d] {FFFFFF}and {E31919}NO » [%d]", Name, Yes, No);
- SendClientMessageToAll(-1, aStr);
- Yes = 0;
- No = 0;
- for(new a = 0; a < MAX_PLAYERS; a++)
- {
- Voted[a] = 0;
- }
- return 1;
- }
- if(strcmp("/Credits", cmdtext, true) == 0)
- {
- ShowPlayerDialog(playerid, Credits, DIALOG_STYLE_MSGBOX, "{FFFF00}» System Credits «","Developed By Allan Kardec\nSpecial Thanks: [O.z]Caroline ","Ok","Close");
- return 1;
- }
- return 0;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == cAnswer)
- {
- if(response)
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- ShowPlayerDialog(i, cVoting, DIALOG_STYLE_MSGBOX, "{E31919}» {00FFFF}Voting: {E31919}«",inputtext,"Yes","No");
- }
- }
- }
- }
- if(dialogid == cVoting)
- {
- if(response)
- {
- if(Voted[playerid] == 1) return SendClientMessage(playerid, 0xFFFFFFFF, "You already voted once!");
- Voted[playerid] = 1;
- Yes++;
- SendClientMessage(playerid, 0xFFFFFFFF, "You voted in {00FF00}Yes{FFFFFF}!");
- }
- else if(!response)
- {
- if(Voted[playerid] == 1) return SendClientMessage(playerid, 0xFFFFFFFF, "You already voted once!!");
- Voted[playerid] = 1;
- No++;
- SendClientMessage(playerid, 0xFFFFFFFF, "You voted in {E31919}NO{FFFFFF}!");
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment