SA-MP Forums Archive
Save with mysql in one line. - 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: Save with mysql in one line. (/showthread.php?tid=550909)



Save with mysql in one line. - Banditukas - 15.12.2014

Hi,

Now i think that can to do just one field, and write there everything name,xp and other stuff like that

Код:
Name_SurName | 50000 | 10 | Infinitive | 0
And then load in one field, and set XP with what is in first | an so on. I think you understand. But how do it properely.


Re: Save with mysql in one line. - Raweresh - 15.12.2014

Yes you can, just save that as string, something like that:
Код:
IP|XP|MONEY|LEVEL|ETC
But you need at least 2 field, with name and others.
When you load it from mysql:
Код:
SELECT /*THAT STRING*/ FROM /*YOUR TABLE*/ WHERE NAME = '%s'
And I think you know how to format it.
And now, you need sscanf.
Код:
new String[256];
cache_get_constant_row(0,"/*THAT STRING*/",String);
sscanf(String,"...");
Give that what you want to save or you need to work alone now.


Re: Save with mysql in one line. - Banditukas - 15.12.2014

But it'is hard, because if i store strings which player can to write, but of course am escaping them, but still if i'am separate then with | or other symbol, if that string will be will be | then read from then and bugged loading and saving.