Error Adding Item To Menu

Posts 1–6 of 6 · Page 1 of 1
Error Adding Item To Menu
Hey, Getting error "Send Error Report" when adding item
to menu...

Codes:
Code:
Call:
Menu->AddItem("WallHack", &WH, Green, White);

Menu.h:
struct
	{
		char item[30];
		bool* var;
		D3DCOLOR colorON;
		D3DCOLOR colorOFF;
	}MENU[100];

Menu.cpp:
void MyMenu::AddItem(char item[30], bool* var, D3DCOLOR ColorON, D3DCOLOR ColorOFF) {
	numtotal++;
	sprintf_s(MENU[numtotal].item, "%s", item);   <---------- Error occours here!
	MENU[numtotal].var = var;
	MENU[numtotal].colorON = ColorON;
	MENU[numtotal].colorOFF = ColorOFF;
}
Any Ideas?
Thanks!

PS.: There's nothing when compile the code, the error is IN the game!
search for a d3d9 menu public source and just update the hook and use it and just change the menu design+font+size..etc
Only increase numtotal after assigning a menu entry (i.e. at the end of the function) so you're not changing the second item instead of the first. Also make sure numtotal is initialized to 0 in the constructor of MyMenu (or a parent class).
Other than that, I'd make the parameter item a const char* but it shouldn't cause an issue either way.
Quote Originally Posted by derh.acker View Post
Only increase numtotal after assigning a menu entry (i.e. at the end of the function) so you're not changing the second item instead of the first. Also make sure numtotal is initialized to 0 in the constructor of MyMenu (or a parent class).
Other than that, I'd make the parameter item a const char* but it shouldn't cause an issue either way.
I thought about it and changed but it keeps getting me the error!


I tried doing it with strcpy, but, same error again
Posts 1–6 of 6 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us