SA-MP Forums Archive
saving string in array - 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: saving string in array (/showthread.php?tid=647424)



saving string in array - jasperschellekens - 04.01.2018

I dont get this to work. How to properly save a string in an array?

These doesnt work:

Код:
format(str,sizeof(str),"%s", reason);
ReportInfo[playerid][ReportedReason] = str;

//or
ReportInfo[playerid][ReportedReason] = reason;



Re: saving string in array - Weponz - 05.01.2018

The top one will work if ReportedReason is a string and the same cell size as str.


Re: saving string in array - RogueDrifter - 05.01.2018

I only see this happening by formatting.
PHP код:
format(ReportInfo[playerid][ReportedReason],ReportInfo[playerid][ReportedReason],"%s"reason); 
Maybe i'm wrong but try you never know.


Re: saving string in array - jasperschellekens - 05.01.2018

Quote:
Originally Posted by Weponz
Посмотреть сообщение
The top one will work if ReportedReason is a string and the same cell size as str.
Thanks, i set the array to be a string and it worked.