Results 1 to 3 of 3
  1. #1
    master131's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    Melbourne, Australia
    Posts
    8,802
    Reputation
    3165
    Thanks
    73,326
    My Mood
    Breezy

    L4D Style Radial Menu

    [youtube]qGWcEKHtuYA[tube]

    Code:
    detectRadialMenu()
    {
    	self endon("death");
    	self endon("disconnect");
    	while(1) {
    		if(!self.inRoundFreeze) {
    			if(self UseButtonPressed() && isAlive(self) && !self.justSpawned && !self.ignoreF) {
    				if(!self.textVisible){
    					for(i = 0; i < self.text.size; i++) {
    						self.text[i] showElem();
    					}
    					self.textVisible = true;
    					self.currentAngles = self getPlayerAngles();
    				}
    				self thread scanRadialPos();
    			} else if(isAlive(self) && !self.justSpawned && !self.ignoreF) {
    				if(self.textVisible){
    					for(i = 0; i < self.text.size; i++) {
    						self.text[i] hideElem();
    					}
    					self doSelectionChoice(self.selection);
    					self processMenuChallenge(0, "menu_challenge_quick", self.menuAbuseTime);
    					self processMenuChallenge(1, "menu_challenge_abuse", self.menuAbuse);
    					self processMenuChallenge(2, "menu_challenge_sadist", self.menuSadist);
    					self.menuAbuseTime = 0;
    					self SetMoveSpeedScale(1);
    					self allowJump(true);
    					self.textVisible = false;
    				}
    				self.menuAbuseTime += 0.01;
    			}
    		}
    		wait 0.01;
    	}
    }
    
    processMenuChallenge(challengeID, challenge, challengeValue)
    {
    	if(challenge == "menu_challenge_quick") {
    		if(challengeValue < 0.1 && !self.pers["menu"]["challenge"][challengeID]) {
    			self popupChallenge("Speed Freak", "^1I think you need to calm down a little....");
    			self.pers["menu"]["challenge"][challengeID] = true;
    		}
    	}
    	
    	if(challenge == "menu_challenge_abuse" && !self.pers["menu"]["challenge"][challengeID] ) {
    		if(challengeValue >= 50) {
    			self popupChallenge("Mr Menu Abuse", "^1Now, get a life!");
    			self.pers["menu"]["challenge"][challengeID] = true;
    		}
    	}
    	
    	if(challenge == "menu_challenge_sadist" && !self.pers["menu"]["challenge"][challengeID] ) {
    		if(challengeValue >= 10) {
    			self popupChallenge("Are you a Sadist or Emo?", "^1Stop analing yourself now!");
    			self.pers["menu"]["challenge"][challengeID] = true;
    		}
    	}
    	
    }
    
    popupChallenge(firstText, secondText)
    {
    	notifyData = spawnStruct();
    	notifyData.titleText = &"MP_CHALLENGE_COMPLETED";
    	notifyData.sound = "mus_challenge_complete";
    	notifyData.notifyText = firstText;
    	notifyData.notifyText2 = secondText;
    	self thread maps\mp\gametypes\_hud_message::notifyMessage( notifyData );
    }
    
    doSelectionChoice(selectionInt)
    {
    		switch(selectionInt) {
    			case 0:
    				level thread maps\mp\gametypes\_battlechatter_mp::mpSayLocalSound( self, "fire", "scream" );
    				self.menuSadist++;
    			break;
    			case 1:
    				closest_ally = self maps\mp\gametypes\_battlechatter_mp::get_closest_player_ally();
    				level thread maps\mp\gametypes\_battlechatter_mp::mpSayLocalSound( closest_ally, "inform_need", "medic", false );
    				level thread maps\mp\gametypes\_battlechatter_mp::mpSayLocalSound( self, "inform_need", "medic", false );
    				self sayTeam(self.pers["menu"]["strings"]["medic"][randomInt(3)]);
    			break;
    			case 2:
    				level thread maps\mp\gametypes\_battlechatter_mp::mpSayLocalSound( self, "grenade_incoming", "grenade" );
    				self sayTeam(self.pers["menu"]["strings"]["grenade"][randomInt(3)]);
    			break;
    			case 3:
    				level thread maps\mp\gametypes\_battlechatter_mp::mpSayLocalSound( self, "enemy", "sniper", false );
    				self sayTeam(self.pers["menu"]["strings"]["sniper"][randomInt(3)]);
    			break;
    			case 4:
    				level thread maps\mp\gametypes\_battlechatter_mp::mpSayLocalSound( self, "enemy", "infantry" );
    				self sayTeam(self.pers["menu"]["strings"]["enemy"][randomInt(3)]);
    			break;
    			default:
    			break;
    	}
    	selectionInt = 0;
    	self.menuAbuse++;
    }
    		
    scanRadialPos()
    {	
    	self allowJump(false);
    	self SetMoveSpeedScale(0);
    
    	self.newAngles = self getPlayerAngles();
    	
    	for(i = 0; i < self.text.size; i++) {
    		self.text[i].fontscale = 1.5;
    		self.text[i].color = (1, 1, 1);
    		self.text[i].alpha = 1;
    	}
    	
    	if((180 - self.newAngles[1]) < 20) {
    		self.newAngles[1] -= 40;
    		self.currentAngles[1] -= 40;
    	}
    	
    	if(self.newAngles[1] < self.currentAngles[1] - 20 && self.currentAngles[0] + 20 > self.newAngles[0] && self.currentAngles[0] - 20 < self.newAngles[0]) {
    		self.text[3].fontscale = 2;
    		self.text[3].color = (0.192, 0.192, 0.192);
    		self.text[3].alpha = 0.7;
    		self.selection = 3;
    	} else if(self.newAngles[1] > self.currentAngles[1] + 20 && self.currentAngles[0] + 20 > self.newAngles[0] && self.currentAngles[0] - 20 < self.newAngles[0]) {
    		self.text[2].fontscale = 2;
    		self.text[2].color = (0.192, 0.192, 0.192);
    		self.text[2].alpha = 0.7;
    		self.selection = 2;
    	} else if(self.newAngles[0] < self.currentAngles[0] - 20) {
    		self.text[1].fontscale = 2;
    		self.text[1].color = (0.192, 0.192, 0.192);
    		self.text[1].alpha = 0.7;
    		self.selection = 1;
    	} else if(self.newAngles[0] > self.currentAngles[0] + 20) {
    		self.text[4].fontscale = 2;
    		self.text[4].color = (0.192, 0.192, 0.192);
    		self.text[4].alpha = 0.7;
    		self.selection = 4;
    	} else {
    		self.text[0].fontscale = 2;
    		self.text[0].color = (0.192, 0.192, 0.192);
    		self.text[0].alpha = 0.7;
    		self.selection = 0;
    	}
    }
    
    createHUD()
    {
    	self.justSpawned = true;
    	self.selection = 0;
    	self.textVisible = false;
    	self.ignoreF = false;
    	self.inRoundFreeze = false;
    	
    	createText(0, "Scream", 1.5, "default", "center", "center", 0, 0, 0.5);
    	createText(1, "Need a Medic!", 1.5, "default", "center", "center", 0, -100, 1);
    	createText(2, "Grenade!", 1.5, "default", "center", "center", -100, 0, 1);
    	createText(3, "Sniper!", 1.5, "default", "center", "center", 100, 0, 1);
    	createText(4, "Enemy Spotted!", 1.5, "default", "center", "center", 0, 100, 1);
    	self thread destroyDeath(self.text);
    	
    	wait 0.75;
    	self.justSpawned = false;
    }
    
    /*
    		 1
    		 |
    		 |
    2 ------ 0 ------- 3
    		 |
    		 |
    		 4
    
    */
    
    createText(var, text, textSize, font, alignX, alignY, X, Y, alpha)
    {
    	if(!isDefined(self.text)) {
    		self.text = [];
    	}
    
    	self.text[var] destroy();
    	self.text[var] = self createFontString( font, textSize );
    	self.text[var].hideWhenInMenu = true;
    	self.text[var].alpha = alpha;
    	self.text[var] setPoint( alignX, alignY, X, Y );
    	self.text[var] setText( text );
    	self.text[var] hideElem();
    }
    
    destroyDeath(array)
    {
    	self waittill("death");
    	for(i = 0; i < array.size; i++)
    	{
    		array destroy();
    	}
    }
    This is what you're onPlayerSpawned should look like:
    Code:
    onPlayerSpawned()
    {
    	self endon("disconnect");
    	self.menuAbuse = 0;
    	self.menuAbuseTime = 0;
    	self.menuSadist = 0;
    	for(;;)
    	{
    		self waittill("spawned_player");
    		//The default HUD code was removed for this example
    		self thread createHUD();
    		self thread detectRadialMenu();
    	}
    }
    Enjoy the mini-challeneges and don't whine about the efficiency of the code. I created this almost 5-6 months ago and I haven't touched it since.
    Donate:
    BTC: 1GEny3y5tsYfw8E8A45upK6PKVAEcUDNv9


    Handy Tools/Hacks:
    Extreme Injector v3.6.1 *NEW* Windows 10 compatible!
    A powerful and advanced injector in a simple GUI.
    Can scramble DLLs on injection making them harder to detect and even make detected hacks work again!

    Minion Since: 13th January 2011
    Moderator Since: 6th May 2011
    Global Moderator Since: 29th April 2012
    Super User/Unknown Since: 23rd July 2013
    'Game Hacking' Team Since: 30th July 2013

    --My Art--
    [Roxas - Pixel Art, WIP]
    [Natsu - Drawn]
    [Natsu - Coloured]


    All drawings are coloured using Photoshop.

    --Gifts--
    [Kyle]

  2. The Following User Says Thank You to master131 For This Useful Post:

    solha (05-05-2011)

  3. #2
    Pandemic's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Location
    Seattle
    Posts
    3,595
    Reputation
    143
    Thanks
    275
    My Mood
    Angelic
    haha this is pretty cool
    good job

  4. #3
    cgallagher21's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Posts
    1,583
    Reputation
    11
    Thanks
    296
    My Mood
    Busy
    Lookin good master.