/votekick + /vote
#6

Erm, I tested it now and had to change some stuff because there were errors! But there's a problem:

I start a votekick against myself, and then, I'm voting for "no", that means "/voteno"! But, it shows the following:

Votesystem: Yes: 0 No:

It should usually also count the No's and the current results...Here, I'mma show you my whole code again, the rest seems to be okay!^^

PHP код:
CMD:votekick(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 1)
    {
        if(
VoteOn) return SendClientMessage(playerid0xCC0000AA"There's already a vote going on!");
        new 
Targetreason[64];
        if(
sscanf(params"rS(None)[64]"Targetreason)) return SendClientMessage(playerid0xCC0000AA"USAGE: /votekick <playerid> <optional:reason>");
        
        
VoteOn true;
        
VoteAgainst Target;
        
format(VoteReasonsizeof(VoteReason), "%s"reason);
        
VoteTimer SetTimer("VoteEnd"60000false);
        new 
string[128];
        
format(stringsizeof(string), "Vote kick initiated against %s (Reason: %s)"Name(Target), VoteReason);
        
SendClientMessageToAll(COLOR_LIGHTBLUEstring);
    }
    else return 
SendClientMessage(playeridCOLOR_RED,"You have to be level 1 to use that command!");
    return 
1;
}
CMD:voteyes(playerid)
{
    if(!
VoteOn) return SendClientMessage(playerid0xCC0000AA"There's no vote going on!");
    if(
HasVoted[playerid]) return SendClientMessage(playerid0xCC0000AA"You already voted!");
    
YesVotes++;
    
HasVoted[playerid] = true;
    new 
string[50];
    
format(stringsizeof(string), "{00CCCC}| Vote System | {00CC00}Yes: %i {CC0000}No: %i"YesVotesNoVotes);
    
SendClientMessageToAll(0x00CCCCAAstring);
    return 
1;
}
CMD:voteno(playerid)
{
    if(!
VoteOn) return SendClientMessage(playerid0xCC0000AA"There's no vote going on!");
    if(
HasVoted[playerid]) return SendClientMessage(playerid0xCC0000AA"You already voted!");
    
NoVotes++;
    
HasVoted[playerid] = true;
    new 
string[50];
    
format(stringsizeof(string), "{00CCCC}| Vote System | {00CC00}Yes: %i {CC0000}No: %i"YesVotesNoVotes);
    
SendClientMessageToAll(0x00CCCCAAstring);
    return 
1;
}
CMD:vkick(playeridparams[]) return cmd_votekick(playeridparams);
CMD:vyes(playerid) return cmd_voteyes(playerid);
CMD:vno(playerid) return cmd_voteno(playerid); 
PHP код:
forward VoteEnd(playerid);
public 
VoteEnd(playerid)
{
    new 
votestring[128];
    if(
YesVotes == NoVotesformat(votestringsizeof(votestring), "Vote Failed. Yes: %i No: %i"YesVotesNoVotes);
    else if(
YesVotes NoVotes)
    {
        
format(votestringsizeof(votestring), "%s got vote kicked. Yes: %i No: %i (Reason: %s)"YesVotesNoVotesVoteReason);
        
SendClientMessage(playeridVoteAgainstvotestring);
        
Kick(VoteAgainst);
    }
    else 
format(votestringsizeof(votestring), "Votekick failed. Yes: %i No: %i"YesVotesNoVotes);
    
SendClientMessageToAll(0x00CCCCAAvotestring);
    
VoteAgainst = -1;
    
VoteReason "\0";
    
YesVotes 0NoVotes 0;
    for(new 
i=0MAX_PLAYERSi++) if(HasVoted[i]) HasVoted[i] = false;
    
VoteOn false;
    
KillTimer(VoteTimer);

Reply


Messages In This Thread
/votekick + /vote - by Twisted_Insane - 12.03.2012, 22:36
Re: /votekick + /vote - by [ABK]Antonio - 12.03.2012, 22:39
Re: /votekick + /vote - by Twisted_Insane - 12.03.2012, 23:12
Re: /votekick + /vote - by [ABK]Antonio - 12.03.2012, 23:43
Re: /votekick + /vote - by Twisted_Insane - 13.03.2012, 08:47
Re: /votekick + /vote - by Twisted_Insane - 19.03.2012, 13:07

Forum Jump:


Users browsing this thread: 6 Guest(s)