Hans211 base

Posts 1–15 of 24 · Page 1 of 2
Hans211 base
hey i was trying to test out hans menu source and i dont know what i did wrong can someone tel me what they think.

Code:
#include "d3dmenu.h"
#include "Font.h"

char		Mtitle[81]="";	  // Some room for a title
int 		Mpos=0;			  // current highlighted menuitem	
int 		Mmax=0;			  // number of menu items
float		Mxofs =160.0f;	  // offset for option text
float		Mysize=14.0f;	  // heigh of a menuline
int			Mvisible=1;

char		*Moptfolder[] = { "+"  , "-" };	
char		*Moptonoff[]  = { "Off", "On"};

struct {
  int  typ;		  // type of menuline, folder, item
  char *txt;	  // text to show
  char **opt;	  // array of options
  int  *var;	  // variable containing current status
  int  maxvalue;  // maximumvalue,  normally 1  gives  0=off  1=on
} MENU[MENUMAXITEMS];


void AddItemToMenu(char *txt, char **opt, int *var, int maxvalue, int typ)
{
  MENU[Mmax].typ=typ;
  MENU[Mmax].txt=txt;
  MENU[Mmax].opt=opt;
  MENU[Mmax].var=var;
  MENU[Mmax].maxvalue=maxvalue;
  Mmax++;
}

void MenuShow(float x, float y,	CD3DFont *pFont)

{
	 int i, val;
  DWORD color;
  char        sFPS[20]="xxx fps";
int        CH_DirectX      = 1;
int        CH_Players       = 1;

int        CH_Chams    = 0;
int        CH_Boxes   = 1;
int        CH_Skeleton = 0;
int        CH_PlayerGlow = 0;
int        CH_Speed  = 1;
int        CH_Fly   = 1;
int        CH_Sway   = 1;

	void RebuildMenu(void);
{
  strcpy(Mtitle,"== D3Dmenu by Hans211 ==");
  MenuAddItem("[DirectX]", Moptfolder, &CH_DirectX, 2, MENUFOLDER);
  if (CH_DirectX) {
      MenuAddItem("Chams"     , Moptonoff , &CH_Chams   , 3, MENUITEM);
      MenuAddItem("Boxes"   , Moptonoff , &CH_Boxes  , 2, MENUITEM);
      MenuAddItem("Skeleton" , Moptonoff , &CH_Skeleton, 2, MENUITEM);
      MenuAddItem("Player Glow" , Moptonoff , &CH_PlayerGlow, 2, MENUITEM);
  }
  MenuAddItem("[Player]", Moptfolder, &CH_Players, 2, MENUFOLDER);
  if (CH_Players) {
      MenuAddItem("Speed Hack"     , Moptonoff , &CH_Speed, 2, MENUITEM);
      MenuAddItem("Fly hack"     , Moptonoff , &CH_Fly, 2, MENUITEM);
      MenuAddItem("No Sway", Moptonoff , &CH_Sway , 2, MENUITEM);
  }
  MenuAddItem("Framerate"        , (char **)sFPS , 0,0,MENUTEXT);
}

	if (!Mvisible) return;

  if (Mtitle[0]) {
	 pFont->DrawText(x, y, MCOLOR_TITLE, Mtitle);
	  y+=Mysize;
  }
  for (i=0; i<Mmax; i++) {
	   val=(MENU[i].var)?(*MENU[i].var):0;
	   // determine color
       if (i==Mpos)
           color=MCOLOR_CURRENT;
       else if (MENU[i].typ==MENUFOLDER)
           color=MCOLOR_FOLDER;
       else if (MENU[i].typ==MENUTEXT)
           color=MCOLOR_TEXT;
       else
		   color=(val)?MCOLOR_ACTIVE:MCOLOR_INACTIVE;

       pFont->DrawText(x, y, color,MENU[i].txt,0);
       if (MENU[i].opt) {
		   if (MENU[i].typ==MENUTEXT)
			   pFont->DrawTextW(x+Mxofs, y, color,(char *)MENU[i].opt,D3DFONT_RIGHT);
		   else
			   pFont->DrawTextW(x+Mxofs, y, color,(char *)MENU[i].opt[val],D3DFONT_RIGHT);
	   }
       y+=Mysize;
  }
}

void MenuNav(void)
{
  if (GetAsyncKeyState(VK_INSERT)&1) Mvisible=(!Mvisible);
  if (!Mvisible) return;

	if (GetAsyncKeyState(VK_UP)&1) {
		do {
			Mpos--;
			if (Mpos<0)  Mpos=Mmax-1;
		} while (MENU[Mpos].typ==MENUTEXT);		// skip textitems
  } else if (GetAsyncKeyState(VK_DOWN)&1) {
		do {
			Mpos++;
		    if (Mpos==Mmax) Mpos=0;
		} while (MENU[Mpos].typ==MENUTEXT);		// skip textitems
  } else if (MENU[Mpos].var) {
		int dir=0;
		// bugfix: thx to ***-Wieter20
		if (GetAsyncKeyState(VK_LEFT )&1 && *MENU[Mpos].var > 0                      ) dir=-1;
		if (GetAsyncKeyState(VK_RIGHT)&1 && *MENU[Mpos].var < (MENU[Mpos].maxvalue-1)) dir=1;
		if (dir) {
			*MENU[Mpos].var += dir;
			if (MENU[Mpos].typ==MENUFOLDER) Mmax=0;  // change on menufolder, force a rebuild
		}
  }
}
hehehehehheheheeheh
....i don't code... well i know a little bit and i can even tell there's stuff wrong with that
Quote Originally Posted by d00ms33k3r View Post
....i don't code... well i know a little bit and i can even tell there's stuff wrong with that
Don't we all? Rofl....
you can try help him not saming there lots of errors
Quote Originally Posted by ^...,^ View Post
#include "d3dmenu.h"
#include "Font.h"

is that all your "#include's" Lol?
It is the menu.cpp noob
Quote Originally Posted by Zoom View Post
Try include those.

#include "d3dbase.h"
#include "base.h"
No Shit XD
did you define your int's in menu.h?
Uh, isn't what you posted suppose to look like:

Code:
#include "d3dmenu.h"

char		Mtitle[81]="";	  // Some room for a title
int 		Mpos=0;			  // current highlighted menuitem	
int 		Mmax=0;			  // number of menu items
int			Mxofs =160;	  // offset for option text
int			Mysize=15;	  // heigh of a menuline
int			Mvisible=1;

// predifine some basic options
char		*Moptfolder[]	 = { "+"  , "-" };	
char		*Moptonoff[]	 = { "Off", "On"};
	 RECT rect;
	 RECT rect2;
	 RECT rect3;
struct {
  int  typ;		  // type of menuline, folder, item
  char *txt;	  // text to show
  char **opt;	  // array of options
  int  *var;	  // variable containing current status
  int  maxvalue;  // maximumvalue,  normally 1  gives  0=off  1=on
} MENU[MENUMAXITEMS];


void MenuAddItem(char *txt, char **opt, int *var, int maxvalue, int typ)
{
  MENU[Mmax].typ=typ;
  MENU[Mmax].txt=txt;
  MENU[Mmax].opt=opt;
  MENU[Mmax].var=var;
  MENU[Mmax].maxvalue=maxvalue;
  Mmax++;
}

void MenuShow(int x, int y,	ID3DXFont *pFont)
{

  int i, val;
  DWORD color;
    SetRect( &rect, x+Mxofs/2, y, x+Mxofs /2 , y );
  if (!Mvisible) return;

  if (Mtitle[0]) {
	  pFont->DrawText(NULL,Mtitle,-1,&rect,DT_NOCLIP | DT_CENTER, MCOLOR_TITLE);

	  y+=Mysize;
  }
  for (i=0; i<Mmax; i++) {
	   val=(MENU[i].var)?(*MENU[i].var):0;
	   // determine color
       if (i==Mpos)
           color=MCOLOR_CURRENT;
       else if (MENU[i].typ==MENUFOLDER)
           color=MCOLOR_FOLDER;
       else if (MENU[i].typ==MENUTEXT)
           color=MCOLOR_TEXT;
       else
		   color=(val)?MCOLOR_ACTIVE:MCOLOR_INACTIVE;
     SetRect( &rect3, x, y, x , y );
     SetRect( &rect2, x+Mxofs, y, x+Mxofs , y );
	   pFont->DrawText(NULL,MENU[i].txt,-1,&rect3, DT_NOCLIP,color);
       if (MENU[i].opt) {
		   if (MENU[i].typ==MENUTEXT)
		   	   pFont->DrawText(NULL,(char *)MENU[i].opt,-1,&rect2, DT_NOCLIP | DT_RIGHT, color);
		   else
			   pFont->DrawText(NULL,(char *)MENU[i].opt[val],-1,&rect2, DT_NOCLIP | DT_RIGHT, color);
	   }
       y+=Mysize;
  }
}

void MenuNav(void)
{
  if (GetAsyncKeyState(VK_INSERT)&1) Mvisible=(!Mvisible);
  if (!Mvisible) return;

  if (GetAsyncKeyState(VK_UP)&1) {
		do {
			Mpos--;
			if (Mpos<0)  Mpos=Mmax-1;
		} while (MENU[Mpos].typ==MENUTEXT);		// skip textitems
  } else if (GetAsyncKeyState(VK_DOWN)&1) {
		do {
			Mpos++;
		    if (Mpos==Mmax) Mpos=0;
		} while (MENU[Mpos].typ==MENUTEXT);		// skip textitems
  } else if (MENU[Mpos].var) {
		int dir=0;
		// bugfix: thx to ***-Wieter20
		if (GetAsyncKeyState(VK_LEFT )&1 && *MENU[Mpos].var > 0                      ) dir=-1;
		if (GetAsyncKeyState(VK_RIGHT)&1 && *MENU[Mpos].var < (MENU[Mpos].maxvalue-1)) dir=1;
		if (dir) {
			*MENU[Mpos].var += dir;
			if (MENU[Mpos].typ==MENUFOLDER) Mmax=0;  // change on menufolder, force a rebuild
		}
  }
}
If you want to define your menu, do it in a different .cpp. Like in "hackbase.cpp".

Credit to Im V!rus:
Code:
#include <d3d9.h>
   #include <d3dx9.h>
   #pragma comment (lib, "d3d9.lib")
   #pragma comment( lib, "d3dx9.lib" )
  
   int        CH_cheats      = 1;
   int        CH_weap       = 1;
  
   int        CH_stamina    = 0;
   int        CH_fastammo   = 1;
   int        CH_fasthealth = 0;
   int        CH_fastrepair = 0;
   int        CH_fastflag   = 1;
   int        CH_nospread   = 1;
   int        CH_norecoil   = 1;
   int        CH_unlammo    = 0;
   int test =0;
   // none standard options
   char *sStamina[] = { "Off","Stealth","Full" };
   char *Ctest[] = { "GoD" };
   void RebuildMenu(void)
   {
     strcpy(Mtitle,"== D3Dmenu by Hans211 ==");
     MenuAddItem("[V!rus]", Moptfolder, &CH_cheats, 2, MENUFOLDER);
     if (CH_cheats) {
         MenuAddItem("Skill Hack"     , sStamina  , &CH_stamina   , 3, MENUITEM);
         MenuAddItem("GoD Mode"   , Moptonoff , &CH_fastammo  , 2, MENUITEM);
         MenuAddItem("Zombie Mode" , Moptonoff , &CH_fasthealth, 2, MENUITEM);
         MenuAddItem("Ghost Mode" , Moptonoff , &CH_fastrepair, 2, MENUITEM);
     }
     MenuAddItem("[Test]", Moptfolder, &CH_weap, 2, MENUFOLDER);
     if (CH_weap) {
         MenuAddItem("Test"     , Moptonoff , &CH_nospread, 2, MENUITEM);
         MenuAddItem("Test"     , Moptonoff , &CH_norecoil, 2, MENUITEM);
         MenuAddItem("Test", Moptonoff , &CH_unlammo , 2, MENUITEM);
     }
     MenuAddItem("[V!rus]"        , Ctest , &test,1,MENUFOLDER);
   }
  
   ID3DXFont* m_pFont;
   void PreReset(void)
   {
       if(m_pFont){
        if(m_pFont->Release())
            m_pFont = NULL;
       }
   }
   void Release( LPDIRECT3DDEVICE9 m_pD3Ddev)
   {
   // Look definition if u want edit it for make better text :D
     D3DXCreateFont(m_pD3Ddev, 15, 0, FW_BOLD, 0, 0, DEFAULT_CHARSET, OUT_TT_ONLY_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, TEXT("Arials"), &m_pFont );
   }
You can add more custom menu options, i did it in d3dmenu.h,

Just add them below
Code:
extern char		*Moptfolder[];		// "+"  , "-"
extern char		*Moptonoff[];		// "Off", "On"
If you want a base with all of that done, and you can just edit it, PM me.
you can pm me also. ive worked with this base before
Thanks ill check it out
Quote Originally Posted by kody1206 View Post
Thanks ill check it out
Spammers these days
Posts 1–15 of 24 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us