18.04.2011, 23:37
Here
Here are the commands, you can add some checks to avoid abuse of cmds.
pawn Код:
new VotedYes[MAX_PLAYERS];
new VotedNo[MAX_PLAYERS];
COMMAND:poll(playerid, params[])
{
new string[128];
if(sscanf(params, "s", params[2])) return SendClientMessage(playerid, -1, "Usage: /poll <question>");
format(string, sizeof(string), "Poll: %s. Vote Yes/No",params[2]);
SendClientMessageToAll(-1, string);
return 1;
}
COMMAND:yes(playerid, params[])
{
SendClientMessage(playerid, -1, "You voted: Yes");
VotedYes[playerid] ++;
return 1;
}
COMMAND:no(playerid, params[])
{
SendClientMessage(playerid, -1, "You voted: No");
VotedNo[playerid] ++;
return 1;
}
COMMAND:endpoll(playerid, params[])
{
new string[128];
format(string, sizeof(string), "Total for Yes votes: %d", VotedYes);
SendClientMessageToAll(-1, string);
format(string, sizeof(string), "Total for No votes: %d", VotedNo);
SendClientMessageToAll(-1, string);
return 1;
}