Vote System +Rep
#1

PHP код:
new PlayerMapVote[MAX_PLAYERS];
static 
MapNumber;
static 
MapNumberP[MAX_PLAYERS];
static 
1Vote;
static 
2Vote;
static 
3Vote;
static 
4Vote;
CMD:VoteMaps(playeridparams[])
{
        
ShowPlayerDialog(playeridDerbyDialogsDIALOG_STYLE_LIST"VoteSystem By {FF0000}Ramin[Avenger]{FFFFFF}","1\n2\n3\n4""Vote""Close");
        
SetTimerEx("FinishVote"20000false"i"playerid);
    return 
1;
}
forward FinishVote(playeridtime);
public 
FinishVote(playeridtime)
{
    
ShowPlayerDialogplayerid, -10"""""""" );
    if (
>= && >= && >= 4)
    {
        
SendClientMessageToAll(COLOR_GREEN"Vote:Map 1 Has Won!");
        
PlayerMapVote[playerid] = 0;
                return 
1;
        }
    else if(
&& >= && >= 4)
        {
                
SendClientMessageToAll(COLOR_GREEN"Vote:Map 2 Has Won!");
                
PlayerMapVote[playerid] = 0;
                return 
1;
        }
        else if(
&& && >= 4)
     {
            
SendClientMessageToAll(COLOR_GREEN"Vote:Map 3 Has Won");
            
PlayerMapVote[playerid] = 0;
        }
    else if(
&& && 3)
    {
            
SendClientMessageToAll(COLOR_GREEN"Vote:Map 4 Has Won");
            
PlayerMapVote[playerid] = 0;
    }
    
PlayerDerbyVote[playerid] = 0;
    
1Vote 0;
    
2Vote 0;
        
3Vote 0;
    
4Vote 0;
    
MapNumber 0;
    
MapNumberP[playerid] = 0;
}
    if(
dialogid == DerbyDialogs)
    {
        if(
response)
        {
            if(
listitem == 0)
            {
                new 
string[64], pName[MAX_PLAYER_NAME];
                
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
                 
format(string,sizeof string,"%s Voted 1.",pName);
                
SendClientMessageToAll(0xFF9900AA,string);
                
1Vote += 1;
                
PlayerMapVote[playerid] = 1;
                
MapNumber += 1;
                 
MapNumberP[playerid] = MapNumber;
            }
            if(
listitem == 1)
            {
                new 
string[128], pName[MAX_PLAYER_NAME];
                
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
                
format(string,sizeof string,"%s Voted 2.",pName);
                
SendClientMessageToAll(0xFF9900AA,string);
                 
2Vote += 1;
                 
PlayerMapVote[playerid] = 1;
                 
MapNumber += 1;
                 
MapNumberP[playerid] = MapNumber;
            }
            if(
listitem == 2)
            {
                new 
string[128], pName[MAX_PLAYER_NAME];
                
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
                
format(string,sizeof string,"%s Voted 3.",pName);
                
SendClientMessageToAll(0xFF9900AA,string);
                
3Vote += 1;
                
PlayerMapVote[playerid] = 1;
                
MapNumber += 1;
                
MapNumberP[playerid] = MapNumber;
            }
            if(
listitem == 3)
            {
                new 
string[128], pName[MAX_PLAYER_NAME];
                
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
                
format(string,sizeof string,"%s Voted 4.",pName);
                
SendClientMessageToAll(0xFF9900AA,string);
                
4Vote += 1;
                
PlayerMapVote[playerid] = 1;
                
MapNumber += 1;
                
MapNumberP[playerid] = MapNumber;
            }
        }
        return 
1;
    } 
i Maked This Algoritm For Vote Map by players But i don't know how i can Use SetTimerEx For All Player Equal
in this Code When Player Choose 1 20 Second Begin for him And When Next Player Choose 2 new Timer Begin for him . In Result Two Message come to all Vote:Map 1 Has Won - Vote:Map 2 Has Won
i want One timer for all Equal
Please Compelete my Codes <3 Thank you
Reply
#2

PHP код:
#define VOTENUMBERS 4
static
    
PlayerMapVote[MAX_PLAYERS],
    
Votes[VOTENUMBERS],
    
LastTimeVoted
;
CMD:votemaps(playeridparams[])
{
    if(
PlayerMapVote[playerid])
    {
        
SendClientMessage(playerid, -1,"You've already voted!");
    }
    else
    {
        new 
string[128];
        for(new 
0VOTENUMBERSi++)
        {
            new 
str[10];
            
format(strsizeof str,"%d\n",( ));
            
strcat(stringstr);
        }
        
ShowPlayerDialog(playeridDerbyDialogsDIALOG_STYLE_LIST"VoteSystem By {FF0000}Ramin[Avenger]{FFFFFF}"string"Vote""Close");
    }
    return 
1;
}
forward FinishVote();
public 
FinishVote()
{
    if((
gettime() - LastTimeVoted) > 19)
    {
        new 
whichmap = -1lastmapscore = -255;
        for(new 
0VOTENUMBERSi++)
        {
            if(
== 0)
            {
                
whichmap i;
                
lastmapscore Votes[i];
            }
            else
            {
                if(
Votes[i] > lastmapscore)
                {
                    
whichmap i;
                    
lastmapscore Votes[i];
                }
            }
        }
        new 
string[128];
        
format(stringsizeof string,"Vote: Map %d Has Won!",( whichmap ));
          
SendClientMessageToAll(COLOR_GREENstring);
          for(new 
0MAX_PLAYERSi++)
          {
            
PlayerMapVote[i] = 0;
        }
        for(new 
0VOTENUMBERSi++)
        {
              
Votes[i] = 0;
        }
        
LastTimeVoted 0;
    }
}
    if(
dialogid == DerbyDialogs)
    {
        if(
response)
        {
            new 
string[64], pName[MAX_PLAYER_NAME];
            
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
             
format(string,sizeof string,"%s Voted %d.",pName, ( listitem ));
              
SendClientMessageToAll(0xFF9900AA,string);
               
Votes[listitem] += 1;
            
PlayerMapVote[playerid] = 1;
            
LastTimeVoted gettime();
            
SetTimer("FinishVote"20000false);
        }
        return 
1;
    } 
Explain's on telegram...
Reply
#3

thank you <3
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)