Returning strings or floats
#3

Quote:
Originally Posted by [uL]Pottus
View Post
There is absolutely no need for multiple filterscripts, use callback hooking and compile them into the gamemode but to answer your question try this.

#include <a_samp>

pawn Code:
main() {
    new Float:t = Test();
    printf("%f", t);
}

forward Float:Test();
public Float:Test() { return 1.0; }
You can test that code on this website.

http://slice-vps.nl:7070/
True, I'll answer the how to return string #TeamWork, how ever you could use a stock or like the one below, as long the function with Float: tag needs to be above the function, so it wouldn't give an error: warning 208: function with tag result used before definition, forcing reparse

pawn Code:
#include <a_samp>

//Returning a float.
Float:ReturnFloat()
{
    return 1.0;
}

//Returning a string
ReturnString(string[])
{
    print(string);
    return string;
}

//Debug Purposes
main()
{
    new Float:RetFloat = ReturnFloat();
    printf("%f", RetFloat);
    ReturnString("Long String, Test Me, Test me.");
    return true;
}
Debug Result (Using PPG)
Code:
1.000000
Long String, Test Me, Test me.
Reply


Messages In This Thread
Returning strings or floats - by PowerPC603 - 19.12.2013, 17:41
Re: Returning strings or floats - by Pottus - 19.12.2013, 18:01
Re: Returning strings or floats - by Patrick - 19.12.2013, 18:19
Re: Returning strings or floats - by Emmet_ - 19.12.2013, 18:28
Re: Returning strings or floats - by PowerPC603 - 19.12.2013, 20:30
Re: Returning strings or floats - by PowerPC603 - 19.12.2013, 21:29

Forum Jump:


Users browsing this thread: 1 Guest(s)