[Floats] Problem I've been having... Partially Solved... Proper Solution Needed!
#1

Hello,

Ok, so I want to say this a simple as possible...

1. I made a plugin.
2. I send a few float values from the plugin to the gamemode.
3. I format a string in the gamemode to show the values, and make sure they're right.
4. I try it, and the values show correctly, and are what they are supposed to be.
5. I teleport to the location, and the screen goes white, as if you were EXTREMELY out of bounds( the Out of world boundary text shows also ).

Is there a known problem with sending floats from a plugin, to the gamemode.
I'm using a line similar to this in the gamemode:
Code:

SetPlayerPos(playerid,ReturnedValue(1,1),ReturnedV alue(1,2),ReturnedValue(1,3));


ReturnedValue takes two parameters, first one being the id of a array on the plugin, the second being the value of each array at that id.

Code:

static cell AMX_NATIVE_CALL n_ReturnedValue( AMX* amx, cell* params )
{
return FloatData[params[1]][params[2]];
}


That's the basics of the function in the plugin, and yes, I do use a valid id for the array, I do not pick a number greater or less than the array range.

Any help is appreciated,

Thanks,
Stephen

Partially Solved...
If I do this:

Code:
new convertstring[32];
format(convertstring,sizeof(convertstring),"%f",ReturnedValue(1,1))
new Float:WorkingValue = floatstr(convertstring);
It works, but I would like to figure out the proper way...

Thanks
Stephen
Reply
#2

Maybe he wants to get the values from a source that PAWN cant access
Reply
#3

I'm using amx_ftoc, sorry forgot to put it in the initial post...

Code:
float ReturnedValue(int id, int slot);
...
static cell AMX_NATIVE_CALL n_ReturnedValue( AMX* amx, cell* params )
{
 return amx_ftoc(FloatData[params[1]][params[2]]);
}
...
The Main reason I'm using arrays in C++ over arrays in PAWN is because of preference. I like C++ more, and obviously it is more powerful if you know hot to use it to it's max.
Right now, this seems to be the only real problem I'm having with plugins... later I'll have to figure out how return character arrays... but that's another subject.

Since you asked, my plan is to do whatever I can in the plugin. This includes loading and saving variables into arrays, string modifications, etc. Then, I'll do all the basic stuff in PAWN, using the plugin.

Thanks for any input,
Stephen
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)