Loading MySQL data in 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: Loading MySQL data in Enum (
/showthread.php?tid=309151)
Loading MySQL data in Enum -
Wesley221 - 06.01.2012
Hey guys,
Im not sure how im able to transfer data that are 'stored' in MySQL, to an enum.
Would it work like this, or wouldnt this work at all (or is there a better way?)?
pawn Код:
while( mysql_fetch_row_format( query, "|" ) )
{
mysql_fetch_field_row( savingstring, "Naam" );
PlayerInfo[playerid][Naam] = savingstring;
mysql_fetch_field_row( savingstring, "Score" );
PlayerInfo[playerid][Score] = savingstring;
}
~Wesly
Re: Loading MySQL data in Enum -
Luis- - 06.01.2012
I tend to use sscanf, example:
pawn Код:
while(mysql_fetch_row_format(line))
{
sscanf(line, "p<|>dddd", 1, 2, 3, 4);
}
No idea if it'll be faster or not.
Re: Loading MySQL data in Enum -
Wesley221 - 06.01.2012
And where the 1, 2, 3, 4 are, should there the items be which you wanna load into a variable? Example, 1 will be the name, 2 will be the password, 3 will be the score, 4 the money, or..?
Re: Loading MySQL data in Enum -
Luis- - 06.01.2012
Yeah.
Re: Loading MySQL data in Enum -
Wesley221 - 06.01.2012
Alright, thanks! I will try that out