After I read dll injection tutorials and after that created my first dll injection for test, I started to create 'real' dll injection for some game.
I'm trying to call a function inside game to add message to chat box.
I've found a string which is pushed on stack then a message is pushed and after noping this code I couldn't send any message in that game so I think it's the code of function that I was looking for. I've made a dll, it's injected successfully and the function which I wrote which calls function in game is executed but nothing happens.

Code:
00821AEE   85ED			 /TEST EBP,EBP
00821AF0   75 06			|JNZ SHORT League_o.00821AF8
00821AF2   FF15 B0689B00	|CALL DWORD PTR DS:[<&MSVCR80._invalid_p>; MSVCR80._invalid_parameter_noinfo
00821AF8   3B75 08		  |CMP ESI,DWORD PTR SS:[EBP+8]
00821AFB   72 06			|JB SHORT League_o.00821B03
00821AFD   FF15 B0689B00	|CALL DWORD PTR DS:[<&MSVCR80._invalid_p>; MSVCR80._invalid_parameter_noinfo
00821B03   837E 18 10	   |CMP DWORD PTR DS:[ESI+18],10
00821B07   72 05			|JB SHORT League_o.00821B0E
00821B09   8B46 04		  |MOV EAX,DWORD PTR DS:[ESI+4]
00821B0C   EB 03			|JMP SHORT League_o.00821B11
00821B0E   8D46 04		  |LEA EAX,DWORD PTR DS:[ESI+4]
00821B11   8B5424 14		|MOV EDX,DWORD PTR SS:[ESP+14]
00821B15   8B7A 08		  |MOV EDI,DWORD PTR DS:[EDX+8]
00821B18   85FF			 |TEST EDI,EDI
00821B1A   74 0B			|JE SHORT League_o.00821B27
00821B1C   50			   |PUSH EAX
00821B1D   68 4422A800	  |PUSH League_o.00A82244				  ; ASCII "Add_Message"
00821B22   E8 49E5CFFF	  |CALL League_o.00520070
00821B27   56			   |PUSH ESI
00821B28   55			   |PUSH EBP
00821B29   8D4424 20		|LEA EAX,DWORD PTR SS:[ESP+20]
00821B2D   50			   |PUSH EAX
00821B2E   53			   |PUSH EBX
00821B2F   E8 CCFEBDFF	  |CALL League_o.00401A00
00821B34   836C24 10 01	 |SUB DWORD PTR SS:[ESP+10],1
00821B39   8B28			 |MOV EBP,DWORD PTR DS:[EAX]
00821B3B   8B70 04		  |MOV ESI,DWORD PTR DS:[EAX+4]
00821B3E  ^75 AE			\JNZ SHORT League_o.00821AEE
Code:
The address of function, lets calls it 'AddMessage' is that:
00821B1C   50              |PUSH EAX   // this is string sent to chat
00821B1D   68 4422A800    |PUSH League_o.00A82244                 ; ASCII "Add_Message" // idk
00821B22   E8 49E5CFFF    |CALL League_o.00520070 //call to function
And this is my code (using GCC inline assembly):
Code:
extern "C" __stdcall void AddChat(char * sz)
{
	static int PrintText = 0x00520070;
	static char a[] = "Add_Message";

	 __asm("push %0;" :: "r"(sz));
	 __asm("push %0;" :: "r"(a));
	 __asm("call %0;" :: "r"(PrintText));
}
Why it doesn't work? Is variable PrintText which holds addr of function in game's process wrong?