C++ problem CA NA

Posts 1–10 of 10 · Page 1 of 1
C++ problem CA NA
lmao i stared over i need help to finish :\


Code:
#include "stdafx.h"
namespace CombatArms
{
	/* Note: This is pretty bad to need 2 arrays, but it's a quick hackup.  */
	/*       there MUST be a corresponding key for each hotkey declared.    */
	/*                                                                      */
	/*       This array stores the keys for both the RCCHotKeys and the     */
	/*       CallBackHotKeys.  If you don't understand what I mean, read    */
	/*       what is going on in Base::Base() and if you still don't        */
	/*       understand, feel free to ask me on the forums.                 */
	/*                                                                      */
	/*       To be sure this is correct, count the elements in both array   */
	/*       "commands" and "callbacks" and you should have the same amount */
	/*       of elements in this array.                                     */
	int keys[] =
	{
		VK_NUMPAD1,
		VK_NUMPAD2,
		VK_NUMPAD3
	};

	RCCInfo commands[] =
	{
		{ "ShowFps", "1", "0" },
		{ "Tracers", "1", "0" }
	};

	CallBack_T callbacks[] =
	{
		&Base::SuperBullets
	};

	Base::Base()
	{
		int commands_max = sizeof(commands) / sizeof(commands[0]);

		/* Iterate over the RCCInfo array and make a RCCHotKey out of them given the information */
		/* in the 'keys' array. */
		for(int x = 0; x < commands_max; x++)
		{
			m_hotkeys.push_back(new RCCHotKey(keys[x], commands[x]));
		}

		int callbacks_max = sizeof(callbacks) / sizeof(callbacks[0]);

		/* Iterate over the CallBack_T array and make a CallbackHotKey out of them given   */
		/* the information in the 'keys' array.  The index of the key will start where the */
		/* RCCInfo keys left off.                                                          */
		for(int x = 0; x < callbacks_max; x++)
		{
			m_hotkeys.push_back(new CallbackHotKey(keys[commands_max + x], callbacks[x]));
		}
	}

	Base::~Base()
	{
		if(!m_hotkeys.empty())
		{
			std::vector<HotKey*>::iterator it;

			for(it = m_hotkeys.begin(); it != m_hotkeys.end(); it++)
			{
				delete *it;
			}
		}
	}

	/* Note: This may look familiar, you can actually turn this base into          */
	/*       a menu in this method, because now we have to call RCC from           */
	/*       within a thread in the game.  So I use a DirectX hook for simplicity. */
	void Base::RenderFrame(LPDIRECT3DDEVICE9 pDevice)
	{
		/* This is static so it is only created once. */
		static std::vector<HotKey*>::iterator it;

		for(it = m_hotkeys.begin(); it != m_hotkeys.end(); it++)
		{
			/* If you haven't read the source for the HotKey class, I'd recommand that  */
			/* you do so now so you can understand what's happening here.               */
			(*it)->Tick();
		}
	}

	void Base::SuperBullets(bool bActivated)
	{
		if(bActivated)
		{
			// Enabled SuperBullets.
		}
		else
		{
			// Disable SuperBullets.
		}
	}
}// dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"
#include "Base.h"
#include "DirectX.h"

#pragma comment(lib, "d3d9")

/* This will be the base referenced throughout the project. */
/* if I wasn't lazy, I'd make this a true singleton, but I  */
/* didn't really feel like it. Feel free to do so.          */
CombatArms::Base base;

DWORD WINAPI DllInit(HMODULE hModule)
{
	while(!base.ReadyForHooks()) Sleep(100);

	DetourDirectX();

	return 0;
}

BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  dwReason,
                       LPVOID lpReserved
					 )
{
	if(dwReason == DLL_PROCESS_ATTACH) 
	{
		DisableThreadLibraryCalls(hModule);
		CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) DllInit, hModule, 0, NULL);
	}

	return TRUE;
}#ifndef __HOTKEY_H__
#define __HOTKEY_H__

#pragma once

namespace CombatArms
{
	namespace Keyboard
	{
		typedef void (*CallBack_T)(bool bEnabled);

		typedef int (__cdecl* RunConsoleCommand_T)(const char* szCommand);
		static RunConsoleCommand_T RunConsoleCommand = (RunConsoleCommand_T) 0x485E10;

		struct RCCInfo
		{
			const char* szCommand;
			const char* szActivatedValue;
			const char* szDefaultValue;
		};

		class HotKey
		{
		public:
			HotKey(int vkey);
			~HotKey();

			int GetKey();
			void Tick();

			virtual void Called() = 0;

		protected:
			int m_vkey;
			bool m_enabled;
		};

		class CallbackHotKey : public HotKey
		{
		public:
			CallbackHotKey(int vkey, CallBack_T callback);
			~CallbackHotKey();

			void Called();

		private:
			CallBack_T m_callback;
		};

		class RCCHotKey : public HotKey
		{
		public:
			RCCHotKey(int vkey, const RCCInfo& info);
			~RCCHotKey();

			void Called();

		private:
			const RCCInfo& m_info;
		};
	}
}

#endif // __HOTKEY_H__
#include "stdafx.h"
#include <SDKDDKVer.h>
Code:
[/QUOTE]
Put it inside a code box. using the [code] tags.
can anyone please answer me nd help???? : \
Quote Originally Posted by Hell_Demon View Post
Learn C++ first.
this guy is saying true shit
can u help me please??? please..
i was trying to make a reg little hack...
Hmmm.... did you think you could just combine a bunch of different files together in no particular rhyme or reason into the same file, load it into a compiler and expect it to do what you wanted...
you .... know less than i do.

wtf is with the commenting at the beginning?
It just looks like a few files crammed into one file. You've included the same file twice and put crap all over the place. You don't know C++ do you? I think it's time to learn....

Posts 1–10 of 10 · Page 1 of 1

Post a Reply

Tags for this Thread

Talk with us