menu issues

Discuss programming in the QuakeC language.
Post Reply
ceriux
Posts: 2230
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

menu issues

Post by ceriux »

anyone see whats wrong i dont. the up portion of the menu isnt working. also when i select observer the player does not switch to observer.

Code: Select all


.float team_changetime;
float modelindex_marine, modelindex_quake_squad;

float	modelindex_player, modelindex_eyes; //Stores your player model

void() MainMenu;
void() MenuSelect;




//////////////////////////////////////////////////////////////////////////////////////



float() GetModelIndex =
 {
 	if (self.team == OBSERVER)
 	{
		self.frame = 0;
 		return modelindex_eyes;
 	}
 	else if (self.team == QUAKE_SQUAD)
 		return modelindex_quake_squad;
 	else if (self.team == MARINE)
 		return modelindex_marine;
 	
 	return modelindex_player;
 };
 
 void() SetPlayerModel =
{
 	if (self.team == OBSERVER)
 	{
		self.frame = 0;
 		setmodel(self, "");
 	}
 	else if (self.team == QUAKE_SQUAD)
 		setmodel(self, "progs/QS.mdl");
 	else if (self.team == MARINE)
 		setmodel(self, "progs/marine.mdl");
 	else
		setmodel(self, "progs/player.mdl");
 };

void(float whichteam) SetTeam =

 
 
{
	 local float shirt, pants;
	
	 
	 if (self.team_changetime < time) // set the team to the desired one
	 {
	 	if (whichteam == MARINE)
		{
			bprint (self.netname);
	                bprint (" is joining the Marines\n");
	 		self.team = MARINE;
			pants = 1;
			//self.pants = pants;
			self.clientcolors = pants;
			setmodel (self, "progs/Marine.mdl"); 
		}
	 	else if (whichteam == QUAKE_SQUAD)
		{
			bprint (self.netname);
	                bprint (" is joining the Death Squads\n");
	 		self.team = QUAKE_SQUAD;
			pants = 2;
//.pants = pants;
			self.clientcolors = pants;
			setmodel (self, "progs/QS.mdl"); //Sets your player model to the Quake Squads.
			
		}
			else if (whichteam == OBSERVER)
		{
			PutClientInServer();
			bprint (self.netname);
	                bprint (" is now an Observer\n");
	 		self.team = OBSERVER;
			pants = 0;
//.pants = pants;
			self.clientcolors = pants;
			setmodel (self, ""); //Sets your player model to the Quake Squads.
			
		}
		 PutClientInServer();
		bprint("W_SetCurrentAmmo:  weapon = ");
	bprint(ftos(self.weapon));
	bprint("\n");
		self.team_changetime = time + 10;
	}
	else
	{
 		sprint(self, "\bYou may only change teams again in \b"); 
  	 	sprint(self, ftos(self.team_changetime-time));
 		sprint(self, "\b  seconds.\n\b");
  	}	
};





void() MenuToggle = //This turns the menu on and off
{
        if (self.menu == MENU_OFF) //If it's off
        {
                self.menu = MENU_SELECT_TEAM; //Turn it on and go to the proper menu page
                MainMenu ();
        }
else
        MenuSelect (); //Otherwise it's already on so use it to select stuff from the menu
};



void() MainMenu =

{
if (self.menu == MENU_SELECT_TEAM)
        {
        self.menu = MENU_SELECT_TEAM;
        centerprint (self, ">Team Selection\n  Exit           ");
        return;
        }
if (self.menu == MENU_SELECT_EXIT)
        {
        self.menu = MENU_SELECT_EXIT;
        centerprint (self, " Team Selection\n >Exit           ");
        return;
        }
if (self.menu == MARINE)
        {
centerprint (self, " >Marine\nQuake Squad\nObserver");
        }
else if (self.menu == QUAKE_SQUAD)
        {
centerprint (self, " Marine\n>Quake Squad\nObserver");
	}
else if (self.menu == OBSERVER)
        {
centerprint (self, " Marine\nQuake Squad\n>Observer");
        }
	return;
};




void() MenuSelect = //Selects the current menu item
{
        if (self.menu == MENU_SELECT_TEAM)
                {
                self.menu = MARINE;
                return;
                }
        if (self.menu == MENU_SELECT_EXIT)
                {
                self.menu = MENU_OFF;
                centerprint (self, "");
                return;
                }

                if (self.menu == QUAKE_SQUAD) 
        {
                
                self.menu = MENU_OFF;  			//turn the menu off
                centerprint (self, "");               //Remove the menu
		SetTeam(QUAKE_SQUAD);		
        }
        else if (self.menu == MARINE)	 //Basically the same except it sets your team different and another model
        {
                
                self.menu = MENU_OFF;
                centerprint (self, "");
		SetTeam(MARINE);
        }
	
	else if (self.menu == OBSERVER)	 //Basically the same except it sets your team different and another model
        {
                
                self.menu = MENU_OFF;
                centerprint (self, "");
		SetTeam(OBSERVER);
        }

	
};


void() MenuUp = //Scrolls through the menu
{
       if (self.menu == MENU_OFF) //If the menu is off
                return;            //Leave the function
        else if (self.menu == MENU_SELECT_TEAM)
                self.menu = MENU_SELECT_EXIT;
        else if (self.menu == MENU_SELECT_EXIT)
                self.menu = MENU_SELECT_TEAM;
        else if (self.menu == MARINE)
                self.menu = OBSERVER;
        else if (self.menu == OBSERVER)
                self.menu = QUAKE_SQUAD;
	else if (self.menu == QUAKE_SQUAD)
		self.menu = MARINE;
        MainMenu ();
};

void() MenuDown = 
{
        if (self.menu == MENU_OFF) //If the menu is off
                return;            //Leave the function
        else if (self.menu == MENU_SELECT_TEAM)
                self.menu = MENU_SELECT_EXIT;
        else if (self.menu == MENU_SELECT_EXIT)
                self.menu = MENU_SELECT_TEAM;
        else if (self.menu == MARINE)
                self.menu = QUAKE_SQUAD;
        else if (self.menu == QUAKE_SQUAD)
                self.menu = OBSERVER;
	else if (self.menu == OBSERVER)
		self.menu = MARINE;
        MainMenu ();
};



Post Reply