format as a non void function - 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: format as a non void function (
/showthread.php?tid=598225)
format as a non void function -
BiosMarcel - 10.01.2016
Hello,
I was asking myself, if anyone could recreate the "format" function as a function that returns a string instead of formatting one that already exists, like that:
PHP код:
SendClientMessage(playerid,-1,format("%s is %i years old.",name,age));
I don't know how to do that, neither did i find smth like that, i hope someone can help.
greetings Marcel
Re: format as a non void function -
Crayder - 10.01.2016
This has already been done.
String library by Slice. "strlib"
The function you are looking for in there is "sprintf" and it works exactly as you suggested.
Re: format as a non void function -
BiosMarcel - 10.01.2016
Thanks for the help ^^