float argument
#1

how to return float as argument

Code:
void ReturnFloatArg(AMX* amx, cell param, double value)
{
	cell *cptr;
	amx_GetAddr(amx, param, &cptr);
	*cptr = amx_ftoc(value);
}
and use

Code:
ReturnFloatArg(amx, params[1], atof(str));
str is "100.0"
what is wrong?

sorry for my bad English
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=69699

/endof
Reply
#3

@Hiddos omg this problem is from SDK sa:mp not from C++ !

if not here then where a will asking for help?
Rather few people familiar with the sa:mp SDK
Reply
#4

You should seriously have a look at the implementer's guide, otherwise you will never understand how it works. It explains you how to pass floats, strings and integers.

http://www.compuphase.com/pawn/Pawn_...nter_Guide.pdf

I'm going to quote some important paragraphs you probably need to learn, because your current structure is not going to work.

Quote:

The params argument points to an array that holds the parameter list of the function. The value of params[0] is the number of bytes passed to the function (divide by the size of a cell to get the number of parameters passed to the function); params[1] is the first argument, and so forth.

Quote:

The symbols amx_ctof and amx_ftoc are macros that cast a “cell” type into “float” and vice versa, but in contrast to the standard type casts of C/C++ they do not change the bit representation of the value that is cast.

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)