23.04.2014, 01:09
I presume its not putting anything relating to fieldnames/tablenames into the txt file. I'll open up pawno now
Edit:
Using this script:
Outputs:
Edit:
Using this script:
pawn Код:
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;
}
Код:
---------- Loaded log file: "server_log.txt". ---------- SA-MP Dedicated Server ---------------------- v0.3z-R2, ©2005-2014 SA-MP Team [02:30:27] [02:30:27] Server Plugins [02:30:27] -------------- [02:30:27] Loading plugin: mysql [02:30:27] >> plugin.mysql: R38 successfully loaded. [02:30:27] Loaded. [02:30:27] Loading plugin: streamer [02:30:27] Loaded. [02:30:27] Loaded 2 plugins. [02:30:27] [02:30:27] Filterscripts [02:30:27] --------------- [02:30:27] Loaded 0 filterscripts. [02:30:27] Number of vehicle models: 0 [02:30:27] Loaded house 1 123.000000 456.000000 789.000000