SA-MP Forums Archive
gamemode vote - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: gamemode vote (/showthread.php?tid=70634)



gamemode vote - killar456 - 26.03.2009

ok, i have 2 gamemodes on my server, a stunt GM and a RP GM, i found a filterscript to make a votelike thing, but its so old that all the links are dead
how hard would it be to script this?

or does someone have this filterscript?


Re: gamemode vote - MenaceX^ - 26.03.2009

Not hard at all..
Just make a varieble with two options.


Re: gamemode vote - killar456 - 26.03.2009

ok, menus is the easiest way for me to do something like this, i made a way so that if someone hits vote yes, it changes the gamemode, how can i make it so it uses how many players voted and uses percentage to change the mode or to not change it?


Re: gamemode vote - MenaceX^ - 26.03.2009

Post all your variebles and all what you've done already.


Re: gamemode vote - killar456 - 26.03.2009

this is a little bit of what i have, i dont understand how to make it check how many votes are what and how to script this kinda thing
Code:
#include <a_samp>

// This is a comment
// uncomment the line below if you want to write a filterscript
#define FILTERSCRIPT

#if defined FILTERSCRIPT
new Menu:tpm;
new Menu:tpm2;
new Voteyes;
new Voteno;
forward VoteTimer(giveplayerid);
#define COLOR_GREEN 0x33AA33AA
public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Gamemode Vote by Andy");
	print("--------------------------------------\n");


	tpm2 = CreateMenu("Votemenu", 1, 200.0, 100.0, 150.0, 150.0);
	
	AddMenuItem(tpm, 0, "Vote Yes");
	AddMenuItem(tpm, 0, "Vote No");
	
  tpm = CreateMenu("Gamemodes", 1, 200.0, 100.0, 150.0, 150.0);
	AddMenuItem(tpm, 1, "Stunt Gamemode");
	AddMenuItem(tpm, 1, "Roleplay Gamemode");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print(" Blank Gamemode by your name here");
	print("----------------------------------\n");
}

#endif

public OnPlayerCommandText(playerid, cmdtext[])
{
 if(strcmp(cmdtext, "/votemenu", true) == 0)
	{
			ShowMenuForPlayer(tpm,playerid);
  		TogglePlayerControllable(playerid,1);
		return 1;
	}
	return 0;
}
public OnPlayerExitedMenu(playerid)
{
  TogglePlayerControllable(playerid,0);
  return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
  new Menu:CurrentMenu = GetPlayerMenu(playerid);
	if(CurrentMenu == tpm)
  {
	  switch(row)
		{
      case 0:
		  {
			Voteyes = 1;
			}
      case 1:
		  {
			Voteno = 1;
      SendRconCommand("Changemode WC-RP");
      }
		}
	}
	return 1;
}
public VoteTimer(giveplayerid)
{
	new string[STRING];
	if(Votes == 1)
	{
		format(string, sizeof(string), "Gamemode has been Changed", Name(giveplayerid));
		SendClientMessageToAll(YELLOW, string);
		SendRconCommand("Changemode WC-RP");
	}
	else if(Voteno == 1)
	return 1;
}

//      GivePlayerWeapon(playerid,34,750);