strcat() - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: strcat() (
/showthread.php?tid=241414)
strcat() -
admantis - 17.03.2011
I would like to know how I can format strings with %s, %i, %d, %x and similar in strcat functions
pawn Code:
strcat(string, %s, sizeof(string)); // how do I insert a string here?
Re: strcat() -
pawn_ - 18.03.2011
I don't know if it will work, but you gotta format the string first (pretty sure).
pawn Code:
new s[16];
format(s, sizeof(s), "Message\n");
strcat(string, s, sizeof(string)); // how do I insert a string here?
Re: strcat() -
Calgon - 18.03.2011
https://sampwiki.blast.hk/wiki/Strcat
strcat's second parameter is a STRING which you cannot format with multiple arguments in the function, you should use format() for that.
pawn Code:
new
szReplicateString[24],
szNewString[24];
format(szNewString, sizeof(szNewString), "aoaoao%d", GetPlayerWantedLevel(0));
strcat(szReplicateString, szNewString, sizeof(szNewString));
tl;dr: You can't format strings using strcat.
Re: strcat() -
admantis - 18.03.2011
Thank you