strcat not working - 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: strcat not working (
/showthread.php?tid=641997)
strcat not working -
Kampott - 23.09.2017
trying to replace hInfo[house][safec] by inputtext, this is the code:
Код:
strcat(hInfo[house][safec], inputtext);
format(result, sizeof(result), "You've changed safe house code to: "#COL_YELLOW"%s. "#COL_WHITE"Please save it.", hInfo[house][safec]);
In game, it's showing me "to: 0000 (The old [safec] value)", so the strcat didn't work. What's wrong with the code?
Re: strcat not working -
MEW273 - 23.09.2017
I would use format instead of strcat, like so:
Код:
format(hInfo[house][safec], sizeof(hInfo[house][safec]), inputtext);
format(result, sizeof(result), "You've changed safe house code to: "#COL_YELLOW"%s. "#COL_WHITE"Please save it.", hInfo[house][safec]);
Re: strcat not working -
Kampott - 23.09.2017
thanks, it worked with format.
Re: strcat not working -
OneDay - 23.09.2017
PHP код:
sizeof (hInfo[house][safec])
Is 1 for enum - use
PHP код:
strcat(hInfo[house][safec], inputtext, 32);
Or some other size.