Help with retrieving a float from PAWN
#1

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...
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;
}
And then I call it from PAWN in my gamemode like so...

pawn Code:
public OnGameModeInit()
{
    TestFunction(69.345);
    return 1;
}
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...

pawn Code:
native TestFunction(Float:fparam);
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.
Reply


Messages In This Thread
Help with retrieving a float from PAWN - by CodyCummings - 20.01.2013, 13:16
Respuesta: Help with retrieving a float from PAWN - by oOFotherOo - 20.01.2013, 14:15
Re: Respuesta: Help with retrieving a float from PAWN - by CodyCummings - 20.01.2013, 14:19
Re: Help with retrieving a float from PAWN - by Gamer_Z - 22.01.2013, 08:33

Forum Jump:


Users browsing this thread: 1 Guest(s)