SA-MP Forums Archive
How to writing string into enum? - 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: How to writing string into enum? (/showthread.php?tid=653508)



How to writing string into enum? - 3417512908 - 06.05.2018

Hi guys.
I wanna writing string into enum.
It`s right?;
Код:
enum pInfo
{
pChengHao[24]
}
new PlayerInfo[MAX_PLAYERS][pInfo];
Код:
PlayerInfo[playerid][pChengHao]=strlen(inputtext);
I don`t know why.They give me to save some strange code


Re: How to writing string into enum? - TadePoleMG - 06.05.2018

Hi

where you save this enum (.ini, .sav, or only in vairable or where)


Re: How to writing string into enum? - 3417512908 - 06.05.2018

Quote:
Originally Posted by TadePoleMG
Посмотреть сообщение
Hi

where you save this enum (.ini, .sav, or only in vairable or where)
I just want to writing string into enum

And save to users .ini:
Код:
INI_WriteString(File,"ChengHao",PlayerInfo[playerid][pChengHao]);
(Saving is no problem,string enum have some bug)

Sorry my bad English


Re: How to writing string into enum? - TadePoleMG - 06.05.2018

Can you tried
that

PHP код:
// PlayerInfo[playerid][pChengHao]=strlen(inputtext); 
Is it returns error.


Re: How to writing string into enum? - TadePoleMG - 06.05.2018

Here you go :-

PHP код:
 // Use memcpy
// Example
new destination[64] = "Hi";
new 
source[] = "String";
memcpy(destinationsourcestrlen(destination) * 4sizeof source 4sizeof destination); 



Re: How to writing string into enum? - Dayrion - 06.05.2018

https://sampforum.blast.hk/showthread.php?tid=265433 ; Use strcpy or format.