SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 01/03/2015, 08:38 PM   #1
adri1
High-roller
 
Join Date: Oct 2010
Posts: 1,780
Reputation: 955
Default Help, making a callback

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);
}
adri1 is offline   Reply With Quote
Old 03/03/2015, 02:23 PM   #2
vermaritt
Little Clucker
 
Join Date: Feb 2015
Posts: 46
Reputation: 5
Default Re: Help, making a callback

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;
}
vermaritt is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorial] Hooking CallBack(s) - How to Hook any callback Swimor Tutorials 6 19/10/2012 09:32 PM
[Help]Making a callback Dave001 Plugin Development 5 04/05/2011 04:44 PM
I'm making an RP gamemode from scratch [And i'm stuck] anyone who can help me in making it? anantanni Help Archive 4 30/04/2011 05:58 AM


All times are GMT. The time now is 02:37 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.