SA-MP Forums Archive
strcat problem - 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 problem (/showthread.php?tid=585174)



strcat problem - zaibaslr2 - 11.08.2015

Hi,
Код:
enum Enum
{
	memberslist[256],
...
...
}
Код:
strcat(Array[id][memberslist],form("%s ",pName(playerid)));
printf("array id %d, string = '%s'",id,Array[id][memberslist]);
prints "array id 0, string = 'NULL'"
functions form() and pName() are ok and working.

It should add player name to the string with a space, like
Quote:

Name_First Name_Second Name_Third

What's wrong?


Re: strcat problem - MarvinPWN - 11.08.2015

PHP код:
strcat(Array[id][memberslist],form("%s ",pName(playerid))); 
to
PHP код:
format(Array[id][memberslist],256,"%s ",pName(playerid)); 
Does it work?


Re: strcat problem - zaibaslr2 - 11.08.2015

Quote:
Originally Posted by MarvinPWN
Посмотреть сообщение
PHP код:
strcat(Array[id][memberslist],form("%s ",pName(playerid))); 
to
PHP код:
format(Array[id][memberslist],256,"%s ",pName(playerid)); 
Does it work?
No, new names will be added to current name so I muse use strcat.

FIXED: had to type string size (3rd strcat parameter) since enums don't work like I thought


Re: strcat problem - zaibaslr2 - 12.08.2015

Now I got another problem.
As soon as I do strcat, my string is now
"NULLName_First"
How do I remove the NULL in the beginning?
Thanks