[Help]Making a callback
#1

Hello,
I have been experimenting with plugins for about a week, and I managed to make new functions and calling native ones as well, but I can't find out how to make a new callback.
I took a look at the plugin sources but I don't really understand how they create new callbacks.
Reply
#2

I assume you mean a function/native that can be ported to PAWN.

If you have the SA-MP plugin SDK for 0.2, then you'll notice an enum containing all of the natives for plugins, look closely at the two values on the lines, they should show as:

Код:
"HelloWorld",           n_HelloWorld
Or something similar, replicate that line with the function you're creating, then copy the first line of n_HelloWorld, which would be something along the lines of:

Код:
static cell AMX_NATIVE_CALL n_HelloWorld( AMX* amx, cell* params )
Copy that code and change 'HelloWorld' to the name of your function and include the left and right braces for your function and then implement your code within the function.

If you DO mean callbacks, then you need to be specific. What is it being called for?
Reply
#3

First of all thanks for repliing so fast
But, I meant callback, like OnPlayerConnect
Can you please show me an example with two parameters? (first parameter - integer, second - string)
Reply
#4

Oh, so you want to be able to call OnPlayerConnect from your plugin?

You have to use PawnCommand() but I can't find an up-to-date version of the function for 0.3c.
Reply
#5

It wasn't wrong according to the plugins I looked in to, perhaps I just misread the code.

Furthermore, it is pretty common for people to mistake functions and callbacks.
Reply
#6

Edit: Solved! Thank you guys
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)