20.01.2013, 13:16
Hey! I was wondering if any of you would have an answer to my slight problem that I've been having, I've researched around, tried many different methods but I can't seem to retrieve a float from PAWN to my plugin, and let me explain how I try...
So, let's say I have the native function set up like so...
And then I call it from PAWN in my gamemode like so...
When I run the gamemode, it prints out "Float parameter: 0.00000" instead of my float, but if I have the native set up like this...
It will print out my float fine on runtime...
Is there any specific reason for this? Am I using a wrong method to get the parameters? Keep in mind I need the first method of declaring the native in PAWN.
EDIT: Also, I've managed to print out a string, integer and character from the first native method, it's just the floats that are not working.
So, let's say I have the native function set up like so...
pawn Code:
native TestFunction({Float,_}:...);
pawn Code:
static cell AMX_NATIVE_CALL TestFunction(AMX *amx, cell *params)
{
float returnedfloat = amx_ctof(params[1]);
logprintf("Float parameter: %f", returnedfloat);
return 1;
}
pawn Code:
public OnGameModeInit()
{
TestFunction(69.345);
return 1;
}
pawn Code:
native TestFunction(Float:fparam);
Is there any specific reason for this? Am I using a wrong method to get the parameters? Keep in mind I need the first method of declaring the native in PAWN.
EDIT: Also, I've managed to print out a string, integer and character from the first native method, it's just the floats that are not working.