Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forward pawn callback not executing in C++ #224

Open
0xdazed opened this issue Nov 9, 2023 · 0 comments
Open

Forward pawn callback not executing in C++ #224

0xdazed opened this issue Nov 9, 2023 · 0 comments

Comments

@0xdazed
Copy link

0xdazed commented Nov 9, 2023

Basically, I want to call a forward public in my .pwn gamemode with CallLocalFunction() and handle it in my sampgdk plugin gamemode.

gamemode.pwn:

#include <a_samp>

main()
{

}

forward TestCallback(playerid);
public TestCallback(playerid)
{
    return 1;
}

public OnPlayerConnect(playerid)
{
    CallLocalFunction("TestCallback", "i", playerid);
    return 1;
}

Sampgdk plugin:

bool TestCallback(int playerid)
{
	sampgdk_SendClientMessage(playerid, 0xFFFFFFFF, "Callback in CPP");
	return 1;
}

PLUGIN_EXPORT bool PLUGIN_CALL OnPublicCall(AMX* amx, const char* name, cell* params, cell* retval)
{
	std::string lName = std::string(name);

	if (lName == "TestCallback") { return TestCallback(static_cast<int>(params[1])); }

	return 1;
}

Issue is it doesn't really work, SendClientMessage won't get executed. Is it even possible to do this somehow?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant