kali ini saya akan memberikan base CF indo
ingat hanya contoh..
jadi kalo mau di tambah fitur tinggal cari sendiri..
Menu.h
Menu.Cpp
Credit N3
ingat hanya contoh..
jadi kalo mau di tambah fitur tinggal cari sendiri..
Menu.h
#include <windows.h> #include <stdio.h> //remove these stupid warnigs #pragma warning(disable:4996) #pragma warning(disable:4312) //default keys #define VALINC VK_RIGHT#define VALDEC VK_LEFT#define ITMINC VK_DOWN#define ITMDEC VK_UP#define MNSHOW VK_INSERT#define AFKBOT VK_F2 //never saw them changed but you will need to change them for CFPH #define ID_MSG 0x1C #define ID_NOR 0x16 #define ID_AFK 0x37 class CMenu; //so we include in only one cpp file #ifndef MYMENU#define MYMENUclass CMenu { private: //some private members char name[100]; //name of the coder (or nothing) char items[100][100]; //items in the menu .. max 100 item and 100 character per item char** options[100]; //pointer to options array DWORD* values[100]; //pointer to value holder DWORD curitem; //current active item DWORD numitems; //current number of elements void DrawMessage(DWORD Type, DWORD dwID, DWORD dwType2, LPVOID lpText); bool IsVisible(); void PushToConsole(LPSTR command); public: DWORD MessageFunc; //ingame message box function DWORD VisibleState; //ingame message state variable DWORD PTC; //LTC CMenu(LPSTR lpName = NULL); ~CMenu(); void Nav(); void AddItem(LPSTR lpText, char** options, DWORD* val); bool Ready(); }; #endif
Menu.Cpp
#include "menu.h" CMenu::CMenu(LPSTR lpName) { //initilize variables values to NULL strcpy(name, lpName); MessageFunc = NULL; VisibleState = NULL; curitem = NULL; numitems = NULL; } CMenu::~CMenu() { } //Check if we are ready or not bool CMenu::Ready() { return (GetModuleHandleA("ClientFx.Fxd") > 0); } //Adds a new item void CMenu::AddItem(LPSTR lpText, char** opt, DWORD* val) { values[numitems] = val; options[numitems] = opt; strcpy(items[numitems++], lpText); } //Draw the message to the game void CMenu::DrawMessage(DWORD Type_, DWORD dwID, DWORD dwType2, LPVOID lpText) { if (!MessageFunc) return; if (Type_ == ID_MSG) if (IsVisible()) return; DWORD MsgBoxFunc = MessageFunc; __asm{ push lpText; push dwType2; push dwID; push Type_; call MsgBoxFunc; add esp, 16; } } //checks if the menu is visible or not bool CMenu::IsVisible() { if (!VisibleState) return false; if ((*(DWORD*)(VisibleState)) == ID_NOR) return false; return true; } //Push to console function //we will use it to fix centered cursor void CMenu::PushToConsole(LPSTR command) { if (!PTC) return; DWORD pointer = *(DWORD*)(PTC); if (pointer) { DWORD FuncToCall = *(DWORD*)(pointer+0x1FC); if (FuncToCall) { __asm{ push command; call FuncToCall; add esp, 4; } } } } //Control menu navigation void CMenu::Nav() { //use a variable to check if we need to redraw bool drawing = false; //When afkbot key (default f2) is pressed if (GetAsyncKeyState(AFKBOT)) { //draw the storage message DrawMessage(ID_AFK, 0, 0, 0); //fix the centered cursor PushToConsole("CursorCenter 0"); Sleep(50); //move the cursor.. now the user can left click to activate SetCursorPos(500, 500); } if (!numitems) return; DWORD curval = *values[curitem]; //when toggle menu key is pressed (default insert) if (GetAsyncKeyState(MNSHOW)) { if (IsVisible()) { DrawMessage(ID_NOR, 0, 0, 0); return; } else drawing = true; } else if (!IsVisible()) return; //When the user tries to get the next item (default down) if (GetAsyncKeyState(ITMINC)) { curitem++; if (curitem >= numitems) curitem = 0; drawing = true; } //When the user tries to get the previous item (default up) if (GetAsyncKeyState(ITMDEC)) { if (curitem == 0) curitem = numitems; curitem--; drawing = true; } //When the user tries to increase the value (default right) if (GetAsyncKeyState(VALINC)) { if (options[curitem][curval+1]) { curval++; *values[curitem] = curval; drawing = true; } } //When the user tries to decrease the value (default left) if (GetAsyncKeyState(VALDEC)) { if (curval) { curval--; *values[curitem] = curval; drawing = true; } } //if we have to redraw if (drawing) { //remove any exising message DrawMessage(ID_NOR, 0, 0, 0); Sleep(50); //write the message to a buffer char buffer[200]; sprintf(buffer, "%s\n%s : %s", name, items[curitem], options[curitem][curval]); //draw the message DrawMessage(ID_MSG, 0x70, 4, buffer); } }
Credit N3
0 komentar:
Posting Komentar