25.04.2012, 13:45
(
Последний раз редактировалось xOFxK1LLER; 25.04.2012 в 14:42.
)
Just create 2 variables on top of your script:
Reset the Player Variable at OnPlayerConnect:
And here the command:
pawn Код:
new HealVote = 0;
new PlayerVoted[MAX_PLAYERS];
pawn Код:
PlayerVoted[playerid] = 0;
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/hl", true) == 0)
{
if(PlayerVoted[playerid] == 0)
{
HealVote += 1;
new string[64], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string),"%s voted to heal everyone. (%d/7)", name, HealVote);
SendClientMessageToAll(0xEB0000FF, string);
PlayerVoted[playerid] = 1;
if(HealVote >= 7)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
SetPlayerHealth(i, 100);
PlayerVoted[i] = 0;
}
SendClientMessageToAll(0xEB0000FF, "Everyone has been healed.");
HealVote = 0;
}
return 1;
}
else
{
SendClientMessage(playerid,0xEB0000FF, "You already voted to heal everyone.");
}
return 1;
}
return 0;
}