forward LoadStuff();
public LoadStuff()
{
new rows = cache_num_rows();
if(rows)
{
new id, loaded;
while(loaded < rows)
{
id = cache_get_field_content_int(loaded, "ID");
cache_get_field_content(loaded, "Name", StuffInfo[id][sName], .max_len = MAX_STUFF_NAME);
StuffInfo[id][sType] = cache_get_field_content_int(loaded, "Type");
StuffInfo[id][sEconomyType] = cache_get_field_content_int(loaded, "EconomyType");
StuffInfo[id][sTax] = cache_get_field_content_int(loaded, "Tax");
StuffInfo[id][sVault] = cache_get_field_content_int(loaded, "Vault");
loaded++;
}
printf(" [Stuff System] Loaded %d stuff.", loaded);
}
return 1;
}
forward LoadStuff();
public LoadStuff()
{
new rows = cache_num_rows(),id, loaded=0;
if(rows)
{
while(loaded < rows)
{
id = cache_get_field_content_int(loaded, "ID");
cache_get_field_content(loaded, "Name", StuffInfo[id][sName], .max_len = MAX_STUFF_NAME);
StuffInfo[id][sType] = cache_get_field_content_int(loaded, "Type");
StuffInfo[id][sEconomyType] = cache_get_field_content_int(loaded, "EconomyType");
StuffInfo[id][sTax] = cache_get_field_content_int(loaded, "Tax");
StuffInfo[id][sVault] = cache_get_field_content_int(loaded, "Vault");
loaded++;
}
}
printf(" [Stuff System] Loaded %d stuff.", loaded); // right here
return 1;
}
Hey buddy..
Could you try to move printf function like this? NOTE: If it still doesn't display, tell me and i'll fix it for you. PHP код:
|
forward LoadStuff();
public LoadStuff()
{
new rows = cache_num_rows();
if(rows)
{
new id, loaded;
while(loaded < rows)
{
id = cache_get_field_content_int(loaded, "ID");
cache_get_field_content(loaded, "Name", StuffInfo[id][sName], .max_len = MAX_STUFF_NAME);
StuffInfo[id][sType] = cache_get_field_content_int(loaded, "Type");
StuffInfo[id][sEconomyType] = cache_get_field_content_int(loaded, "EconomyType");
StuffInfo[id][sTax] = cache_get_field_content_int(loaded, "Tax");
StuffInfo[id][sVault] = cache_get_field_content_int(loaded, "Vault");
loaded++;
}
printf(" [Stuff System] Loaded %d stuff.", loaded);
}
return 1;
}
Have you tried the codes which i sent it from 1st post in this topic?
|
new
Database = 1;
main(){}
public OnGameModeInit()
{
mysql_log(LOG_ALL,LOG_TYPE_TEXT);
Database = mysql_connect("localhost","user","testdb","pass");
mysql_tquery(Database,"SELECT * FROM `houses`","OnHouseLoad");
return 1;
}
forward OnHouseLoad();
public OnHouseLoad()
{
if(cache_num_rows())
{
for(new i = 0; i<cache_num_rows(); i++)
{
new ID = cache_get_field_content_int(i,"id",Database);
new Float:x = cache_get_field_content_float(i,"x",Database);
new Float:y = cache_get_field_content_float(i,"y",Database);
new Float:z = cache_get_field_content_float(i,"z",Database);
printf("Loaded house %d %f %f %f",ID,x,y,z);
}
}
else print("No houses found.");
return 1;
}
forward LoadStuff();
public LoadStuff()
{
new rows = cache_num_rows();
for(new i; i < rows; i++)
{
id = cache_get_field_content_int(i, "ID");
cache_get_field_content(i, "Name", StuffInfo[id][sName], .max_len = MAX_STUFF_NAME);
StuffInfo[id][sType] = cache_get_field_content_int(i, "Type");
StuffInfo[id][sEconomyType] = cache_get_field_content_int(i, "EconomyType");
StuffInfo[id][sTax] = cache_get_field_content_int(i, "Tax");
StuffInfo[id][sVault] = cache_get_field_content_int(i, "Vault");
}
printf(" [Stuff System] Loaded %d stuff.", rows);
return 1;
}