22.05.2014, 19:44
Hello guys, I've a problem with my businesses system which I'm trying to create right now.
Here's a code for uploading data from database to server:
Now when I put this stock under OnGameModeInit(); :
It doesn't execute anything under this function (doesn't create any objects, other labels etc.) and doesn't execute itself (don't load any labels and businesses).
+rep for helper
Here's a code for uploading data from database to server:
pawn Код:
stock IkeltiVerslus()
{
mysql_query(1, "SELECT * FROM verslai"); // selects everything from businesses table
mysql_store_result();
new rez[256], s[256], i = 0;
while(mysql_fetch_row_format(rez, "|")) // loops through every row in database and writes the data to the bussines enum
{
i++;
mysql_get_field("ID", rez); vInfo[i][ID] = strval(rez);
mysql_get_field("owner", vInfo[i][Owner]);
mysql_get_field("name", vInfo[i][Name]);
mysql_get_field("extx", rez); vInfo[i][exterior][0] = floatstr(rez);
mysql_get_field("exty", rez); vInfo[i][exterior][1] = floatstr(rez);
mysql_get_field("extz", rez); vInfo[i][exterior][2] = floatstr(rez);
mysql_get_field("intx", rez); vInfo[i][interior][0] = floatstr(rez);
mysql_get_field("inty", rez); vInfo[i][interior][1] = floatstr(rez);
mysql_get_field("intz", rez); vInfo[i][interior][2] = floatstr(rez);
mysql_get_field("bought", rez); vInfo[i][bought] = strval(rez);
mysql_get_field("inter", rez); vInfo[i][inter] = strval(rez);
if(vInfo[i][bought] == 1) // if business is bought, in label is written title of business and owner name
{
format(s, sizeof(s), "%s\n{15FF0F}Savininkas: {FFFFFF}%s\n{B36666}Spauskite ENTER noredami ieiti", vInfo[i][Name], vInfo[i][Owner]);
vInfo[i][labelid] = Create3DTextLabel(s, COLOR_CYAN, vInfo[i][exterior][0],vInfo[i][exterior][1],vInfo[i][exterior][2], 40, 0, 1);
}
else // else there's written that business has the name "---" and no owner
{
format(s, sizeof(s), "---\n{15FF0F}Savininkas: {FFFFFF}Vyriausybe\n{B36666}Spauskite ENTER noredami ieiti");
vInfo[i][labelid] = Create3DTextLabel(s, COLOR_CYAN, vInfo[i][exterior][0],vInfo[i][exterior][1],vInfo[i][exterior][2], 40, 0, 1);
}
}
mysql_free_result();
}
pawn Код:
public OnGameModeInit()
{
IkeltiVerslus();
//................ other stuff
}
+rep for helper