Need help with fixing error within code

I have recently started working on an in-game mod menu for Call of Duty Black Ops II on the Xbox 360 for the latest title update 18. This is what I have wrote up so far and when I went to build it, I encountered quite a few errors.

Any help you can give me would be greatly appreciated :)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
int G_Entity(int Client)
{
    return(0x833D0640 + (Client * 0x31C));
}

unsigned int GetPlayerState(int Client)
{
    return(0x83551A10 + (Client * 0x57F8));
}

void SwitchToWeap(int Client, const char *Weapon, int WeaponIndex = 0)
{
    if(WeaponIndex == 0)
    {
        char buffer[100];
        sprintf(buffer,"a %i", G_GetWeaponIndexForName(Weapon));
        SV(Client, 1, buffer);
    }
    else
    {
        char buffer[100];
        sprintf(buffer,"a %i", WeaponIndex);
        SV(Client, 1, buffer);
    }
}

bool Key_IsDown(int localClientIndex, int keynum)
{
    if(keynum == -1 || localClientIndex > 3)
        return false;
    else
        return *(int*)(0x82C0CDA8 + (keynum * 0x10) + (localClientIndex * 0x1128) + 0x128);
}

__declspec(naked) bool Key_IsDown(int localClientIndex, int keynum)
{
    if(keynum == -1 || localClientIndex > 3)
    {
        __asm
        {
            li      r3, 0
            blr
        }
    }
    else
    {
        __asm
        {
            mr r4, keynum
            mr r3, localClientIndex
            lis       r9, 0x82AC
            addi      r11, r9, -0xCA40
            mulli     r10, r3, 0x1128
            mulli     r9, r4, 0x10
            addi      r7, r11, 0x128
            add       r6, r10, r9
            lwzx      r3, r6, r7
            blr
        }
    }
}

game_hudelem_s * spawnElem(int ClientNum)
{
	game_hudelem_s * elem = HudElem_Alloc(0,0);
	elem->ClientNum = ClientNum;
	return elem;
}

game_hudelem_s * Shader[18], * Scrollbar[18], * Title[18], * Newsbar[18], * Text[18];

void MoveOverTime(game_hudelem_s *elem, int time, float x, float y)
{
	elem->elem.fromX = elem->elem.x;
	elem->elem.fromY = elem->elem.y;
	elem->elem.fromAlignOrg = elem->elem.alignOrg;
	elem->elem.fromAlignScreen = elem->elem.alignScreen;
	elem->elem.moveStartTime = *(int*)0x8310A12C;
	elem->elem.moveTime = time;
	elem->elem.x = x;
	elem->elem.y = y;
}

void setShader(game_hudelem_s * elem, const char * materialName, float x, float y, int width, int height, int alignOrg, int alignScreen, float sort = 0, byte r = 255, byte g = 255, byte b = 255, byte a = 255)
{
	elem->elem.type = 0x04;
	elem->elem.alignOrg = alignOrg;
	elem->elem.alignScreen = alignScreen;
	elem->elem.x = x;
	elem->elem.y = y;
	elem->elem.color.r = r;
	elem->elem.color.g = g;
	elem->elem.color.b = b;
	elem->elem.color.a = a;
	elem->elem.width = width;
	elem->elem.height = height;
	elem->elem.sort = sort;
	elem->elem.materialIndex = G_MaterialIndex(materialName);
}

void setText(game_hudelem_s * elem, const char * text, int font, float fontScale, float x, float y, int alignOrg, int alignScreen, float sort = 1, byte r = 255, byte g = 255, byte b = 255, byte a = 255)
{
	elem->elem.type = 0x01;
	elem->elem.alignOrg = alignOrg;
	elem->elem.alignScreen = alignScreen;
	elem->elem.font = font;
	elem->elem.fontScale = fontScale;
	elem->elem.x = x;
	elem->elem.y = y;
	elem->elem.color.r = r;
	elem->elem.color.g = g;
	elem->elem.color.b = b;
	elem->elem.color.a = a;
	elem->elem.sort = sort;
	elem->elem.text = G_LocalizedStringIndex(text);
}

float FindY(int client)
{
	return (Menu[client].Scroll * 32) + 230;
}

void SwapMenu(int client,const char* text,int Size,int subNumber)
{
	Menu[client].Size = Size;
	Menu[client].Scroll = 0;
	Menu[client].SubMenu = subNumber;
	Text[client]->elem.text = G_LocalizedStringIndex(text);
	MoveOverTime(Scrollbar[client],230,580,FindY(client));
}

typedef unsigned int		start;

void StartUp()
{
	for(start i = 0;i<18;i++)
	{
		Shader[i] = HudElem_Alloc(i,0);
		Scrollbar[i] = HudElem_Alloc(i,0);
		Newsbar[i] = HudElem_Alloc(i,0);
		Text[i] = HudElem_Alloc(i,0);
		setShader(Shader[i],"",580,360,100,200,0x5,0x5,1,0,0,0,150);
		setShader(Scrollbar[i],"",320,400,100,200,0x5,0x5,1,255,0,0,150);
		setShader(Newsbar[i],"",100,255,80,10,0x5,0x5,1,0,0,0,150);
		setText(Title[i],"Untitled",5,3.5,0,0,0x5,0x5,255,255,255,255);
	}
	loaded = true;
}

void Select(int Client, int Option, int SubMenu)
{
	switch(SubMenu)
	{
	case 1:
		switch(Option)
		{
		case 1:
			{
				setText(Title[Client],"",5,2.5,580,100,0x5,0x5,255,255,255,255,255);
			}
			break;
			{

			}
		}
	}
}

BOOL WINAPI DllMain(HANDLE hInstDLL, DWORD reason, LPVOID IpReserved)
{
	switch(reason)
	{
	case DLL_THREAD_ATTACH:
		printf("");
		Sleep(45);
		break;
	case DLL_THREAD_DETACH:
		printf("");
		Sleep(45);
		break;
	}
}


ERRORS:

error C2084: function 'bool Key_IsDown(int,int)' already has a body
error C2440: '=' : cannoct convert from 'bool (__cdecl*)(int,int)' to 'bool'
error C3861: 'Key_IsDown': identifier not found
error C2440: '=' : cannot convert from 'bool (__cdecl *)(int,int) to 'bool'
error C3861: 'Key_IsDown': identifier not found
error C2371: 'hudelem_s::color' : redefinition; different basic types
error C2371: 'hudelem_s::fromColor' : redefinition; different basic types
error C2228: ;eft of '.r' must have class/struct/union
error C2228: ;eft of '.g' must have class/struct/union
error C2228: ;eft of '.b' must have class/struct/union
error C2228: ;eft of '.a' must have class/struct/union
error C2228: ;eft of '.r' must have class/struct/union
error C2228: ;eft of '.g' must have class/struct/union
error C2228: ;eft of '.b' must have class/struct/union
error C2228: ;eft of '.a' must have class/struct/union
Key_IsDown exists twice (with the same signature). Use a different name for one of them
Topic archived. No new replies allowed.