strcat()
#1

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?
Reply
#2

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?
Reply
#3

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.
Reply
#4

Thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)