GameMode change by Vote
#3

In server conf:

gamemode0 grandlarc 1
gamemode1 other_gm 1

PHP код:
new bool:Voted[MAX_PLAYERS];
new 
Votes;
CMD:vote(playerid)
{
    if(
Voted[playerid]) return SendClientMessage(playerid, -1"ERROR: You can vote only once.");
    
Votes++;
    
Voted[playerid] = true;
    
    if(
Votes == 5)
    {
        
SendClientMessageToAll(-1"5 players voted for next gamemode, changing..");
        
SendRconCommand("gmx");
    }
    return 
1;
}
// OnPlayerDisconnect
Voted[playerid] = false;
CMD:votes(playerid)
{
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1"ERROR: You are not RCON admin.");
    new 
string[128];
    
format(stringsizeof(string), "There are currently %i votes"Votes);
    
SendClientMessage(playerid, -1string);
    return 
1;

Untested.

EDIT: I misunderstood. I thought that you want to change the gamemode. Sorry. Anyhow, the principle is similar, you can figure it out.
Reply


Messages In This Thread
GameMode change by Vote - by TadePoleMG - 04.05.2018, 16:00
Re: GameMode change by Vote - by TadePoleMG - 04.05.2018, 17:46
Re: GameMode change by Vote - by kovac - 04.05.2018, 18:50
Re: GameMode change by Vote - by Dayrion - 04.05.2018, 20:38
Re: GameMode change by Vote - by TadePoleMG - 06.05.2018, 06:35

Forum Jump:


Users browsing this thread: 1 Guest(s)