[Include] returnf.inc BETA
#1

returnf



For the above image, the code looks like:
pawn Код:
RET:time()
{
    new hr, mn, sc;
    gettime(hr, mn, sc);
    RETF("%i:%i", hr, mn);
}

RET:myscore(playerid)
{
    RETF("%i", GetPlayerScore(playerid));
}

RET:randomcar() RETF("%s", aVehicleNames[random(sizeof aVehicleNames)]);

RET:dice() RETF("%i", random(6)+1);

RET:toss() RETF("%s", (random(2)) ? ("Head") : ("Tail"));

public OnPlayerText(playerid, text[])
{
    returnf(text, playerid);
    //There could be a bug due to the string lengths..
    //If you type a text that is 30 characters,
    //and the format returns something bigger than 30,
    //The returned result will get trimmed.
    //Best would be to format it into a longer string (create a new one).
    return true;
}
Download:
Pastebin - RAW
Mediafire

Changelog:
Код:
* 5/Mar/2012: Initial Release.
* 6/Mar/2012: Minor Fix + Removed useless debug part of the code.
 Modified the RETF function, you can use floats/ints/strings etc.
How to Use:
pawn Код:
//Create a new return function:

RET:developer()
{
     RETF("%s", "Kalcor");
}

//Now, use
returnf("Haha, this is something cool. Creator of SA-MP: #developer#");
This will replace the string's #developer# to "Kalcor".
If you use it in Commands/Text, same thing will happen.

Legal:
Mozilla Public License 2.0

Don't release any other version without my permission.

Bugs:
Report if you find any.
Reply


Messages In This Thread
returnf.inc BETA - by iPLEOMAX - 05.03.2012, 13:53
Re: returnf.inc BETA - by Konstantinos - 05.03.2012, 14:00
Re: returnf.inc BETA - by T0pAz - 05.03.2012, 14:13
Re: returnf.inc BETA - by Michael@Belgium - 05.03.2012, 14:20
Re: returnf.inc BETA - by Hiddos - 05.03.2012, 14:40
Re: returnf.inc BETA - by s3rious - 05.03.2012, 15:51
Re: returnf.inc BETA - by wups - 05.03.2012, 15:52
Re: returnf.inc BETA - by RyDeR` - 05.03.2012, 16:00
Re: returnf.inc BETA - by iPLEOMAX - 05.03.2012, 17:50
Re: returnf.inc BETA - by Shadow_ - 05.03.2012, 17:53
Re: returnf.inc BETA - by vyper - 05.03.2012, 18:09
Re: returnf.inc BETA - by Ballu Miaa - 06.03.2012, 03:34
Re: returnf.inc BETA - by Niko_boy - 06.03.2012, 04:12
Re: returnf.inc BETA - by iPLEOMAX - 06.03.2012, 08:13

Forum Jump:


Users browsing this thread: 2 Guest(s)