Strange Problem : strcat - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Server (
https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (
https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: Strange Problem : strcat (
/showthread.php?tid=540835)
Strange Problem : strcat -
AnnaSB - 07.10.2014
Hi all. Can somebody help me debugging this code? When I call
IndexDrawAddOption, the textdraw used in it is completely emptied out...
definitions:
Код:
enum KEY_LIST
{
keychar[2],
keyname[64]
}
new Text:iTextDraw[MAX_IDRAWS] = { Text:NULL };
new iDrawTitle[MAX_IDRAWS][64];
new iDrawActive[MAX_SLOTS] = { NULL };
new iCancelKey[MAX_IDRAWS] = { KEY_FIRE };
new iDataSheet[MAX_IDRAWS][MAX_IDRAW_OPTIONS][KEY_LIST];
new iDrawColor[MAX_IDRAWS][3][12];
and the function: (in this scenario,
xStr empties out)
Код:
stock IndexDrawAddOption(idraw, keytitle[], keystate[])
{
for (new i = 0; i < MAX_IDRAW_OPTIONS; i++)
if (strcmp(iDataSheet[idraw][i][keychar], keystate) == 0 && strlen(iDataSheet[idraw][i][keychar]) != 0)
{
printf("IndexDrawer: iDraw Detected a Repeated KeyChar in iDraw #%i.", idraw);
return -1;
}
for (new i = 0; i < MAX_IDRAW_OPTIONS; i++)
if (strlen(iDataSheet[idraw][i][keychar]) == 0)
{
format(iDataSheet[idraw][i][keychar], strlen(iDataSheet[idraw][i][keychar]), keystate);
format(iDataSheet[idraw][i][keyname], strlen(iDataSheet[idraw][i][keyname]), keytitle);
// xSet
new xStr[256];
format(xStr, sizeof xStr, "%s%s~n~", iDrawColor[idraw][0], iDrawTitle[idraw]);
for (new h = 0; h < MAX_IDRAW_OPTIONS; h++)
{
if (strlen(iDataSheet[idraw][h][keychar]))
{
strcat(xStr, iDrawColor[idraw][1]);
strcat(xStr, iDataSheet[idraw][h][keychar]);
strcat(xStr, ". ");
strcat(xStr, iDrawColor[idraw][2]);
strcat(xStr, iDataSheet[idraw][h][keyname]);
strcat(xStr, "~n~");
}
}
TextDrawSetString(iTextDraw[idraw], xStr);
// ----
return i;
}
printf("IndexDrawer: iDraw Options Overflow for iDraw #%i. Maximum is 20 Per iDraw.", idraw);
return -1;
}
hope you can help
Regards - Anna SB
Strange Problem : strcat -
AnnaSB - 08.10.2014
Oh no, can somebody remove this thread? I posted it here instead of 'Scripting Help', by mistake.
Thanks