Posts: 2,593
Threads: 38
Joined: Aug 2007
Reputation:
0
You can create multiple server.cfg files, each one containing a different setup (gamemode,server name, etc.) and have the players vote on one.
Posts: 6,129
Threads: 36
Joined: Jan 2009
Or this:
pawn Код:
/*
blah
*/
#include <a_samp>
#include <foreach>
#define WHITE 0xFFFFFFAA
new ChangeCounts;
new VoteCounts[ 4 ];
forward ModeChange();
public OnGameModeInit()
{
SetTimer( "ModeChange", 300000, false );
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if( dialogid == 1 )
{
switch( listitem )
{
case 0:
{
VoteCounts[ 0 ]++;
SendClientMessage( playerid, WHITE, "Thanks for voting!" );
}
case 1:
{
VoteCounts[ 1 ]++;
SendClientMessage( playerid, WHITE, "Thanks for voting!" );
}
case 2:
{
VoteCounts[ 2 ]++;
SendClientMessage( playerid, WHITE, "Thanks for voting!" );
}
}
}
}
public ModeChange()
{
ChangeCounts++;
switch( ChangeCounts )
{
case 1:
{
foreach(Player, i)
{
SendClientMessage( i, WHITE, "The GM is changing, please select a new one." );
ShowPlayerDialog( i, 1, DIALOG_STYLE_INPUT, "MODE CHANGE", "Protect the President\nDance with the Devil\nStunts\n", "Select", "Cancel");
}
}
case 2:
{
new largest, i = 0;
while(i < VoteCounts[ 3 ])
{
i++;
if( VoteCounts[ i ] > largest ) largest = VoteCounts[ i ];
}
switch( largest )
{
case 0: SendRconCommand( "changemode protect" );
case 1: SendRconCommand( "changemode dance" );
case 2: SendRconCommand( "changemode stunts" );
}
}
}
return 1;
}
I don't know if this works as I haven't tested it.
Posts: 167
Threads: 0
Joined: Aug 2009
Reputation:
0
put forward ModeChange(); above public ModeChange()