29.12.2014, 18:32
this better
Код:
CMD:poll(playerid, params[]) { new string[128]; if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command."); if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_GREY, "Usage: /poll [question]"); if(strlen(params) > 128) return SendClientMessage(playerid, COLOR_GREY, "Maximum characters limit is 128."); if(PollOn) return SendClientMessage(playerid, COLOR_GREY, "There is already an poll started."); format(string, sizeof(string), "{298EFF}** Question:{FFFFFF} %s {298EFF}**", params); SendClientMessageToAll(COLOR_WHITE, string); format(string, sizeof(string), "{298EFF}** Press {FFFFFF}Y{298EFF} to vote {FFFFFF}Yes{298EFF}, Press {FFFFFF}N{298EFF} to vote {FFFFFF}No{298EFF}. **"); SendClientMessageToAll(COLOR_WHITE, string); format(string, sizeof(string), "{298EFF}** Poll ending in {FFFFFF}30{298EFF} Seconds. **"); SendClientMessageToAll(COLOR_WHITE, string); PollOn = 1; PollN = 0; foreach(Player, i) { PollVoted[i] = 0; } PollY = 0; SetTimer("pollend", 30000, false); return 1; } } forward pollend(playerid); public pollend(playerid) { new string[128]; format(string, sizeof(string), "{298EFF}The Poll has ended, {FFFFFF}%d{298EFF} people voted {FFFFFF}No{298EFF}, {FFFFFF}%d{298EFF} people voted {FFFFFF}Yes.", PollN, PollY); SendClientMessageToAll(COLOR_WHITE, string); PollOn = 0; return 1; } // Poll System new PollVoted[MAX_PLAYERS]; new PollY; new PollOn; new PollN;