SA-MP Forums Archive
Help, making a callback - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Plugin Development (https://sampforum.blast.hk/forumdisplay.php?fid=18)
+--- Thread: Help, making a callback (/showthread.php?tid=565857)



Help, making a callback - adri1 - 01.03.2015

Code:
int AnEventForCallingBack()
{
    int idx; 
    cell ret, amx_Address,*phys_addr;
    int amxerr = amx_FindPublic(pAMX, "OnMouseWheelScroll", &idx);
    if (amxerr == AMX_ERR_NONE)
    {
		amx_Exec(pAMX, &ret, idx);
        return 1;
    }
    return 0;
}
Error:
1>c:\users\usuario\documents\visual studio 2010\projects\tbr\tbr\tbr.cpp(35): error C2065: 'pAMX' : undeclared identifier
1>c:\users\usuario\documents\visual studio 2010\projects\tbr\tbr\tbr.cpp(38): error C2065: 'pAMX' : undeclared identifier

I know I must declare pAMX, but I am noob in c ++
Code:
LRESULT CALLBACK MouseHookProc(int nCode, WPARAM wParam, LPARAM lParam)
{

    MSLLHOOKSTRUCT * pMouseStruct = (MSLLHOOKSTRUCT *)lParam;

    if (wParam == WM_MOUSEWHEEL) 
	{
		if (HIWORD(pMouseStruct->mouseData) == 120)
		{
			AnEventForCallingBack();
		}
		else logprintf("down");
 
	}
    return CallNextHookEx(0, nCode, wParam, lParam);
}



Re: Help, making a callback - vermaritt - 03.03.2015

I am not sure about this, but should not it be:

Code:
int AnEventForCallingBack(AMX* pAMX) //to check/find publics present in the abstract machine
{
    int idx; 
    cell ret, amx_Address,*phys_addr;
    int amxerr = amx_FindPublic(pAMX, "OnMouseWheelScroll", &idx);
    if (amxerr == AMX_ERR_NONE)
    {
		amx_Exec(pAMX, &ret, idx);
        return 1;
    }
    return 0;
}