SA-MP Forums Archive
abs - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: abs (/showthread.php?tid=407848)



abs - Zeyo - 15.01.2013

Well... I wanted to make my own function for absolute value and so I did... Now, the pawn compiler returned a warning saying:

Код:
F:\ZGM.pwn(169) : warning 213: tag mismatch
Line 169 is the line return val;
Here is the code:
Код:
#include <a_samp>
forward abs(Float:val);
public abs(Float:val)
{
	if(val < 0.0)
	{
	    val = val * (-1.0);
	}
	return val;
}
I wonder why?

Thanks


Re: abs - [KHK]Khalid - 15.01.2013

As this function is supposed to return a float number, it should be like this:

pawn Код:
stock Float:abs(Float:val)
{
    if(val < 0.0)
    {
        val = val * (-1.0);
    }
    return val;
}



Re: abs - Zeyo - 15.01.2013

Thanx xD