How am I doing this wrong? MySQL
#1

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?
Reply
#2

still looking for help, it gets the values from the MySQL okay, i just need a better way to convert those values into pickups
Reply
#3

Use a string instead of AddStaticPickup(1239,1,sInfo[posx],sInfo[posy],sInfo[posz]);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)