28.09.2011, 17:25
Description
You have to be connected to rcon administrator to start or end a vote.
COMMANDS:
/ask
/vote ( opens a dialog and you vote )
/result
SOURCE:
CREDITS:
Zeex: zcmd
sa-mp dev team: all
****** : sscanf
i: filterscript ._.
sorry my bad english
You have to be connected to rcon administrator to start or end a vote.
COMMANDS:
/ask
/vote ( opens a dialog and you vote )
/result
SOURCE:
pawn Code:
#include a_samp
#include zcmd
#include sscanf2
new bool:voting,
bool:voted[MAX_PLAYERS],
yes,no,
name[24]
;
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 9999)
{
if(response == 1)
{
if(listitem == 0)
{
if(voted[playerid] == true)
return SendClientMessage(playerid,0xFF0000FF,"you already voted");
if(voting == true)
{
SendClientMessage(playerid,0xFF0000FF,"===========================================================");
SendClientMessage(playerid,0xFF0000FF,"VOTO COMPUTADO COM SUCESSO");
SendClientMessage(playerid,0xFF0000FF,"===========================================================");
}
else return SendClientMessage(playerid,0xFF0000FF,"you already voted");
return yes++,voted[playerid] = true;
}
if(listitem == 1)
{
if(voted[playerid] == true ) return SendClientMessage(playerid,0xFF0000FF,"you already voted");
if(voting == true)
{
SendClientMessage(playerid,0xFF0000FF,"===========================================================");
SendClientMessage(playerid,0xFF0000FF,"VOTO COMPUTADO COM SUCESSO");
SendClientMessage(playerid,0xFF0000FF,"===========================================================");
}
else return SendClientMessage(playerid,0xFF0000FF,"you already voted");
return no++,voted[playerid] = true;
}
}
}
return 1;
}
public OnFilterScriptInit()
return print("Voting system by Leo_Perez loaded");
public OnFilterScriptExit()
return print("Voting system by Leo_Perez unloaded");
CMD:ask(playerid,params[])
{
new string[46],str2[128];
if(sscanf(params,"s",str2))
return SendClientMessage(playerid,0xFF0000FF,"use /ask [text]");
if(IsPlayerAdmin(playerid))
{
if(voting == true)
return SendClientMessage(playerid,0xFF0000FF,"There is no vote in progress..");
SendClientMessageToAll(0xFF0000FF,"===========================================================");
format(string,sizeof(string),"Admin %s question: %s",name,str2);
SendClientMessageToAll(0xFF0000FF,"Use : /yes ou /no");
SendClientMessageToAll(0xFFFF00FF,string);
SendClientMessageToAll(0xFF0000FF,"===========================================================");
}
else return SendClientMessage(playerid,0xFF0000FF,"Vocк nгo й administrador");
return voting = true;
}
CMD:vote(playerid,params[])
return ShowPlayerDialog(playerid,9999,DIALOG_STYLE_LIST,"Votar","Yes\nNo","Ok","");
CMD:result(playerid,params[])
{
new string[25];
GetPlayerName(playerid,name,sizeof(name));
if(voting == false) return SendClientMessage(playerid,0xFF0000FF,"There is no vote in progress..");
if(IsPlayerAdmin(playerid))
{
voting = false;
SendClientMessageToAll(0xFF0000FF,"===========================================================");
SendClientMessageToAll(0xFF0000FF,"A VOTAЗГO ACABOU!");
format(string,sizeof(string),"Yes: %d No: %d",yes,no);
SendClientMessageToAll(0xFFFF00FF,string);
SendClientMessageToAll(0xFF0000FF,"===========================================================");
for(new i; i < MAX_PLAYERS; i++)
{
voted[i] = false;
}
}
else return SendClientMessage(playerid,0xFF0000FF,"You are not administrator");
return yes = 0,no = 0;
}
Zeex: zcmd
sa-mp dev team: all
****** : sscanf
i: filterscript ._.
sorry my bad english