How am I doing this wrong? MySQL - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How am I doing this wrong? MySQL (
/showthread.php?tid=64048)
How am I doing this wrong? MySQL -
NovaParadox - 01.02.2009
public OnServerCreateStores()
{
new query[128];
new rcnt = 0;
new Data[1024];
new Field[64];
for (new i = 0; i < 20; i++)
{
format(query, sizeof(query), "SELECT * FROM stores WHERE id = %d LIMIT 1", i);
samp_mysql_query(query);
samp_mysql_store_result();
samp_mysql_fetch_row(Data);
samp_mysql_strtok(Field, "|", Data);
// Analyzing Data returned
while (samp_mysql_strtok(Field, "|", "")==1)
{
if (rcnt == 0) sInfo[i][id] = strval(Field);
if (rcnt == 1) sInfo[i][type] = strval(Field);
if (rcnt == 2) sInfo[i][posx] = float(strval(Field));
if (rcnt == 3) sInfo[i][posy] = float(strval(Field));
if (rcnt == 4) sInfo[i][posz] = float(strval(Field));
printf(Field);
rcnt++;
}
sInfo[i][id] = AddStaticPickup(1239,1,sInfo[i][posx],sInfo[i][posy],sInfo[i][posz]);
}
return 1;
}
So everything with MySQL seems to be working correcly, but it tried to create the same object several times. and the object it creates does not appear.
Any ideas to make this more efficient?
Re: How am I doing this wrong? MySQL -
NovaParadox - 01.02.2009
still looking for help, it gets the values from the MySQL okay, i just need a better way to convert those values into pickups
Re: How am I doing this wrong? MySQL -
ICECOLDKILLAK8 - 01.02.2009
Use a string instead of AddStaticPickup(1239,1,sInfo[posx],sInfo[posy],sInfo[posz]);